Page 1 of 1

D7 Firebird ZeosLib connection

Posted: 05.06.2009, 04:26
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? :?:

Posted: 05.06.2009, 06:51
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.

D7 Firebird ZeosLib connection

Posted: 05.06.2009, 13:06
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.

Posted: 05.06.2009, 13:11
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;

Posted: 05.06.2009, 20:10
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.

Posted: 05.06.2009, 21:12
by seawolf
firebirdd -> firebird embedded
firebird -> firebird SS

Posted: 23.06.2009, 19:49
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]

Posted: 23.06.2009, 21:31
by trupka
stiff wrote:undeclared identifier 'tiReadCommitted'
Put ZDbcIntfs into uses clause

Posted: 23.06.2009, 21:53
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?

Posted: 23.06.2009, 22:38
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

Posted: 23.06.2009, 22:51
by stiff
All of those files are in directory that is being used, but I still get 'requested driver not found.'

Posted: 24.06.2009, 03:30
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.