David,
The way I got around this was to set the database name a empty string in
the connect call.
my $database = "";
my $dbh = DBI->connect("DBI:Informix:$database", '', '', { ... } );
Then one has a handle to use for $dbh->do( "create database fred" );
(I'm using Perl 5.6, DBI 1.14, DBD-Informix-1.00.PC1 with Informix SE
7.24UC7 on Linux)
--Mark Thornber
> Hollingworth David-dholli01 wrote:
>
> Hi
>
> I am using Perl version 5.00503 on Solaris 8 with the DBI::Informix
> module (Informix V9.2).
>
> I want to be able to create a new database if it doesn't already exist
> so I:
>
> 1. Connect to sysmaster
> 2. Query sysdatabases for my database name
> 3. It's not there so I "create database x with buffered logging"
>
> At which point it bombs with SQL: -759: Cannot use database commands
> in an explicit database connection.
>
> The create doesn't work because I'm already connected to a database;
> but in order to use the database driver I need a database handle and
> to get a database handle I have to connect to a database (D'OH!).
>
> Is there any way to do this??
>
> Thanks in advance
>
> David Hollingworth
>
> Name: JudgesCh.gif
> JudgesCh.gif Type: GIF Image (image/gif)
> Encoding: base64