ansh batra has asked for the wisdom of the Perl Monks concerning the following question:

use DBI; my $dbh = DBI->connect("dbi:Pg:dbname='testing'", "postgres", "secret" +, {AutoCommit => 0, RaiseError=>1,pg_enable_utf8=>1})or die "could no +t connect to db\n"; $ret=$dbh->do("create table test (name varchar)")or die "could not exe +cute\n"; $dbh->disconnect; print "$ret\n";

output
0E0
can anyone please tell me that why it is not creating the table?

Replies are listed 'Best First'.
Re: DBI issue with create table
by Corion (Patriarch) on Dec 02, 2011 at 09:38 UTC
    You have AutoCommit set to 0. Are you sure that you don't need a call to commit() to tell the database to actually commit your changes?
      corion thanks for that
      its working now
      can you please tell me the use of AutoCommit?
Re: DBI issue with create table
by Anonymous Monk on Dec 02, 2011 at 08:36 UTC

    can anyone please tell me that why it is not creating the table?

    The output, 0E0 (zero but true), says that it did create the table

      this is my problem
      it is not showing any error
      i have tried it with try catch block also and execution doesnt enter catch block
      have you tried this script on your machine?