- NSIS Discussion
- Create database with NSIS
Archive: Create database with NSIS
Russell81
23rd March 2009 07:49 UTC
Create database with NSIS
Hello there,
I am trying to create a database with NSIS. I have SQLmetadata.txt file and i want to create a database from this metadata. I would like to use iboConsole database motor to run my database. So is it possible to create a database from metadata with NSIS? Please help.
ginglese
23rd March 2009 09:28 UTC
Hi,
I never used iboConsole but i use PostgreSql and i think it may be same behavior.
Install the database motor then use command batch to create database and then load the SQLmetadata.txt file into it.
it's how i proceed.
Guillaume
Russell81
26th March 2009 09:45 UTC
Hi, Anybody has any idea how can i create database with NSIS by using Firebird isql.exe?
ionut_y
26th March 2009 10:24 UTC
Firebird database is a single .fdb/.gdb file so you can create it and pack with NSIS or you can create it by your application on first run.
Russell81
26th March 2009 10:25 UTC
Is it possible to create database by NSIS installer? Please help.
ionut_y
26th March 2009 10:27 UTC
please see my previous post
jpderuiter
27th March 2009 00:15 UTC
You can use the plugin ExecDos for this:
ExecDos::exec "[firebird_dir]\bin\isql.exe" "create database C:\test.gdb;\nexit;\n"
The second parameter sends the several commands to the isql tool as if you where typing it in the console app (\n stands for a carriage return or Enter)
Regards,
JP
Russell81
27th March 2009 09:21 UTC
I use this:
ExecWait '"C:\Program Files\Firebird\Firebird_2_1\bin\isql.exe" "CREATE DATABASE c:\database.FDB; user SYSDBA password agripomo page_size 16384 default character set ISO8859_1;\nexit;\n"'
Can you help me find the problem this. because when I run this i get error like "Statement failed, SQLCODE = -902
Unable to complete network request to host "CREATE DATABASE c".
-Failed to locate host machine.
-The specified name was not found in the hosts file or Domain Name Services.
Use CONNECT or CREATE DATABASE to specify a database
SQL>
can you help please.
I tried your code aslo i get the same error.
I tried to run with ExecDos::exec and it i can't compile NSIS and gives error "invalid command"
jpderuiter
27th March 2009 09:25 UTC
Try a double slash in the filename ,e.g. c:\\database.FDB
Russell81
27th March 2009 09:35 UTC
I tried but no luck.
Does NSIS understand SQL commands?
jpderuiter
27th March 2009 09:41 UTC
NSIS doesn't have to understand SQL commands, it passes the commands as strings to the isql tool.
It seems like the commandstring is truncated at the semicolon, I'm not sure why.
What happens when you use "CREATE DATABASE database.FDB;"?
Russell81
27th March 2009 09:55 UTC
i get same error and command prompt just bling and disappear. doesn't make database.It looks like i am so stuck.
Russell81
27th March 2009 14:31 UTC
can anyone help me about avobe mentioned problem.
jpderuiter
27th March 2009 18:53 UTC
OK, I checked, and this should work:
ExecDos::exec "C:\Program Files\Firebird\Firebird_2_1\bin\isql.exe" "CREATE DATABASE 'c:\database.FDB';$\nuser SYSDBA password agripomo page_size 16384 default character set ISO8859_1;$\nexit;$\n"
- Don't place single quotes before and after the complete ExecDos Command
- You forgot the \n between the CREATE DATABASE and user SYSDBA commands
- Use $\n instead of \n
- Place single quotes before and after the database filename
Russell81
30th March 2009 12:47 UTC
Thanks very much i proceed with my scripts by your great help. Thanks again.
Russell81
31st March 2009 08:44 UTC
ExecDos::exec "$folder\bin\isql.exe" "CONNECT '127.0.0.1:$desfolder\database.fdb' user '$login' password '$password' && INPUT '$source';$\nexit;$\n"
Do you think this is the right way to input metadata to to database. Please help.
jpderuiter
31st March 2009 18:28 UTC
To input metadata data you can use the commandline directly:
ExecDos::exec "$folder\bin\isql.exe -i '$source' '127.0.0.1:$desfolder\database.fdb' -user '$login' -pass '$password'"
Russell81
1st April 2009 07:50 UTC
It worked so perfact. thanks.
I have one SQL file which i should input also in the database. But i learn that from u. Now the question is that is it possible to put variable to that SQL file before i input that file to the database? For ex. in the SQL file there is "ContractorID" where i should put a number. So the idea is that when i create a database for new Contractor i need to put the contractorID in the SQL file and input to the data base. So my idea is that "if possible" i want that NSIS script will ask the CntractorID and send it to SQL file and input that file to the database. I am sorry that asking too many question. thanks for prevous help.
Russell81
1st April 2009 07:52 UTC
It worked so perfact. thanks.
I have one SQL file which i should input also in the database. But i learn that from u. Now the question is that is it possible to put variable to that SQL file before i input that file to the database? For ex. in the SQL file there is "ContractorID" where i should put a number. So the idea is that when i create a database for new Contractor i need to put the contractorID in the SQL file and input to the data base. So my idea is that "if possible" i want that NSIS script will ask the CntractorID and send it to SQL file and input that file to the database. I am sorry that asking too many question. thanks for previous help.
jpderuiter
1st April 2009 17:28 UTC
Hi Rusell,
you can use the TextReplace plugin for that:
http://nsis.sourceforge.net/TextReplace_plugin
Regards,
JP
Russell81
2nd April 2009 06:54 UTC
Hello,
thanks for help.
Russell81
2nd April 2009 07:29 UTC
it looks like that if the "source" or "destination" folder is for example: 'C:\program files\folder\database.fdb' isql doesn't except space between 'program and file'. I think you know how to overcome this problem. please help. thanks.
jpderuiter
2nd April 2009 18:36 UTC
try:
ExecDos::exec "$folder\bin\isql.exe -i $\"$source$\" $\"127.0.0.1:$desfolder\database.fdb$\" -user '$login' -pass '$password'"
($\" results in a " for isq.exe)
Russell81
3rd April 2009 06:22 UTC
thanks very much.
hai12345
20th July 2010 13:27 UTC
changing the password
hi,
I have one database in my application path, whether can i change password for that using NSIS script. I know the previous password of the database.
help me.
jpderuiter
20th July 2010 13:32 UTC
This is not a NSIS question, but a firebird question.
See the Quickstart manual, chapter "Server configuration and management"