[unixODBC-dev] [DSN] create database

Carlo Cancellieri ccancellieri at hotmail.com
Thu Jul 29 03:41:53 BST 2010


Hi to all,
I'm coding a script to run some tests on my application and I'd like to create a new database but seams that I can't use isql to run a query without set a DSN. that's ok but why I've to set a database too?
-------------------------------odbc.ini
[PostgreSQL]
Description         = Test to Postgres
Driver              = /opt/unixodbc/lib/libodbcpsql.so
Trace               = Yes
TraceFile           = sql.log
######################
#Database            = SQLH  <--------PROBLEM
######################
Servername          = localhost
UserName            = postgres
Password            = postgres
Port                = 5432
Protocol            = 6.4
ReadOnly            = No
RowVersioning       = No
ShowSystemTables    = No
ShowOidColumn       = No
FakeOidIndex        = No
ConnSettings        =
-----------------------------------------

I want to create that database so how I can do this?
I've already tried to use a DSN without set the Database but this is what I get:
/opt/unixodbc/bin/isql  -c -v PostgreSQL
[28000][unixODBC]FATAL:  database "SQLH" does not exist
[ISQL]ERROR: Could not SQLConnect

So the only way I found is :
1 define a DSN connecting to the default postgres database,
2 run the query CREATE DATABASE... 
3 exit 
4 configure a new DSN with the new database
5 connect on the new database
6 use it

Is there a way to create the database before completely define a DSN?
If no, is there a way to query the DBMS to get a list of available database to configure (I know the postgres one but what about mysql? oracle? etc.)
any help is appreciated, thank you,
carlo cancellieri
 		 	   		  
_________________________________________________________________
Il tuo mondo MSN a portata di clic. Scarica IE8 per MSN
http://events.it.msn.com/internet-explorer-8


More information about the unixODBC-dev mailing list