CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Inserting data to a sybase text field



Jul 14, 2001, 12:09 AM

Post #1 of 2 (347 views)
Inserting data to a sybase text field Can't Post

Please help!!

I am trying to insert a a text to a Sybase database. The Sybase field has been declared as a text field. Everytime I am attempting to insert the text to that field with a SQL command I am receiving this error message:

DBD::Sybase::db prepare failed: Server message number=2782 severity=16 state=1 l
ine=1 procedure=#P$$000090018401769_DBD1 text=An untyped variable in the PREPARE
statement 'DBD1' is being resolved to a TEXT or IMAGE type. This is illegal in
a dynamic PREPARE statement.

Here is the PERL script that I am using:
use DBI;

my $data_source = "DBI:Sybase:database=aubd";
my $user = "aubd";
my $password = "t3st3r";
my($dbh, $sth, $syn_to_find);

$dbh = DBI->connect($data_source, $user, $password, { RaiseError => 1, AutoCommit => 0 })
|| die $DBI::errstr;

$sth = $dbh->prepare(q{INSERT INTO testing (aaa,bbb,ccc,text)
values (?,?,?,?)});



User / Moderator

Aug 2, 2001, 10:46 AM

Post #2 of 2 (326 views)
Re: Inserting data to a sybase text field [In reply to] Can't Post

Okay, Jaybee, let's try this ... no guarantees :-)

I think the only problem with this is your parameters passed in the prepare statement. What happens if you try to split up the steps you are doing. I think it should work.

my $stmt = "INSERT INTO testing (aaa, bbb, ccc, text) VALUES ( ?, ?, ?, ?)";

my $sth = $dbh->prepare($stmt);

my $i = 'baloney';

$sth->execute($i, 'bb', 'ffggerhgt', 'text');


That should ought to do it. Although I do not have sybase around, I have had DB2 around and that was one of the things I worked on a lot.

Good Luck


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives