PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Charles_Mire at Concentra dot com
Subject: Re: error - object already exists in database
Date: Jun 20 2005 8:34PM

Sorry...got the syntax wrong.  Correction here:

$sth=$dbh->prepare("exec $statement");
$sth->execute;
$sth->finish;

Charles



----- Forwarded by Charles Mire/Dallas/HS/Concentra on 06/20/2005 03:33 PM
-----
|---------+---------------------------------->
|         |                   Charles Mire   |
|         |                   06/20/2005     |
|         |                   03:31 PM       |
|         |                                  |
|---------+---------------------------------->
  >------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                        |
  |     To:    "Alan Humphrey"                                                                  |
  |     cc:    sybperl-l@peppler.org                                                                                       |
  |     Subject:    Re: error - object already exists in database(Document link: Charles Mire)                             |
  >------------------------------------------------------------------------------------------------------------------------|



Have you tried using $sth?

$sth->$dbh->prepare("exec $statement");
$sth->execute;
$sth->finish;

It could be an issue with passing the "do" command in your code.



Charles







|---------+---------------------------------->
|         |                   "Alan Humphrey"|
|         |                      |
|         |                   Sent by:       |
|         |                   owner-sybperl-l|
|         |                   @peppler.org   |
|         |                   06/20/2005     |
|         |           03:18 PM               |
|         |                                  |
|---------+---------------------------------->
  >------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                        |
  |    To:            sybperl-l@peppler.org                                                                                |
  |    cc:                                                                                                                 |
  |    Subject:       error - object already exists in database                                                            |
  >------------------------------------------------------------------------------------------------------------------------|




I'm trying to create tables via my Perl script, working against a remote
database.  The error returned is:

DBD::Sybase::db do failed: Server message number=2714 severity=16 state=6
line=1 server=GILGAMESH\BIRDWEB text=There is already an object named
'abundancies' in the database. at sql_server.pl line 74,  chunk 1.

The SQL being executed is:

CREATE TABLE  abundancies (
        bird_id integer not null,
        ecoregion_id integer not null,
        abundancy_notes text,
        january char(1),
        february char(1),
        march char(1),
        april char(1),
        may char(1),
        june char(1),
        july char(1),
        august char(1),
        september char(1),
        october char(1),
        november char(1),
        december char(1),
        PRIMARY KEY (bird_id, ecoregion_id)
)

The code looks like:

sub do_command {
            my $sql_command = shift;

            my $dbh = DBI->connect('DBI:Sybase:server='. $server, $user,
$pass, {RaiseError=>1, AutoCommit=>1})
              or die "Couldn't connect to database: " . DBI->errstr;

            $dbh->do($sql_command);

            $dbh->disconnect();
}

The reason I'm posting to this list is that if I execute the same command
from other tools (e.g. Query Analyzer) it works.

Any ideas?

- Alan




                    ****** CONFIDENTIALITY NOTICE ******
NOTICE:  This e-mail message and all attachments transmitted with it may
contain legally privileged and confidential information intended solely for
the use of the addressee.  If the reader of this message is not the
intended recipient, you are hereby notified that any reading,
dissemination, distribution, copying, or other use of this message or its
attachments is strictly prohibited.  If you have received this message in
error, please notify the sender immediately and delete this message from
your system.  Thank you.



****** CONFIDENTIALITY NOTICE ******
NOTICE: This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately and delete this message from your system. Thank you.