Marco
Marco

Reputation: 171

Cannot create database with odbc connection

Im connected to the sysmaster database with odbc. Now i want to execute an "create database" statement, but im getting an general error while SQLExecDirect.

sqlret = SQLExecDirect( stmt, (SQLCHAR*)"CREATE DATABASE testing", SQL_NTS );

this fails (sqlret is -1) and SQLGetDiagRec gives the following: HY00 -11060 [Informix][Informix ODBC Driver]General error.

I have even tried to use SQLPrepare and SQLExecute and then the SQLPrepare is showing this error. Is it not possible to create a new Database with odbc? In an JDBC program this works.

Upvotes: 2

Views: 346

Answers (1)

jsagrera
jsagrera

Reputation: 1998

You can use 'CREATE DATABASE' from within ODBC but only if there is no implicit connection to an existing database.

Try adding 'CONNECTDATABASE=NO' to your connection string.

Upvotes: 2

Related Questions