tags:

views:

312

answers:

4

I have a lot of embedded C/C++/Ada experience and an outdated smattering of Delphi plus some database stuff.

Now I have to implement an app in Delphi which can manipulate MySql, Oracle, maybe MS Access. In short, I need ODBC.

I need to programmatically created a database, define its structure and populate its contents, then later query its existence and programmatically search.

I would prefer not to use 3rd party components, unless there is a compelling reason to do so (performance ought not to be an issue for the app, it won't have much data or be run often, at least not in v1.0) .

Can anyone point me at a tutorial which can get me up to speed? Thanks

+1  A: 

I found this after a quick Google search. Maybe this will help: Delphi Database Connections

cpalmer
+5  A: 

i think your best option is use the ADO components (dbGo) with an Microsoft OLE DB Provider for ODBC.

Delphi 7

alt text

Delphi 2007

alt text

check theses links for more info about ADO.

RRUZ
I too would recommend going ADO over ODBC/BDE. Not even sure the BDE is supported on Windows 7.
M Schenkel
BDE works under Windows 7 (even 64-bit), but when you install it, Windows will pop a warning telling that it might have issues with Office 2007. I have Office 2007 and didn't saw any issues so far (on both sides). But since the BDE is long dead, yeah, stick with ADO.
AlexV
Delphi 7 comes with ADOexpress. Does this mean that I don't need an Microsoft OLE DB Provider for ODBC? Sorry to sound dumb - I am a complete n00b wrt ODBC.
Mawg
RRUZ
+3  A: 

Apart from using dbGo for ADO (which supports ODBC), you should also check out dbExpress which has drivers for MySQL, Oracle (but not access).

These as well as BDE and the native TClientDataSet are discussed with an example (migrated from one data access technology to another) in my Delphi for Win32 VCL Database Development courseware manual, available at Lulu.com (*currently down for maintenance, but check out http://stores.lulu.com/drbob42 when they're back up) or from my own webshop as PDF including support and free upgrades.

You can also check out some free articles at http://www.drbob42.com/examines and one on TClientDataSet and dbExpress at http://conferences.embarcadero.com/article/32262

Bob Swart
Woo Hoo. Dr. Bob is in the house!
Larry Lustig
+1  A: 

The process requires a couple of steps: [1] Providing the ODBC link to the MySQL database via a Data Source Name (DSN) and [2] accessing this DSN within your Delphi code. The first (at least under Windows 7) can be accomplished using a Microsoft provided utility called "ODBC Data Source Administrator". Step 2 is performed as others have described: Drop an ADOConnection object onto your form, add an ADOTable object and a DataSource object, and (finally) DBGrid and DBNavigator controls.

J E Kronenfeld