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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



jaybee
newbie

Jul 14, 2001, 12:09 AM

Post #1 of 2 (346 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:
#!/usr/local/bin/perl
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 (?,?,?,?)});

$sth->execute($i,"bb","jhfgghfghf","text");

$dbh->disconnect;




fashimpaur
User / Moderator

Aug 2, 2001, 10:46 AM

Post #2 of 2 (325 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');

$dbh->commit;
$dbh->disconnect;

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