pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: glaeser@cs.tu-berlin.de
To: pgsql-odbc@postgresql.org
Subject: Re: Creating a database via ODBC
Date: 29 Feb 2004 02:27:04 -0800
Message-ID: <9b2c2076.0402290227.9aea7a9@posting.google.com> (raw)
References: <9b2c2076.0402270606.1a108dad@posting.google.com>

glaeser@cs.tu-berlin.de (Arne Gl?ser) wrote in message news:<9b2c2076.0402270606.1a108dad@posting.google.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



view thread (3+ messages)  latest in thread

Message-ID: <9b2c2076.0402290227.9aea7a9@posting.google.com>
Permalink:  ../9b2c2076.0402290227.9aea7a9@posting.google.com/
Also on:    postgresql.org/message-id/9b2c2076.0402290227.9aea7a9@posting.google.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: glaeser@cs.tu-berlin.de
  Subject: Re: Creating a database via ODBC
  In-Reply-To: <9b2c2076.0402290227.9aea7a9@posting.google.com>
  References: <9b2c2076.0402270606.1a108dad@posting.google.com> <9b2c2076.0402290227.9aea7a9@posting.google.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox