Article View: borland.public.cppbuilder.database.ado
Article #1095Re: Accessing MySQL via ADO
From: Viatcheslav V. Vassiliev
Date: Thu, 23 Dec 2004 17:46
Date: Thu, 23 Dec 2004 17:46
58 lines
2985 bytes
2985 bytes
Native OLEDB provider for MySQL:
http://www.mysql.com/Downloads/Win32/MyOLEDB.exe
http://www.mysql.com/Downloads/Win32/MyOLEDB.chm
Not sure that it completely supports features of version 4, but it is most
native (goes from MySQL site).
Try also cmd->Parameters->...->Value = bytes;
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Tumurbaatar S." <nospam_tumur@magicnet.mn> �������/�������� � ��������
���������: news:41caab99@newsgroups.borland.com...
> My program connects to MySQL 4.1.7 using ADO components.
> The connection string points to MyODBC 3.51.10 DSN (Anybody know
> MySQL native OLEDB provider?). The table has only 4 fields where one
> of them is BLOB. The next code inserts a new record and it raises
> EAccessViolation when a command executes. When Execute() is
> removed/commented, no error.
>
> int bounds[2] = {0};
> cmd->Parameters->ParamByName("id")->Value = PacketID++;
> cmd->Parameters->ParamByName("ip")->Value = AnsiString(Buff->ip);
> bounds[1] = Buff->size - 1;
> Variant bytes = VarArrayCreate(bounds, 1, varByte);
> memcpy(bytes.ArrayLock(), Buff->data, Buff->size);
> bytes.ArrayUnlock();
> cmd->Parameters->ParamByName("data")->AppendChunk(bytes);
> cmd->Execute();
>
> table stucture:
>
> CREATE TABLE packets
> (
> id INT NOT NULL,
> ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
> ip VARCHAR(15) NOT NULL,
> data BLOB NOT NULL,
>
> PRIMARY KEY (id)
> );
>
> CREATE INDEX packets_ts ON packets (ts);
> CREATE INDEX packets_ip ON packets (ip);
>
> P.S. Also, all 3 above parameters returned by TADOCommand are
> ftString, Size=25165824, Attributes=paNullable, paLong. Why?
> Does it mean that MyODBC and ADO do not understand each other?
>
>
>
Technical Details
Message-ID:
<41cb0467$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41caab99@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,5756267530e63452 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <41caab99@newsgroups.borland.com> Subject: Re: Accessing MySQL via ADO Date: Thu, 23 Dec 2004 20:46:20 +0300 Lines: 60 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 217.73.240.53 Message-ID: <41cb0467$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1103823975 217.73.240.53 (23 Dec 2004 09:46:15 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail