Jump to content
Sign in to follow this  
nevodj

Query FIREBIRD 2.0 Database

Recommended Posts

nevodj

Hello,

I can't find anything helpful in the forums about querying a Firebird database.

Does anyone know if this can be done and how?

Thanks

Share this post


Link to post
Share on other sites
Luigi

Hi nevodj, see

#include <FireBird.au3>
Local $wer
Global $h_fbDll = DllOpen("C:\bird\bin" & "\fbdll4vb20.dll")
Global $servername="192.168.0.5"
Global $sDBName="C:\Program Files\Firebird\Firebird_1_5\bin\Zimkps.gdb"
Local $sUsername = "sysdba"
Local $sPassword = "masterkey"
;_FireBird_Help($h_fbDll)
_FireBird_ConnectDatabase($h_fbDll, $servername, $sDBName, $sUsername, $sPassword)
;_FireBird_About($h_fbDll)
;_FireBird_Help($h_fbDll)
ConsoleWrite( _FireBird_ExecuteStatement($h_fbDll,"select * from tubaina"))
exit

Visit my repository

Share this post


Link to post
Share on other sites
nevodj

Thanks detefon

I dont really understand dll calls or firebird.. i'm an SQL fan and have never touched one of our systems which is running on firebird... i have the firebird database on a windows server, does this script require firebird to be installed on the client machine before the script will connect?

the filepaths to the dll and the .gdb, are they were the files are located on the server or the client?

Global $h_fbDll = DllOpen("C:\bird\bin" & "\fbdll4vb20.dll")

Global $servername="192.168.0.5"

Global $sDBName="C:\Program Files\Firebird\Firebird_1_5\bin\Zimkps.gdb"

thanks for your help

Share this post


Link to post
Share on other sites
Luigi

Hi nevodj, now with more information! 8D

Good luck!

#include <FireBird.au3>
Global $h_fbDll = DllOpen("C:\bird\bin\fbdll4vb20.dll")   ; path from 'fbdll4vb20.dll' in client side.
Global $servername = "192.168.0.5"      ; Firebird IP server
 
Global $sDBName="C:\Program Files\Firebird\Firebird_1_5\bin\Zimkps.gdb"
; The line above is the path from 'Zimkps.gdb' in the server
; You must write a script client with a path server from .gdb file
Local $sUsername = "sysdba"
Local $sPassword = "masterkey"
_FireBird_ConnectDatabase($h_fbDll, $servername, $sDBName, $sUsername, $sPassword)
ConsoleWrite( _FireBird_ExecuteStatement($h_fbDll, "select * from tubaina"))
Edited by detefon

Visit my repository

Share this post


Link to post
Share on other sites
nevodj

thanks champ, couple of things i still dont understand:

1.

Global $h_fbDll = DllOpen("C:\bird\bin\fbdll4vb20.dll") ; path from 'fbdll4vb20.dll' in client side.

does this mean firebird has to be installed on the client?

2.

; You must write a script client with a path server from .gdb file

... could you explain here?

thanks!

Share this post


Link to post
Share on other sites
Luigi

[Client side]

Global $h_fbDll = DllOpen("C:\bird\bin\fbdll4vb20.dll") ; path from 'fbdll4vb20.dll' in client side.

The AutoIt do not have parts to connnect in firebird, you must have download this dll (fbdll4vb20.dll) and put in someplace, maybe in the same folder like your client's script or another folder... This is only the path's dll.

I make the test with script a long time ago... I cant' remenber now if is necessary install firebird client or only download fbdll4vb20.dll and use that.

I know a little of MySQL, and it need only to connect: IP, username, password... Nothing more.

[server side]

Firebird needed: IP, username, password and the path's DB (or $sDBName).

This path is a place's from .gdb file in the server machine.

After you install a firebird module server in your 'server' and create your database's firebird, you must find the folder's .gdb file.

Something like this...

Global $sDBName="C:\Program Files\Firebird\Firebird_1_5\bin\Zimkps.gdb"

Good Luck (II)!

Edited by detefon

Visit my repository

Share this post


Link to post
Share on other sites
nevodj

ok i've got this far. when i run it i get this message -

IBPP::Exception inside GDS::Call()***

IBPP Message : Can't find/load FBCLIENT.DLL nor GDS32.DLL

Share this post


Link to post
Share on other sites
faustf

hi guy i try to connect whit dll at the db fire bird but autoit tell me

C:\Program Files (x86)\AutoIt3\Include\FireBird.au3 (195) : ==> Subscript used with non-Array variable.:

Return SetError($vRet[0] <> 0, 0, $vRet[0])

Return SetError($vRet^ ERROR

why ?? ;)(((

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • dangr82
      By dangr82
       
      I have created this function for a database, but I can not make it work. I always have two error messages: "not an error" ... and the file created, in the script directory, does not contain anything.
      Global $sDBName = "Hen.db" Func DatabaseTable() Local $sConnDB _SQLite_Startup() If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite.dll Can't be Loaded!") Exit -1 EndIf $sConnDB = _SQLite_Open($sDBName) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!") Exit -1 EndIf If Not _SQLite_Exec($sDBName, 'CREATE TABLE Animal ("Name", "Age");') = $SQLITE_OK Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) If Not _SQLite_Exec($sDBName, 'INSERT INTO Animale VALUES ("Charlie","5");') = $SQLITE_OK Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) _SQLite_Close($sConnDB) _SQLite_Shutdown() EndFunc  
    • hugomito
      By hugomito
      Hi all,
      I hope you can help me with this. I need to connect to a Database using Cloudera ODBC Driver for Impala. I installed the driver, created a User DSN (drona2) and tested it successfully (got the message: Successfully connected to data source!) but when I try to connect to the database using a Conneciton String, it simply didn't work.
      I tried connecting to the database using the User DSN, I previously created, that has all parameters needed but got the following error:
           $ProviderDatasource = 'DSN=drona2;'
           $conn_Database = ObjCreate ("ADODB.Connection")
           $conn_Database.ConnectionString = $ProviderDatasource
           $conn_Database.Open
           ==> The requested action with this object has failed.:
           $conn_Database.Open
           $conn_Database.Open^ ERROR
      Also I tried adding all parameters to my connection string as follows but also got the same error:
           $ProviderDatasource = 'Driver=Cloudera ODBC Driver for Impala;Host=MyHost.domain.com;PORT=21050;AuthMech=3;UID=MyUserId@domain.com;PWD=MyPasswordc;Schema=default;SSL=1;AllowSelfSignedCerts=1;AllowHostNameCNMismatch=1;CheckCertRevocation=1;KrbFQDN=_HOTS;KrbServiceName=impala;ServicePrincipalCanonicalization=1'
      I hope someone has used this driver successfully before and can shed some light here.
      If you need additional information, let me know.
      Regards,
    • argumentum
      By argumentum
      ..let's say I store in a mysql column "[1,2,11,12,123]".
      How can I make s query to get all those rows that is 1, or is 12, etc ?
      I'm using  mysqlnd 5.0.11-dev - 20120503 
      Any advise on what technique I should use is welcomed
      Thanks
      PS: ..I'm adding a comma to each end, as in  [,1,2,11,12,123,] and will search with like %,12,% .
      Not pretty but I'm in a hurry and can't come up with a better solution =/
    • nassausky
      By nassausky
      Hey all,
      Has anyone created any queries for youtube? I was thinking it might be something like this but can't quite figure it out:
      $oIE = _IECreateEmbedded() _IENavigate($oIE,"https://www.youtube.com") Local $oForms = _IETagNameGetCollection($oIE, "form") Local $sTxt = "" For $oForm In $oForms If $oForm.id = "masthead-search" Then $oInputs = _IETagNameGetCollection($oIE, "input") For $oInput In $oInputs If $oInput.id = "masthead-search-term" Then _IEFormElementSetValue($oInput, "cards") _IEFormSubmit($oForm) EndIf Next EndIf Next  
    • sc4ry
      By sc4ry
      Dear all,
      I already have a formula which will select doublicates, but sometimes there might be entries with additional information starting after "-", which I now want to trim away.
      Current formula is:
      Select DISTINCT a.title, a.oid, a.size, a.disk from DB a, DB b where (a.title like b.title and a.oid <> b.oid)" & $ActiveDisks_Filter & " AND (a.comment <> 'Delete' AND b.comment <> 'Delete') Order by a.title ASC, a.size DESC; testwise I want to add a simple solution like left, but afterwards I get an error but I do not know why.
      Select DISTINCT a.title, a.oid, a.size, a.disk from DB a, DB b where (left(a.title,15) like b.title and a.oid <> b.oid) Order by a.title ASC, a.size DESC; Error: near "(": syntax error: Finally I would like to insert intstr to search for "-" but currently I am not able to extend my current code =/
      Thanks a lot for your help.
      EDIT: hey, I managed it, left was not working also it was somehow shown that the tool knowed the comment. I did it now with substr+instr
      (substr(a.title, 1, instr(a.title, ' - '))  
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.