How to connect to a firebird database

Just starting out? Need help? Post your questions and find answers here.
tseyfarth
User
User
Posts: 77
Joined: Sun Dec 05, 2010 8:05 pm

How to connect to a firebird database

Post by tseyfarth »

Hello all,

My first time using ODBC, connection strings etc. I was able to get connected and work with a PostgreSQL database just fine, but cannot seem to get even a connection to a Firebird database. The ODBC drivers are installed, the Firebird tools connect etc, but after spending several hours trying within PB, cannot seem to do it. Can anyone help with some sample code?

This is what I have tried, nothing worked :(

Code: Select all

If DB = 1 ;FB
    
    DbID = UseODBCDatabase()
    river="Firebird/InterBase(r) driver,Uid=SYSDBA,Pwd=masterkey,Dbname=C:\AxcysV10\Firebird\Data\axcys.fdb"
    
    
    
    ;Driver=Firebird/InterBase(r) driver;Uid=SYSDBA;Pwd=masterkey; Dbname=C:\AxcysV10\Firebird\Data\axcys.fdb
    ;Driver="{Firebird/InterBase(r) driver};Uid=SYSDBA;Pwd=masterkey; Dbname=C:\AxcysV10\Firebird\Data\axcys.fdb"
    
    ;Result = OpenDatabase(#Database, DatabaseName$, User$, Password$ [, Plugin]) 

    
   
   ; DbID=OpenDatabase(#PB_Database_ODBC, "Driver=Firebird/InterBase(r) driver,Dbname=C:\AxcysV10\Firebird\Data\AXCYS.FDB,CHARSET=NONE","SYSDBA","masterkey")
    ;DbID = OpenDatabase(1,"host=localhost port=3050 dbname=C:\AxcysV10\Firebird\Data\axcys.fdb","SYSDBA","masterkey",#PB_Database_ODBC)
   ; DbID = OpenDatabase(1,"host=localhost port=3050 dbname=C:\AxcysV10\Firebird\Data\axcys.fdb","SYSDBA","masterkey",#PB_Database_ODBC)
    DbID = OpenDatabase(#PB_Any,"host=localhost port=3050 dbname=C:\AxcysV10\Firebird\Data\axcys.fdb","SYSDBA","masterkey",#PB_Database_ODBC)
     
  EndIf


Errors = DatabaseError()
On each attempt the microsoft ODBC object errors. I think part of my problem is plain confusion on how to handle the connection string. The one I found on the net, as a result of a previous post, has semi colons in it so obviously it cannot be used, "as is" from within PB since PB interprets the semis as remarks, this is why I added quotes to the line. But even with that, I am just blind to where and how to use this string.

Code: Select all

Driver="Firebird/InterBase(r) driver,Uid=SYSDBA,Pwd=masterkey,Dbname=C:\AxcysV10\Firebird\Data\axcys.fdb"
The docs and sample does not help me either, particularly since the parameters do not appear to be the same.

If anyone can provide some sample code, I would be very grateful!

Thank you!
Tim
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: How to connect to a firebird database

Post by IdeasVacuum »

has semi colons in it so obviously it cannot be used
Well, let's see that string - if that is what the db requires, then that is what you have to work with.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1282
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Re: How to connect to a firebird database

Post by Paul »

PureBasic's OpenDatabase command assumes the ODBC source has already been set up.
You either need to set up manually through Admin Tools/Data Sources or through code which is where your special connection string comes in.
You need to use API for that so do a search on the forum for "SQLConfigDataSource"
There has been plenty of procedures posted which show how to connect to Access, MySQL, Oracle, etc. using "SQLConfigDataSource"
Image Image
tseyfarth
User
User
Posts: 77
Joined: Sun Dec 05, 2010 8:05 pm

Re: How to connect to a firebird database

Post by tseyfarth »

Thank you for your responses.
Will search and work with your suggestions!

Tim
Post Reply