On Mon, Jun 09, 2003 at 11:29:26AM -0500, Forquer, Brian R. wrote: > I was working on a program to take text files and insert them in to an > oracle datbase. I have the current version of both DBI and DBD:Oracle and > was trying to create a simple table wehn i got an error in reference to the > prepare.al > I run Mandrake 9 and my DBI utils are in > /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/DBI > > Here is my code > ---------------------------------------------------------------------------- > #!/usr/bin/perl > use DBI; #Opens DBI > > #Connection to database > my $dbh = DBI->connect( "dbi:Oracle:accessdb", "webdata", "iisucks" ) > or die "Cannot connect to Oracle Server\n: $DBI::errstr\n"; > > #Creating Tables #Line 19 > my $sth = DBI->prepare( "CREATE TABLE rep ( > srnu VARCHAR(6), > srna VARCHAR(30) > ) > ")
You call prepare() as an object method on the database handle, not as a class method: my $sth = $dbh->prepare( ... ); Almost every method in DBI is called as an object method on a database handle or on a statement handle. (connect() is the most important exception.) Ronald
