[unixODBC-dev] [DSN] create database
Nick Gorham
nick at lurcher.org
Thu Jul 29 08:29:22 BST 2010
Carlo Cancellieri wrote:
> 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
>
Hi,
I would say this is a question for the driver writers, its all in their
domain. What happens if you set the DSN to connect to the default
postgres database? Is that not what happens if you use createdb?
--
Nick
More information about the unixODBC-dev
mailing list