DBI/Sybase problem

DBI/Sybase problem

am 24.08.2005 20:09:51 von Jim.Anderson

------_=_NextPart_001_01C5A8D7.056361D4
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

For a given server, dbconnect works in most cases, but fails for a =
specific userid/pswd. However, using isql I can connect to the server =
using the userid/pswd that hangs when used in DBI.

Any help greatly appreciated.

Thanks,

Jim


The code:

#!/ms/dist/perl5/bin/perl5.8

use strict;
use warnings;

use English;

use MSDW::Version
'DBD::Sybase' =3D> '1.04',
'DBI' =3D> '1.47';

use DBI;
use DBD::Sybase;


# # # M A I N L I N E # # #

my %dbinfo1 =3D (
server =3D> "NYQ_SPR_CREDIT", # this connects fine
DB =3D> "spr_credit_batch",
user =3D> "sprguest",
pswd =3D> '********',
);

my %dbinfo2 =3D ( # this hangs
server =3D> "NYQ_SPR_CREDIT",
DB =3D> "spr_credit_batch",
user =3D> "gracedev",
pswd =3D> '********',
);

dbconnect( \%dbinfo1 );
dbconnect( \%dbinfo2 );


# connect to database

sub dbconnect {
my ($dbinfo) =3D @_;

my $db =3D defined($dbinfo->{DB}) ? $dbinfo->{DB} : '';

warn < --- attempting connection ---
server : $dbinfo->{server}
user : $dbinfo->{user}
database: $db
-----------------------------
END_MSG

DBI->trace(2);
my $dbh =3D DBI->connect( "dbi:Sybase:server=3D$dbinfo->{server}", =
$dbinfo->{user}, $dbinfo->{pswd},
{ RaiseError =3D> 1, AutoCommit =3D> 1 } );

die "dbconnect failed for S=3D$dbinfo->{server}, =
U=3D$dbinfo->{user}, D=3D$db" unless $dbh;

if ( $dbinfo->{DB} ) {
$dbh->do( "use $dbinfo->{DB}" ) or die $dbh->errstr;
}

$dbh->{syb_do_proc_status} =3D 0;

warn < --- connection successful ---
END_MSG

return $dbh;
}



The trace:

../test.pl
--- attempting connection ---
server : NYQ_SPR_CREDIT
user : sprguest
database: spr_credit_batch
-----------------------------
DBI 1.47-ithread default trace level set to 0x0/2 (pid 2094)
-> DBI->connect(dbi:Sybase:server=3DNYQ_SPR_CREDIT, sprguest, ****, =
HASH(0x83077e4))
-> DBI->install_driver(Sybase) for linux perl=3D5.008004 pid=3D2094 =
ruid=3D80055 euid=3D80055
install_driver: DBD::Sybase version 1.04 loaded from =
//ms/dist/perl5/PROJ/DBD-Sybase/1.04-5.8/lib/perl5/DBD/Sybas e.pm
<- install_driver=3D DBI::dr=3DHASH(0x8263b04)
-> connect for DBD::Sybase::dr (DBI::dr=3DHASH(0x8263b04)~0x8158074 =
'server=3DNYQ_SPR_CREDIT' 'sprguest' **** HASH(0x830a30c)) thr#813b008
syb_db_login() -> checking for chained transactions
syb_db_login() -> chained transactions are supported
-> prepare for DBD::Sybase::db (DBI::db=3DHASH(0x8158044)~0x830a300 =
'select @@version') thr#813b008
<- prepare=3D DBI::st=3DHASH(0x830a408) at Sybase.pm line 120
-> execute for DBD::Sybase::st (DBI::st=3DHASH(0x830a408)~0x830a3b4) =
thr#813b008
syb_db_opentran() -> ct_command(
BEGIN TRAN DBI830a768
) =3D 1
syb_db_opentran() -> ct_send() =3D 1
syb_db_opentran() -> ct_results(4047) == 1
syb_db_opentran() -> ct_results(4046) == 1
syb_st_execute() -> ct_command() OK
syb_st_execute() -> ct_send() OK
st_next_result() -> ct_results(4040) == 1
ct_res_info() returns 1 columns
describe() -> col 0, type 0, realtype 0
describe() retcode =3D 1
st_next_result() -> lasterr =3D 0, lastsev =3D 0
<- execute=3D -1 at Sybase.pm line 121
-> fetch for DBD::Sybase::st (DBI::st=3DHASH(0x830a408)~0x830a3b4) =
thr#813b008
<- fetch=3D [ 'Adaptive Server Enterprise/11.9.2.6/1290/P/EBF 10491 =
ESD1/Sun_svr4/OS 5.5.1/FBO/Mon Jul 15 06:54:22 2002' ] row1 at Sybase.pm =
line 122
-> STORE for DBD::Sybase::db (DBI::db=3DHASH(0x830a300)~INNER =
'syb_server_version' '11.9.2.6') thr#813b008
<- STORE=3D 1 at Sybase.pm line 124
-> DESTROY for DBD::Sybase::st (DBI::st=3DHASH(0x830a3b4)~INNER) =
thr#813b008
syb_st_finish() -> ct_cancel(CS_CANCEL_ALL)
syb_st_finish() -> resetting ACTIVE, moreResults, dyn_execed
syb_st_destroy: called on 8cc10c0...
syb_st_destroy(): freeing imp_sth->statement
syb_st_destroy(): cmd dropped: 1
<- DESTROY=3D undef at Sybase.pm line 116
<- connect=3D DBI::db=3DHASH(0x8158044) at DBI.pm line 596
-> STORE for DBD::Sybase::db (DBI::db=3DHASH(0x830a300)~INNER =
'RaiseError' 1) thr#813b008
<- STORE=3D 1 at DBI.pm line 643
-> STORE for DBD::Sybase::db (DBI::db=3DHASH(0x830a300)~INNER =
'PrintError' 1) thr#813b008
<- STORE=3D 1 at DBI.pm line 643
-> STORE for DBD::Sybase::db (DBI::db=3DHASH(0x830a300)~INNER =
'AutoCommit' 1) thr#813b008
syb_db_commit() -> ct_command(
COMMIT TRAN DBI830a768
)
syb_db_commit() -> ct_send() OK
syb_db_commit() -> ct_results(4047) == 1
syb_db_commit() -> ct_results(4046) == 1
<- STORE=3D 1 at DBI.pm line 643
-> STORE for DBD::Sybase::db (DBI::db=3DHASH(0x830a300)~INNER =
'Username' 'sprguest') thr#813b008
<- STORE=3D 1 at DBI.pm line 646
<> FETCH=3D 'sprguest' ('Username' from cache) at DBI.pm line 646
<- connect=3D DBI::db=3DHASH(0x8158044)
-> STORE for DBD::Sybase::db (DBI::db=3DHASH(0x830a300)~INNER =
'dbi_connect_closure' CODE(0x8157fb4)) thr#813b008
<- STORE=3D 1 at DBI.pm line 666
-> do for DBD::Sybase::db (DBI::db=3DHASH(0x8158044)~0x830a300 'use =
spr_credit_batch') thr#813b008
1 -> prepare for DBD::Sybase::db (DBI::db=3DHASH(0x830a300)~INNER 'use =
spr_credit_batch' undef) thr#813b008
1 <- prepare=3D DBI::st=3DHASH(0x830e4ec) at Sybase.pm line 215
-> execute for DBD::Sybase::st (DBI::st=3DHASH(0x830e4ec)~0x830a2c4) =
thr#813b008
syb_st_execute() -> ct_command() OK
syb_st_execute() -> ct_send() OK
st_next_result() -> ct_results(4047) == 1
st_next_result() -> ct_results(4046) == 1
ct_results(4046) final retcode =3D -205
st_next_result() -> lasterr =3D 0, lastsev =3D 0
syb_st_execute() -> got CS_CMD_DONE: resetting ACTIVE, moreResults, =
dyn_execed
<- execute=3D -1 at Sybase.pm line 216
-> err in DBD::_::common for DBD::Sybase::st =
(DBI::st=3DHASH(0x830e4ec)~0x830a2c4) thr#813b008
<- err=3D undef at Sybase.pm line 217
-> FETCH for DBD::Sybase::st (DBI::st=3DHASH(0x830a2c4)~INNER =
'syb_more_results') thr#813b008
<- FETCH=3D undef at Sybase.pm line 218
-> rows for DBD::Sybase::st (DBI::st=3DHASH(0x830e4ec)~0x830a2c4) =
thr#813b008
<- rows=3D -1 at Sybase.pm line 226
-> DESTROY for DBD::Sybase::st (DBI::st=3DHASH(0x830a2c4)~INNER) =
thr#813b008
syb_st_destroy: called on 830ea38...
syb_st_destroy(): freeing imp_sth->statement
syb_st_destroy(): cmd dropped: 1
<- DESTROY=3D undef at test.pl line 58
<- do=3D -1 at test.pl line 58
-> STORE for DBD::Sybase::db (DBI::db=3DHASH(0x830a300)~INNER =
'syb_do_proc_status' 0) thr#813b008
<- STORE=3D 1 at test.pl line 61
--- connection successful ---
-> DESTROY for DBD::Sybase::db (DBI::db=3DHASH(0x830a300)~INNER) =
thr#813b008
syb_db_disconnect() -> ct_close()
<- DESTROY=3D undef at test.pl line 32
--- attempting connection ---
server : NYQ_SPR_CREDIT
user : gracedev
database: spr_credit_batch
-----------------------------
-> DBI->connect(dbi:Sybase:server=3DNYQ_SPR_CREDIT, gracedev, ****, =
HASH(0x8158044))
-> connect for DBD::Sybase::dr (DBI::dr=3DHASH(0x8263b04)~0x8158074 =
'server=3DNYQ_SPR_CREDIT' 'gracedev' **** HASH(0x8307820)) thr#813b008
syb_db_login() -> checking for chained transactions
syb_db_login() -> chained transactions are supported
-> prepare for DBD::Sybase::db (DBI::db=3DHASH(0x830a498)~0x830a348 =
'select @@version') thr#813b008
<- prepare=3D DBI::st=3DHASH(0x830a408) at Sybase.pm line 120
-> execute for DBD::Sybase::st (DBI::st=3DHASH(0x830a408)~0x830a3c0) =
thr#813b008
syb_db_opentran() -> ct_command(
BEGIN TRAN DBI830a740
) =3D 1
syb_db_opentran() -> ct_send() =3D 1
syb_db_opentran() -> ct_results(4047) == 1
syb_db_opentran() -> ct_results(4046) == 1
syb_st_execute() -> ct_command() OK
syb_st_execute() -> ct_send() OK
=20
pa176c1n3 /ms/user/a/anderjam/credit/ceed_1.4/src/bin/eqty_mktdata 32$
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender =
does not waive confidentiality or privilege, and use is prohibited.

------_=_NextPart_001_01C5A8D7.056361D4--

Re: DBI/Sybase problem

am 25.08.2005 19:53:40 von mpeppler

On Wed, 2005-08-24 at 14:09 -0400, Anderson, James H (Company IT) wrote:
> For a given server, dbconnect works in most cases, but fails for a
> specific userid/pswd. However, using isql I can connect to the server
> using the userid/pswd that hangs when used in DBI.

Off hand I don't see why that would happen.

If you can connect with isql you should be able to connect with
DBD::Sybase, as long as your environment is the same.

Try running this with DBI->trace(5) and send me (not the list) the
output.

Michael
--
Michael Peppler - mpeppler@peppler.org - http://www.peppler.org/
Sybase DBA/Developer
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html