Connection Problems

Connection Problems

Postby PatrickNY » Wed 12 Dec 2012 13:53

I've been working for some days on Trial version of the Firebird driver but I cannot get the connection to work. I have an application that runs well with the Interbase dbexpress driver included with Delphi XE Pro, which I think is local access only - but it works well. I'm trying to get the app to work with Firebird.

Yesterday, for a while it worked. It said it was connected and it proceeded to application errors about the datatypes retrieved. After that it no longer connects.

The messages I get now are either:
1. Unable to connect to host localhost, Failed to locate host machine, Undefined Service gds_db/tcp.
2. Exception connecting to (requested DB): unavailable database.

I think the problem lies in the vendor libs. I am setting it to FBClient.dll, which is why I think it worked. But I wonder if it's picking up the Interbase gds32.dll now. gds32.dll is in the Windows\system32 directory. FBClient.dll is under the PF\Firebird directory, which I set in Vendorlibrary with the full path (with and without localhost).

For now I will be happy to get my connections working reliably where I can control all settings and locations. But I am trying to create a commercial application where things may be different, so there will still be solutions to be found for that.

Also, the ET drivers in the Pro edition are local drivers only. What does your driver and FB 2.5 support?

I am using Windows 7 Pro, Delphi XE Pro, FB 2.5
PatrickNY
 
Posts: 11
Joined: Sat 01 Dec 2012 13:20

Re: Connection Problems

Postby AndreyZ » Thu 13 Dec 2012 11:47

InterBase and Firebird are not compatible with each other. Therefore, you should use the fbclient.dll library when working with Firebird, and gds32.dll when working with InterBase. Our dbExpress driver for InterBase and Firebird uses the client library that is specified in the TSQLConnection.VendorLib property.

The RAD Studio, Delphi and C++Builder Professional Edition restriction of connecting to local databases concerns only the dbExpress technology. You can find information about it in the license_en.rtf file supplied with RAD Studio. So, if you use the dbExpress technology in Professional Edition, you cannot connect to remote databases. It means that you cannot use our dbExpress driver for InterBase and Firebird to connect to remote databases if you use Professional Edition of RAD Studio, Delphi or C++Builder. It is against the Embarcadero policy.
Our DAC products do not use dbExpress technology, so, if you use any DAC product, this restriction has no effect. That is why we suggest you to use IBDAC that allows working with InterBase and Firebird. You can find more information about IBDAC at http://www.devart.com/ibdac
AndreyZ
 

Re: Connection Problems

Postby PatrickNY » Thu 13 Dec 2012 14:45

I understand the client library dependency. I have been setting the vendorlib as you indicate. I suspect it is not being properly honored, but I'm not sure of that. I don't know what else could be causing the problem. As I develop this I am only working with Firebird, although the application does support Interbase using the Embarcadero driver - and that works.

Currently, I am only working on my own computer - no remote databases. But I am surprised to see the restriction in the Delphi Professional license to which you referred.

I am more familiar with Interbase, and I understand the local connection and server connections. Does your driver support both or does it only support server connections. Can the Firebird connection be made to work with Delphi Pro? If it can not, you should list the Enterprise version of Rad Studio as a prerequisite for your drivers.
PatrickNY
 
Posts: 11
Joined: Sat 01 Dec 2012 13:20

Re: Connection Problems

Postby PatrickNY » Sat 15 Dec 2012 13:39

Let me repeat the question in the last paragraph of the previous post, since there has been no reply:

1.Does your driver support both (local and server connections) or does it only support server connections?
2.Can the Firebird connection be made to work with Delphi Pro?

PatrickNY
PatrickNY
 
Posts: 11
Joined: Sat 01 Dec 2012 13:20

Re: Connection Problems

Postby AndreyZ » Tue 18 Dec 2012 08:50

1. Our dbExpress driver for InterBase and Firebird supports both local and remote connections in all supported RAD Studio, Delphi, and C++Builder editions (Architect, Enterprise, and Professional). But, RAD Studio, Delphi, and C++Builder Professional editions have restriction of connecting to local databases only. You can find information about it in the license_en.rtf file supplied with RAD Studio. So, if you are using the dbExpress technology in Professional Edition, you cannot connect to remote databases. If you do, you will break the Embarcadero license agreement. This restriction applies to all dbExpress drivers, because they use the dbExpress technology. For more information, please consult with Embarcadero developers.

2. Yes, you can use our dbExpress driver for InterBase and Firebird to work with InterBase and Firebird. Here is a code example that demonstrates connecting to a Firebird database:
Code: Select all
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  SQLConnection1.ConnectionName := 'Devart InterBase';
  SQLConnection1.DriverName := 'DevartInterBase';
  SQLConnection1.GetDriverFunc := 'getSQLDriverInterBase';
  SQLConnection1.LibraryName := 'dbexpida40.dll';
  SQLConnection1.VendorLib := 'fbclient.dll';
  SQLConnection1.Params.Values['HostName'] := ''; // local connection
  SQLConnection1.Params.Values['Database'] := 'D:\test.fdb';
  SQLConnection1.Params.Values['User_Name'] := 'sysdba';
  SQLConnection1.Params.Values['Password'] := 'masterkey';
  SQLConnection1.LoginPrompt := False;
  SQLConnection1.Open;
end;
Here is a code example that demonstrates connecting to a InterBase database:
Code: Select all
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  SQLConnection1.ConnectionName := 'Devart InterBase';
  SQLConnection1.DriverName := 'DevartInterBase';
  SQLConnection1.GetDriverFunc := 'getSQLDriverInterBase';
  SQLConnection1.LibraryName := 'dbexpida40.dll';
  SQLConnection1.VendorLib := 'gds32.dll';
  SQLConnection1.Params.Values['HostName'] := ''; // local connection
  SQLConnection1.Params.Values['Database'] := 'D:\test.gdb';
  SQLConnection1.Params.Values['User_Name'] := 'sysdba';
  SQLConnection1.Params.Values['Password'] := 'masterkey';
  SQLConnection1.LoginPrompt := False;
  SQLConnection1.Open;
end;
Note that because of the Delphi Professional Edition restriction described above, you can use our dbExpress driver for InterBase and Firebird in it only for local connections.

As a solution, we can suggest you to use IBDAC. Our DAC products do not use dbExpress technology, so, if you are using any DAC product, this restriction has no effect. You can find more information about IBDAC at http://www.devart.com/ibdac
AndreyZ
 

Re: Connection Problems

Postby PatrickNY » Sat 22 Dec 2012 17:29

Thanks for all the info above. I had almost all of that correct, but it did not resolve the connection problem. I was still getting the "Unsupported on-disk structure ... found 32779 support 15".

I have seen that error in other messages on this forum, without an exact cause. It seems to be using the incorrect SQLDialect. The default seems to be '3' in both the dbxdrivers.ini and dbxconnections.ini. If I change the SQLDialect parameter on my connection component at design time to '1', then everthing works.

But, I'm trying to set this at runtime and it fails. Then I changed the value in the two ini files, and cleared my connection component. At runtime I supply the "Connection Name". That populates that value only in my connection component. I expected it to populate multiple values - which is what the ET DBX docs say. Then I supply the "DriverName", which populates multiple values. However, the value populated for SQLDialect is '3', which I have no idea where that comes from as I have changed both ini files to say '1'.
My runtime code continues and sets the SQLDialect parameter to '1', reflected in my Watch List. Then I set Connected to True and get the error.

So it works if I set my connection component at design time, but I can not get it to work by changing the SQLDialect at runtime. This would be necessary to handle both Firebird and InterBase with the same connection component and your driver.

I am setting other values, such as the database, user, and password at runtime and they work fine. The Watch List shows the SQLDialect as changed, but it fails if it is not set at design time. It feels like the SQLDialect may be hard-coded to '3' in your driver, causing that value to display when the Drivername is set, and that value to be used when attempting to connect.

I am using Delphi XE Pro. I had the same problem with my own test Firebird database and also the Firebird Example Employee database. I am using the recently downloaded Firebird version.
PatrickNY
 
Posts: 11
Joined: Sat 01 Dec 2012 13:20

Re: Connection Problems

Postby AndreyZ » Mon 24 Dec 2012 10:14

You can find the detailed information about the 'Unsupported on-disk structure ...' error at http://www.firebirdfaq.org/faq80/ . Most likely you encounter this error because you are using a incorrect client library. It is always better to use a client library that comes with the server, InterBase or Firebird. For example, if you are using Firebird 2.5.2.26539, you should use fbclient.dll with the same version. Please check that you are using a correct client library. You should set the TSQLConnection.VendorLib property to this correct client library.
AndreyZ
 

Re: Connection Problems

Postby PatrickNY » Mon 24 Dec 2012 14:21

Thanks. But Firebird has never been on this machine until this month when I downloaded ver 2.5.2. There is only 1 FBClient.dll. I did not select to install the Firebird GDS32 client. However, Interbase is installed on this machine and there are interbase databases.

It does run properly if I set the Connection component at design time. It takes some parameters I set at runtime, like the database. It is either not taking all parameters, or I am missing something. I will have to look further. I need to be able to set the entire connection at runtime.
PatrickNY
 
Posts: 11
Joined: Sat 01 Dec 2012 13:20

Re: Connection Problems

Postby AndreyZ » Mon 24 Dec 2012 15:13

In this case, it means that you are trying to connect to an InterBase database using the Firebird client library (fbclient.dll). This is descirbed in the first paragraph at http://www.firebirdfaq.org/faq80/
AndreyZ
 


Return to dbExpress driver for InterBase & Firebird