Re: Creating a database via ODBC

From: glaeser(at)cs(dot)tu-berlin(dot)de (Arne Gl?ser)
To: pgsql-odbc(at)postgresql(dot)org
Subject: Re: Creating a database via ODBC
Date: 2004-02-29 10:27:04
Message-ID: 9b2c2076.0402290227.9aea7a9@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

glaeser(at)cs(dot)tu-berlin(dot)de (Arne Gl?ser) wrote in message news:<9b2c2076(dot)0402270606(dot)1a108dad(at)posting(dot)google(dot)com>...
> Does anyone know how to create a database(of any type) with ODBC API in C++?

There's no ODBC call that will create a database.

If this is crucial, you can see if your database supports some sort of
"create Database" statement. If so, you can connect to an existing
database, then execute a database-specific call using SQLExecDirect.
But knowing the first database to connect to and the syntax of the
statement is completely up to you. For example, MS SQL has such a
command. From my SQL documentation, I get
Syntax
CREATE DATABASE database_name
[ ON
[ < filespec > [ ,...n ] ]
[ , < filegroup > [ ,...n ] ]
]
[ LOG ON { < filespec > [ ,...n ] } ]
[ COLLATE collation_name ]
[ FOR LOAD | FOR ATTACH ]

< filespec > ::=

[ PRIMARY ]
( [ NAME = logical_file_name , ]
FILENAME = 'os_file_name'
[ , SIZE = size ]
[ , MAXSIZE = { max_size | UNLIMITED } ]
[ , FILEGROWTH = growth_increment ] ) [ ,...n ]

< filegroup > ::=

FILEGROUP filegroup_name < filespec > [ ,...n ]

MS Access does not, nor does Oracle (to my knowledge.)

In PostGresql, the documentation says

CREATE DATABASE name
[ [ WITH ] [ OWNER [=] dbowner ]
[ LOCATION [=] 'dbpath' ]
[ TEMPLATE [=] template ]
[ ENCODING [=] encoding ] ]

Ed Brown

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Arne Gl?ser 2004-02-29 10:33:47 Re: Creating a database via ODBC
Previous Message Arne Gl?ser 2004-02-27 14:06:09 Creating a database via ODBC