D7 Firebird ZeosLib connection

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
stiff
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 04.06.2009, 00:20

D7 Firebird ZeosLib connection

Post by stiff »

According to the docs the Database is a path to the working directory for the embedded project. In reality I haven't been able to make a ZConnection1.Connect. When it is tried, I get an AV:

---------------------------
Debugger Exception Notification
---------------------------
Project DBTest1.exe raised exception class EZSQLException with message 'SQL Error: I/O error for file "C:\Program Files\Borland\Delphi7\Projects D7\Testing\Firebird ZeosDBO Embedded\" Error while trying to open file The system cannot find the path specified. . Error Code: -902. Unsuccessful execution caused by a system error that precludes
successful execution of subsequent statements'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------

The Database property in the Object Inspector of D7 looks like it is looking for a filename. How can a .fdb file be established unless a table is created which requires a connection to the fdb first? In aliases.conf it shows a dummy.fdb? :?:
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

Hi, in order to connect to an embedded firebird database you have to specify, on the Database property, a valid .fdb file or an alias saved on the alias.conf file, otherwise firebird embedded shows that message.

You need to create an .fdb file (also with no tables) and specify that file to the Database property.
stiff
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 04.06.2009, 00:20

D7 Firebird ZeosLib connection

Post by stiff »

I must really be dense. I can't find anything that shows how to make a .fdb file. I could with notepad or some text program, but it wouldn't seem right.
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

If you need create a .fdb download flamerobin and create a new db with it or create it with Zeos by this way

fdb := TZConnection.Create(nil);
qlstr := Format('CreateNewDatabase=CREATE DATABASE ''%s'' USER ''SYSDBA'' PASSWORD ''masterkey'' PAGE_SIZE 16384 DEFAULT CHARACTER SET NONE', [dbfullname]);
fdb.Properties.Clear;
fdb.Properties.Add(sqlstr);
fdb.Properties.Add('Dialect=3');
fdb.Properties.Add('hard_commit=yes');
fdb.Database := dbfullname;
fdb.Protocol := 'firebirdd-2.0';
fdb.TransactIsolationLevel := tiReadCommitted;
fdb.Open;
stiff
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 04.06.2009, 00:20

Post by stiff »

Howdy:

Being that I am using the embedded version I don't think 'firebirdd-2.0' protocol should be used. Shouldn't it be firebird-2.0? What's the differece anyway? All I downloaded and need at the present is the embedded version.
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

firebirdd -> firebird embedded
firebird -> firebird SS
stiff
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 04.06.2009, 00:20

Post by stiff »

:(
The D7 compiler rejected some of the code:

undeclared identifier 'tiReadCommitted'
and also 'Open'

I used the directory path + the dbfilename in the [dbfullname]
trupka
Expert Boarder
Expert Boarder
Posts: 140
Joined: 26.08.2007, 22:10

Post by trupka »

stiff wrote:undeclared identifier 'tiReadCommitted'
Put ZDbcIntfs into uses clause
stiff
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 04.06.2009, 00:20

Post by stiff »

:(
O.K. for tiReadCommitted;

but 'Open' crashed

I used fdb.Connected = true; instead and received 'requested database driver not found.' I am assuming that 'firebirdd-2.0' isn't found? Wouldn't that be in the embedded fbclientd.dll?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

It means the dll can not be found OR some necessary files for running the embedded server are not found.

The fbclientd.dll file isn't the only necessary dll or file.
In one of my test app's I have these fb related files:
  • intl (dir+content)
  • udf (dir+content)
  • aliases.conf
  • fbclientd.dll
  • firebird.conf
  • ib_util.dll
  • icudt30.dll
  • icuin30.dll
  • icuuc30.dll
  • msvcp71.dll
  • msvcr71.dll
  • firebird.msg
Mark
Image
stiff
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 04.06.2009, 00:20

Post by stiff »

All of those files are in directory that is being used, but I still get 'requested driver not found.'
stiff
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 04.06.2009, 00:20

Post by stiff »

I copied fbclientd.dll to Windows\System32 and moved the
fdb.Connected := true; to the end after fdb.Database := ......; and the .fdb file was created. hooray hooray. thanks a lot all.
Post Reply