X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C6248D1E92C for ; Sun, 29 Feb 2004 10:50:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 58919-08 for ; Sun, 29 Feb 2004 06:50:06 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 7CAE8D1E927 for ; Sun, 29 Feb 2004 06:50:04 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i1TAo31Y074920 for ; Sun, 29 Feb 2004 10:50:03 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i1TAR8t3073022 for pgsql-odbc@postgresql.org; Sun, 29 Feb 2004 10:27:08 GMT From: glaeser@cs.tu-berlin.de (Arne Gl?ser) X-Newsgroups: comp.databases.postgresql.interfaces.odbc Subject: Re: Creating a database via ODBC Date: 29 Feb 2004 02:27:04 -0800 Organization: http://groups.google.com Lines: 47 Message-ID: <9b2c2076.0402290227.9aea7a9@posting.google.com> References: <9b2c2076.0402270606.1a108dad@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-abuse@google.com To: pgsql-odbc@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/48 X-Sequence-Number: 3801 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