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

    • leomoon
      By leomoon
      Hello,
      I'm having trouble getting information from Win32_Processor:
      https://docs.microsoft.com/en-us/windows/desktop/CIMWin32Prov/win32-processor
      How does this WMI Query work? Let's say I need to query VMMonitorModeExtensions, Level, ProcessorId, and ProcessorType.
      How would this work?
      Thanks.
    • RamDemon
      By RamDemon
      Hi,
      Did anyone tried to  use Redis  with AutoIT as store DB ?
       Redis <-- more about it
      Mladen
    • Wingens
      By Wingens
      I want to create a program/script wich uses a database to store it's data.
      Now I am puzzeled by wich database server/type I should use.
       
      Can you guys help me?
       
      The program/script I want to create is used for multiple computers, where the insert data en read/modify it afterwords.
      There is going to be adding files to a share and the links as data in de database.
    • TheSaint
      By TheSaint
      Here is a simple program that some of you might appreciate.
      It is a more full fleshed out version of something I worked on a while back as a proof of concept.
      I will just quote the information found in the Program Information dialog.

      Older Screenshot
      INItoSQL DB.zip
      INItoSQL DB v1.1.zip  (see Post #3 for update details)
      INItoSQL DB v1.4.zip  (see Post #4 for update details)
      INItoSQL DB v1.6.zip  (see Post #7 for update details) BIG THANKS to ResNullius for huge speed improvement etc.
      Program requires the sqlite3.dll, not included, but easily enough obtained.
      I have also included the beginnings of a new UDF (SimpleSQL_UDF) I am working, which you can use with the included 'Check conversion.au3' file to check a resulting conversion ... just modify the values for a few variables to suit your situation.
      I've not yet gotten around to coding a testing/checking results script, so I recommend the following open source program, which I have been using for some time. It was here, but is now here at GitHub - DB Browser for SQLite
    • Blois
      By Blois
      Hi Guys,
      Fine?
      I have this code and I use it to perform the query, however when I change the query to INSERT it is not working return error.
       
      #include <GUIConstants.au3> #include <MsgBoxConstants.au3> #include <Array.au3> Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Example() Func Example()     Local $dbname = FileOpenDialog("Choose Access Database", @ScriptDir, "Access files (*.accdb)", 1)     If @error then Return SetError(@error, @extended, 0)     $adoCon = ObjCreate("ADODB.Connection")     $adoCon.Open("Driver={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=" & $dbname & ";Uid=;Pwd=;")     $adoRs = ObjCreate("ADODB.Recordset")     GUICreate("listview items", 550, 250, 100, 200, -1, $WS_EX_ACCEPTFILES)     Local $idListview = GUICtrlCreateListView("Codigo    |Nome         |Valor  ", 10, 10, 520, 150) ;,$LVS_SORTDESCENDING     $queryInsert = INSERT INTO TABLENAME VALUES (''aaaaa'', ''bbbbbb'', ''cccccc'')     Local $aResult     With $adoRs         .CursorType = 2         .LockType = 3         .Open($queryInsert, $adoCon)         If @error Then             ; deal with Probable SQL error             Return SetError(1)         EndIf         If Not .EOF Then $aResult = .GetRows()         .Close()     EndWith     $adoRs = 0     _ArrayDisplay($aResult, 'UBound($aResult)=' & UBound($aResult))     For $iRow_idx = 0 To UBound($aResult) - 1         GUICtrlCreateListViewItem($aResult[$iRow_idx][0], $idListview)     Next     $adoCon.Close     GUISetState()     ; Loop until the user exits.     While 1         Switch GUIGetMsg()             Case $GUI_EVENT_CLOSE                 ExitLoop ;~             Case $idButton ;~                 MsgBox($MB_SYSTEMMODAL, "listview item", GUICtrlRead(GUICtrlRead($idListview)), 2)             Case $idListview                 MsgBox($MB_SYSTEMMODAL, "listview", "clicked=" & GUICtrlGetState($idListview), 2)         EndSwitch     WEnd EndFunc   ;==>Example ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError)     ; Do anything here.     ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _             @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _             @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _             @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _             @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _             @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _             @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _             @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _             @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _             @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc   ;==>_ErrFunc Help, Please!
       
×