-1

I have a WindowsXPSP3 op system, on it a DelphiXE and InterbaseXE installed. I created a database in IB and it works OK through the IBConsole and ISQL and connection testing also works through TCP/IP localhost:3050. Now I try to access it from Delphi.

I did:

var AC:tADOConnection;
...
AC:=tADOConnection(Self);
AC.ConnectionString:=
AC.Open;

I tried all possible version I could google for the ConnectionString, but all generated an error. I used various Provider= versions, etc., but none works. Could someone provide me with a simple working ConnectionString? Do I need to install any ADO driver or similar additionally? Thanks, Zsolt

  • Did you try these? http://www.connectionstrings.com/interbase/ – Graymatter Feb 22 '14 at 07:52
  • 1
    Why are you using ADO components, when there are dedicated Interbase components (from the `IBQuery` unit)? – Ken White Feb 22 '14 at 07:52
  • You have to install the ODBC/OleDB driver first. The rest is simple. I would recommend using a different connection method though, e.g. DAC, IB or so. – alzaimar Feb 22 '14 at 07:53
  • "I tried all possible versions" without any says nothing, and "generated an error" without the error is meaningless. Your use of the connection is invalid (`AC.ConnectionString:=` is incomplete and won't compile). If you won't make the effort to clearly explain your problem and ask a question, we probably won't make the effort either. – Ken White Feb 22 '14 at 08:33
  • @Graymatter: Yes, I tried those. – user3340032 Feb 23 '14 at 11:58
  • @Ken: For the time being I use Interbase, but I want to make it DB independent. This is why I did not use IBQuery. – user3340032 Feb 23 '14 at 12:18
  • @alzaimar: Thanks, Now I tried to find an IB driver, but found Firebird only. I will play around with it and let you know. – user3340032 Feb 23 '14 at 12:19
  • @Ken: I had the code compilable. I tried countless different connection strings, combining Providers like SQLOLEDB, SQLOLEDB.1,SIBProvider, etc. Tried Data Source specified through full path to the DB or using the alias. Tried localhost and through real IP address, etc. Errors were like Provider no found, or 'Multiple.step OLE DB operation generated errors', etc. I spent many hours and did not record all errors. – user3340032 Feb 23 '14 at 12:19
  • @alzaimar: Now I got the farest so-far with 'Driver={Data Direct ODBC for InterBase};DSN={test};DBName={C:\TEST.IB};UID={SYSDBA};PWD={masterkey}'. The error is "[DataDirect][ODBC Interbase driver]Insufficient information to the data source.". What is missing? – user3340032 Feb 23 '14 at 12:54
  • 1
    Why don't you just let the connection string editor create the string for you? – alzaimar Feb 23 '14 at 15:45
  • @alzaimar: Where is the connection string editor? I do not find it. – user3340032 Feb 23 '14 at 18:49
  • Click on the button next to the connection string in the object inspector. Or create an empty file with the ending `UDL` and double click on it. After you create your connection string, you can copy&paste the result from with file. – alzaimar Feb 23 '14 at 20:49
  • @alzaimar: Thanks. I did not know this trick. It worked and made connection string: "DRIVER={Data Direct ODBC for InterBase};UID=A;DB=test;FILEDSN=C:\Program Files\Common Files\ODBC\Data Sources\TEST.IB.dsn;PWD=A" – user3340032 Feb 24 '14 at 05:42
  • @alzaimar: It seems your answer was a comment not an answer so I cannot vote for it. Is there a way to vote and close the question based on comments? – user3340032 Feb 24 '14 at 05:44
  • @user3340032: Please check my separate answer below – alzaimar Feb 24 '14 at 07:08

1 Answers1

1

There are two ways to easily create a valid connection string

a.1) Click on the small button in the object inspector right of the connection string property.
a.2) Create your connection, test it, press OK

or

b.1) Create an empty file e.g. 'TEST.UDL'. Use Notepad.EXE for example.
b.2) Double click on the file in the explorer. This will open the connection string editor
b.3) Create your connection, test it. Press OK
b.4) Your file now contains the connection string which you may copy&past in your application

Another benefit of the second method is that you can even use the file as a connection string. This makes life alot easier if you have to configure your connection from time to time (Just double click on the UDL if you have to change the connection properties). Here's how a valid connection string for a file looks like:

FILE NAME=<Full path to your UDL file>
alzaimar
  • 4,362
  • 1
  • 13
  • 28