SEGV on DBI-connect with DBD::Sybase
I'm having trouble with perl dumping core with a *very* basic DBD::Sybase script. Here is the output from the script: $ ./syb.pl Segmentation fault (core dumped) $ Here it is in the debugger: $ perl -d ./syb.pl Loading DB routines from perl5db.pl version 1.0402 Emacs support available. Enter h or `h h' for help. main::(./syb.pl:6): my $dbh = DBI-connect(dbi:Sybase:server=WEBBER1192,acs,foobar); DB1 n Signal SEGV at /usr/lib/perl5/site_perl/5.005/i386-linux/DBI.pm line 495 DBI::install_driver('DBI', 'Sybase') called at /usr/lib/perl5/site_perl/5.005/i386-linux/DBI.pm line 414 DBI::connect('DBI', 'dbi:Sybase:server=WEBBER1192', 'acs', 'foobar') called at ./syb.pl line 6 Aborted (core dumped) $ I am on RH Linux 6.2 (2.2.5) with perl 5.005_03. DBD-Sybase-0.93 statically linked and DBI-1.19. Oh, yeah...here's the script: #!/usr/bin/perl use DBI; my $dbh = DBI-connect(dbi:Sybase:server=WEBBER1192,foo,bar); my $sth = $dbh-prepare (select name from syslogins); $sth-execute(); while ( @row= $sth-fetchrow_array) { print @row , \n; } exit; Thanks for any help. Patrick
Re: I found DBI works without install!!!
Kon-nichiwa. - Original Message - From: "plala" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 09, 2001 3:41 PM Subject: I found DBI works without "install"!!! I found DBI works without "install"!!! As Martin wrote, it is not very special. This might be very interesting for the rental server user. I used the DBD::CSV as my DBD, very simple but very small choice for rental server use. (snip) If you can't use compiler but DBI was installed, how about use DBD::Sprite ? Even if your server have no DBI, you can use Sprite or JSprite, I think. And more SQL::Squish will be used for this purpose. == Kawai, Takanori(Hippo2000) Mail: [EMAIL PROTECTED] [EMAIL PROTECTED] http://member.nifty.ne.jp/hippo2000 ==
RE: Cannot Insert into SQL Server
probably the placehoder answer would work. But other than that, I think this would probably work: my $sth = $dbh-prepare(insert into emails values ('$addr')) || die Can't prepare statement: $DBI::errstr; embedding the value inside of double quotes or my $sth = $dbh-prepare(insert into emails values (' . $addr . ')) || die Can't prepare statement: $DBI::errstr; quoting the string with double qoutes and concatentating the single quotes with the value contained in $addr, resulting in the correct statement... more of a perl problem than a DBI problem. Hope this helps. H -Original Message- From: nayeem [mailto:[EMAIL PROTECTED]] Sent: Sunday, August 12, 2001 11:26 AM To: [EMAIL PROTECTED] Subject: Cannot Insert into SQL Server Can Anybody help me to insert the records in Sql Server. Actually this code is working but inserting $addr as value instead of variable $addr 's value that is abc, so is there any solution to add the variable values... use DBI; my $addr ='abc'; my $dbh = DBI-connect(dbi:ODBC:email, sa, zajilpass) || die Can't connect to $data_source: $DBI::errstr; my $sth = $dbh-prepare( q{ insert into emails values ('$addr') }) || die Can't prepare statement: $DBI::errstr; my $rc = $sth-execute || die Can't execute statement: $DBI::errstr; check this code and please advice me. Thanks, Nayeem.
RE: Cannot Insert into SQL Server
Generally, people use q{} and qq{} quotation notation to avoid having to concatenate, and to avoid the interference of quotes required by the SQL statement - or other statements. The problem in the original question was that the person used a single q with the q{} quote notation. A single q works like a single quote, so the statement is not parsed for variables. qq{} (double q's) works like double quote marks in that the contents are parsed for variables, but it is usually better in situations like this than the double quotes because it can contain single or double quotes within it without needing a concatenation. That was the first suggestion. Just change the q{} notation to a qq{} quote notation, and $addr will be replaced within it with the value of $addr before the statement is prepared. Steve H. -Original Message- From: Hugh J. Hitchcock [mailto:[EMAIL PROTECTED]] Sent: Sunday, August 12, 2001 7:35 PM To: [EMAIL PROTECTED] Subject: RE: Cannot Insert into SQL Server probably the placehoder answer would work. But other than that, I think this would probably work: my $sth = $dbh-prepare(insert into emails values ('$addr')) || die Can't prepare statement: $DBI::errstr; embedding the value inside of double quotes or my $sth = $dbh-prepare(insert into emails values (' . $addr . ')) || die Can't prepare statement: $DBI::errstr; quoting the string with double qoutes and concatentating the single quotes with the value contained in $addr, resulting in the correct statement... more of a perl problem than a DBI problem. Hope this helps. H -Original Message- From: nayeem [mailto:[EMAIL PROTECTED]] Sent: Sunday, August 12, 2001 11:26 AM To: [EMAIL PROTECTED] Subject: Cannot Insert into SQL Server Can Anybody help me to insert the records in Sql Server. Actually this code is working but inserting $addr as value instead of variable $addr 's value that is abc, so is there any solution to add the variable values... use DBI; my $addr ='abc'; my $dbh = DBI-connect(dbi:ODBC:email, sa, zajilpass) || die Can't connect to $data_source: $DBI::errstr; my $sth = $dbh-prepare( q{ insert into emails values ('$addr') }) || die Can't prepare statement: $DBI::errstr; my $rc = $sth-execute || die Can't execute statement: $DBI::errstr; check this code and please advice me. Thanks, Nayeem.