A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.
Can anyone recommend a good learning resource for Delphi 7? I've never found the Delphi documentation particularly helpful. Ditto the Cantu book.
I'm using the Firebird DBMS, and could use some pointers with that as well.
I've read as much as I can online, but what I'm looking for are some basic tutorials that tell me how to do common tasks. It's the sort of stuff that a professional Delphi developer could probably describe in ten minutes, but for some reason the books overlook. For example, how do I connect to Firebird and return a simple result set? How are updates handled? Just five-minute, simple stuff. The documentation seems to miss this sort of thing.
In the MS and Java worlds I've always found this information easily, but with Delphi--even back to Version 1--it has always seemed elusive. Perhaps Delphi and I aren't on the same wavelength. ;)
For Firebird you will definitely want "The Firebird Book" by Helen Borrie. Great refence guide to Firebird programming. Doesn't have much Delphi-specific stuff, though. Is up-to-date through FB 1.5; the about-to-be-released FB 2.0 changes a few things, not much.
For Delphi the Cantu book actually does have some good chapters on programming with the BDE. Almost all of this translates over to working with other databases, since the component sets for other db's all descend from same TDataset api as used by BDE. These TDataset descendants are analogous to recordset objects in MSFT environment. They differ from BDE component set in a couple of ways (e.g., different components and ways of connecting to db) but are mostly similar in general operation of the query components.
For Firebird you would basically just want to pick a component set to use and go from there. There are quite a few you could use:
IBX (part of standard Borland components),
IBO (trustware, pay if you your conscience tells you to),
UIB (open source),
Zeos (open source)
and others. You can get an ADO driver for Firebird and then use any of an ADO component set if you want.
The fellow running the About.com Delphi site has some good tutorials:
Tutorial on using Borland's standard IBX component set with Interbase, should be same for Firebird:
Don't use the BDE! Use ADO instead. The BDE hasn't been updated for years, can't handle unicode and has several annoying bugs. From a basic crud point of view, the BDE and ADO VCL components are interchangeable so there's no reason to use it if you're starting a new project.
With respect to connecting to Firebird, you should be able to create an ODBC DSN called firebirddsn and then do this:
DSN = 'firebirddsn';
Connection := TADOConnection.Create(nil);
Connection.ConnectionString := 'Provider=MSDASQL;DSN=' + DSN + ';';
Connection.LoginPrompt := False;
Query := TADOQuery.Create(nil);
Query.Connection := Connection;
Query.SQL.Add('select field1 from acetable');
while not Query.Eof do
It was indented nicely before I pasted it. I haven't tried compiling so say if you can't make it work.
(You don't have to use a DSN, I just couldn't be bothered to look up connection strings for Firebird.)
"Don't use the BDE! Use ADO instead. The BDE hasn't been updated for years, can't handle unicode and has several annoying bugs. From a basic crud point of view, the BDE and ADO VCL components are interchangeable so there's no reason to use it if you're starting a new project.
With respect to connecting to Firebird, you should be able to create an ODBC DSN "
Not quite sure what you're trying to say here. If you're implying that the Firebird/Interbase components sets I listed above use the BDE then that's not true. They operate similarly to the BDE and use TDataset descendants, just like the ADO VCL components. And they're generally faster because they don't have to negotiate the additional layer of complexity that ADO adds. Unless there's a need to add the additional abstraction of ADO (e.g., to ease portability between different backends) it's probably better to stick with one of the native IB/FB component sets.
Also, if you were going to use ADO you would probably be better off using one of the ADO/OLEDB drivers available for Firebird, not ODBC. Here are a few of them:
"You're so vain, you probably think this post is about you", as Carly Simon never quite sang.
I wasn't responding to what you said, I was answering the original question. And I know he doesn't have to use ODBC, which was why I said "You don't have to use a DSN". I accept your point about ADO. Anything as long as it's not the BDE, though.
Anyway, the reason I returned to this thread was because I realised I hadn't given the name of the unit that the ADO components are in, which is ADODB. You could find this out by looking them up in the help. To be able to use this unit in your code, find the line that says implementation in the same unit as you put the function above and add a "uses" clause two lines below, like this:
There might be a uses clause there already, in which case just add ADODB to the end, e.g.:
uses DateUtils, Types, Contnrs, ADODB;
"a professional Delphi developer could probably describe in ten minutes, but for some reason the books overlook. For example, how do I connect to Firebird and return a simple result set? How are updates handled? Just five-minute, simple stuff. The documentation seems to miss this sort of thing."
Since it sounds like you have the Cantu book you might want to try loading the database demo projects on the included CD. They are mostly for the BDE, I think, but they should illustrate general process. I'm pretty sure you can even connect to Firebird from BDE if you set up an ODBC driver. When you move to a dedicated Firebird component set there will be different connection components and additional components that take advantage of db-server stuff in Firebird, like stored procedures. But basics are the same.
Thanks for all the replies. When I started playing with Delphi again a couple of months ago I noticed all the different component sets and found them quite confusing! I think I had downloaded Zeos but couldn't quite figure it out and ended up back with the IBX components (there's also the comfort of going with the vanilla implementation).
Whenever I approach a new development platform I always want to know "how the pros do it," in terms of configuring projects, segmenting code, and other best practices--stuff that often seems to be missing from books, which typically take a simpler approach to conveying basic concepts. Sometimes this information can be found in the newsgroups, so perhaps I should check there.
A nice demo project would be great, too, but that isn't always available. I'll see if I can download the Cantu code online; the book I had was from my local library and lacked the CD.
The reason for all this is that I'm considering using Delphi for product development (which is also why I purchased versions 1 and 3 when they came out, and never really got anywhere with it; wish I had!).
This topic is archived. No further replies will be accepted.Other recent topics
Powered by FogBugz