Archive: Firebird connection


Firebird connection
In my custom page user input connection params (ect connection strig, database pats, login, password)
How can i check it?


You can use an external utility like osql to connect to the database with the supplied parameters.


thx. But how can i use it ?


Execute it using the parameters given by the user. If it doesn't return an error, you've made a valid connection and the connection parameters are correct.


thx tvice, but i dont understend how can i use it from my installer :(
(sorry for stupid question)


You can execute it using ExecWait or the nsExec plug-in. Both provide the result. ExecWait in the third parameter and nsExec on the stack.


thx It is work. But it is new problem, i should use only freeware/open sorce and other not commercial soft, but this util from Microsoft, and i think that it's not free :(


iodbc is licensed under GPL.


There are also a plug-in for this task.

http://nsis.sourceforge.net/NsODBC_plug-in


AstraS,
Your original question was regarding setting up a Firebird database from NSIS. As Kichik pointed out, you can use a command line utility to do so.

If you look at the Firebird documentation, you will find a tool called gsec, which looks like it should give you what you need. (I have not actually worked with Firebird databases before, but from the description, it seems like it would work.)

From Firebird's website:

Firebird comes with a command-line user management tool called gsec. Although its functions can also be performed by a number of third-party GUI utilities, you should at least have a basic knowledge of gsec, since this is the official tool and it's present in every Firebird server installation.

thx all.
but all of this is not what i want.
i'll try to write it again.
in my installer there are firebird database.
before installation complete, user input login pass and path(to .fdb) file, and installer should check it. If pass login and path is correct the installation complete sucsesfully and if not correct installer somthing to do.
sorry for english


PS and there are two important things
1. it is should work with Firebird
2. and be freeware or GNU or.....


How is this not what you want? It gives you access to the Firebird database so you can try and connect to it using the details provided by the user. If the connection fails, the credentials are wrong. Aside from osql, which is Microsoft's, everything else mentioned is completely free and Comperio's suggestion is even a part of Firebird itself.


thx kichik
but my script not work :( and i don't know why.
i check it and all of this methods work whithout my script


If the methods work outside of the script, then it's probably in the way that you are calling them within your install.

Maybe if you attach a minimal example illustrating the problem, then someone could help get you pointed in the right direction.


this is my test example

;--------------------------------
;Include Modern UI

!include "MUI.nsh"

XPStyle on
;Name and file
Name "B2 server"
OutFile "Setup.exe"

;Default installation folder
InstallDir "$PROGRAMFILES\B\B2"


!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_INSTFILES

Function CheckDB
ExecWait '"$INSTDIR\gsec.exe" -user sysdba -pass masterkey -database c:\P\B2.fdb' $0
DetailPrint "some program returned $0"
FunctionEnd

;--------------------------------
Section "Main" SecMain

SetOutPath "$INSTDIR"
File "gsec.exe"
call CheckDB
Delete $INSTDIR\gsec.exe
RMDir $INSTDIR
SectionEnd


help me please!


Your script seems like it should work. But, are you sure you got your command correct? From the gsec documentation, you are only specifying a few options, but no real command. (in other words, you haven't told it to actually do anything). (By the way, what are you trying to accomplish anyway?)

Does the same command run from a RUN box on the target computer? (You may want to also try it from a command prompt just to see what type of message you may be getting back.)

It might be helpful to read through the Firebird documentation. There's some good info there that may help.

Again, I've never actually used a Firebird database before so this is probably all I can offer you. From what I can tell so far, it looks like you just need to figure out the proper tools. Maybe someone else can give you something more...