Hello Robert, here's what I found about Firebird the last two days:
As you might have noticed I've started working on a ASP.NET application
using Delphi and I obviously wanted to use my favorite database,
Firebird. First of all there's not much info on Firebird + ADO.NET
provider + Delphi.NET, but there's a good raison for that: Firebird's
ADO.NET is, well, an ADO.NET provider! It works like any other ADO.NET
provider and there isn't much specific info to say about it. For the
parts that are specific to Firebird, make sure you take a look at the
SDK / CHM documentation that got installed on your system when you
installed the ADO.NET provider.
Moving on, I noticed you're taking the hard road building the connection
string. The FbConnectionStringBuilder has properties for every single
parameter, you don't need to add them as text. If you add them as text
and you miss-spell something you'll be in trouble, the engine might miss
them.
CNB := FbConnectionStringBuilder.Create;
CNB.UserID := 'SYSDBA';
CNB.Password := 'masterkey'; // default password
CNB.Database := 'C:\TechDB\TechDB.FDB'; // Database path
CNB.Port := 3050; // This is the default
CNB.Pooling := True; // Smart for ASP.NET
CNB.ServerType := 1; // This has to be 1 for embeded
// Start the connection
FConnection := FbConnection.Create(CNB.ToString);
Since you ran into trouble starting the application because of the not
found DLL, here's something about that DLL and it's history (I suspect
there's an bad error message). Your application is complaining about the
thing that's called "the client library". Historically this was called
GDS32.DLL (back in the days when Firebird was actually Interbase). When
the switch was made to Firebird, they changed the name of the default
client library to "FBCLIENT.DLL". This "new" client library exposes
almost the same interface as GDS32 and, in fact, changing it's name to
GDS32.DLL will keep older applications happy. When they shipped the
Embedded version of Firebird they shipped the library with yet an other
name, and the developer is supposed to change it's name to whatever's
required. This is documented in the "readme_embeded.txt" file in the
"doc" subfolder of the embeded installation. My guess is that you'll
need to change it's name to "fbclient.dll", those I haven't tried it, I
haven't used the embeded version of Firebird with NET.
Further on, you should install the FULL version of Firebird on your
development machine. This is not really required but it makes debugging
easy: The Embeded version of Firebird only allows one application
access to the database at any given time (that's why it's embeded, it
has no inter-process communication capabilities), and this makes things
a bit difficult. Ex: if you keep a connection to the database opened
from the Delphi IDE and you hit Run to start the application, the
application will complain about not being able to connected to the
database as the database is opened by a different application. Besides,
when I'm working on a database application I always keep a DB Management
application opened and connected to the Database. This gives me the
ability to quickly test a SQL query in a better / more forgiving
environment and gives me the ability to change stuff around.
And yes, about the DB Management application, please install IBExpert
Personal Edition. It's about a million times better then IBConsole so it
really helps a lot! You'll find it at www.ibexpert.com. You'll need to
fight the interface a bit (as they're running an "odd" experiment with
the Personal Edition download page) but keep going, it will eventually
work. Note: use Internet Explorer. I wasn't able to get it working with
Opera.
If you need an introduction to SQL and Interbase/Firebird, take a look
here:
http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_download_documentation
Most documentation is about Interbase 6.0, but it all works with
Firebird 2.0 as well. And please note, you don't really need to use the
"isql" tool to run the sample codes in that document. IBExpert works
just fine. I personally prefer a GUI for whatever. I'm a Windows
programmer after all...
P.S: Fell free to mail me directly if the list moving too slow.
Robert Meek wrote:
> It took more than a lot of searching, but finally after combining
> and extrapolating the code I found on 4 different sites, I finally came up
> with what I believe is a proper start to using Firebird in an embedded
> application. Here it is in Pascal NET code, ( the types and vars are
> elsewhere):
>
> MyFBConnectionString := new FbConnectionStringBuilder();
> MyFBConnectionString.Add('ServerType', 1);
> MyFBConnectionString.Add('User', 'SYSDBA');
> MyFBConnectionString.Add('Pooling', False);
> MyFBConnectionString.Add('Password', 'masterkey');
> MyFBConnectionString.Add('Dialect', 3);
> MyFBConnectionString.Add('Database', DataStoreFile);
> MyFbConnection := new FbConnection();
> MyFbConnection.CreateDatabase(MyFBConnectionString.ToString);
>
> At least this seems to compile! Unfortunately however, I am now
> getting an error message when I attempt to run it thru the debugger saying
> that it cannot find the fbembed.dll, which is located not only where it was
> originally installed, but also in the application's exe directory! So the
> only thing I can think of is that I'm still missing something in my
> connection string. Does anyone know how to get past this?
> Also, it's hard for me, coming from a strict Delphi background, to
> believe how difficult it seems to be to get decent info on using Firebird!
> I've asked everywhere including here before, and all I get are cryptic
> replies like google it or your connection string is wrong! The docs have
> absolutely no information to help a beginner start using it, and even the
> code above, which is an extrapolation of googled code I can't say for sure
> will work because it matches nothing I found anywhere! Nothing I found
> would compile! This makes it very improbable that I would waste any money
> of a Firebird book because if the internet docs and the docs that come with
> the installation are this bad I'd be afraid of what I'd find in a real book!
> I'm not trying to be a smartass. I'm really frustrated by the lack
> of honest help and documentation that I've always depended upon with Delphi.
> One guy replied to my query on the firebird list privately and told me that
> I didn't know how to read, then proceeded to give me code and instructions
> that had nothing to do with what I had asked!
> So now even IF someone is able to tell me that the above code is
> correct, or help me fix it if it is not, and can tell me how to get the app
> to find the dll it cannot seem to now, I have no idea of what to do next!
> The docs are full of interesting facts about SQL, but nowhere have IO seen
> any instructions that show one how to setup and create tables, fields, give
> them values, indexes, and retrieve data back without SQL! Yet I'm told it
> is possible! Please tell someone who has only worked with dB's via
> components where to find the information I need to make use of what I'm told
> is a great system!
>
> from Robert Meek dba Tangentals Design CCopyright 2006
> Proud to be a moderator of "The Delphi Lists" at elists.org
>
> (["An unused program is the consequence of a higher logic!", nil]) As
> written in The Compendium of Accepted Robotic and Surrlogic Theorems Used in
> the Self Analysis of Elemental Positronic Pathways...1st Edition Revised
>
>
>
> _______________________________________________
> Delphi-DB mailing list
> [email protected]
> http://www.elists.org/mailman/listinfo/delphi-db
>
>
_______________________________________________
Delphi-DB mailing list
[email protected]
http://www.elists.org/mailman/listinfo/delphi-db