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' => '1.04',
'DBI' => '1.47';
use DBI;
use DBD::Sybase;
# # # M A I N L I N E # # #
my %dbinfo1 = (
server => "NYQ_SPR_CREDIT", # this connects fine
DB => "spr_credit_batch",
user => "sprguest",
pswd => '********',
);
my %dbinfo2 = ( # this hangs
server => "NYQ_SPR_CREDIT",
DB => "spr_credit_batch",
user => "gracedev",
pswd => '********',
);
dbconnect( \%dbinfo1 );
dbconnect( \%dbinfo2 );
# connect to database
sub dbconnect {
my ($dbinfo) = @_;
my $db = defined($dbinfo->{DB}) ? $dbinfo->{DB} : '';
warn <<END_MSG;
--- attempting connection ---
server : $dbinfo->{server}
user : $dbinfo->{user}
database: $db
-----------------------------
END_MSG
DBI->trace(2);
my $dbh = DBI->connect( "dbi:Sybase:server=$dbinfo->{server}",
$dbinfo->{user}, $dbinfo->{pswd},
{ RaiseError => 1, AutoCommit => 1 } );
die "dbconnect failed for S=$dbinfo->{server}, U=$dbinfo->{user}, D=$db"
unless $dbh;
if ( $dbinfo->{DB} ) {
$dbh->do( "use $dbinfo->{DB}" ) or die $dbh->errstr;
}
$dbh->{syb_do_proc_status} = 0;
warn <<END_MSG;
--- 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=NYQ_SPR_CREDIT, sprguest, ****,
HASH(0x83077e4))
-> DBI->install_driver(Sybase) for linux perl=5.008004 pid=2094 ruid=80055
euid=80055
install_driver: DBD::Sybase version 1.04 loaded from
//ms/dist/perl5/PROJ/DBD-Sybase/1.04-5.8/lib/perl5/DBD/Sybase.pm
<- install_driver= DBI::dr=HASH(0x8263b04)
-> connect for DBD::Sybase::dr (DBI::dr=HASH(0x8263b04)~0x8158074
'server=NYQ_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=HASH(0x8158044)~0x830a300 'select
@@version') thr#813b008
<- prepare= DBI::st=HASH(0x830a408) at Sybase.pm line 120
-> execute for DBD::Sybase::st (DBI::st=HASH(0x830a408)~0x830a3b4)
thr#813b008
syb_db_opentran() -> ct_command(
BEGIN TRAN DBI830a768
) = 1
syb_db_opentran() -> ct_send() = 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 = 1
st_next_result() -> lasterr = 0, lastsev = 0
<- execute= -1 at Sybase.pm line 121
-> fetch for DBD::Sybase::st (DBI::st=HASH(0x830a408)~0x830a3b4) thr#813b008
<- fetch= [ '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=HASH(0x830a300)~INNER
'syb_server_version' '11.9.2.6') thr#813b008
<- STORE= 1 at Sybase.pm line 124
-> DESTROY for DBD::Sybase::st (DBI::st=HASH(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= undef at Sybase.pm line 116
<- connect= DBI::db=HASH(0x8158044) at DBI.pm line 596
-> STORE for DBD::Sybase::db (DBI::db=HASH(0x830a300)~INNER 'RaiseError' 1)
thr#813b008
<- STORE= 1 at DBI.pm line 643
-> STORE for DBD::Sybase::db (DBI::db=HASH(0x830a300)~INNER 'PrintError' 1)
thr#813b008
<- STORE= 1 at DBI.pm line 643
-> STORE for DBD::Sybase::db (DBI::db=HASH(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= 1 at DBI.pm line 643
-> STORE for DBD::Sybase::db (DBI::db=HASH(0x830a300)~INNER 'Username'
'sprguest') thr#813b008
<- STORE= 1 at DBI.pm line 646
<> FETCH= 'sprguest' ('Username' from cache) at DBI.pm line 646
<- connect= DBI::db=HASH(0x8158044)
-> STORE for DBD::Sybase::db (DBI::db=HASH(0x830a300)~INNER
'dbi_connect_closure' CODE(0x8157fb4)) thr#813b008
<- STORE= 1 at DBI.pm line 666
-> do for DBD::Sybase::db (DBI::db=HASH(0x8158044)~0x830a300 'use
spr_credit_batch') thr#813b008
1 -> prepare for DBD::Sybase::db (DBI::db=HASH(0x830a300)~INNER 'use
spr_credit_batch' undef) thr#813b008
1 <- prepare= DBI::st=HASH(0x830e4ec) at Sybase.pm line 215
-> execute for DBD::Sybase::st (DBI::st=HASH(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 = -205
st_next_result() -> lasterr = 0, lastsev = 0
syb_st_execute() -> got CS_CMD_DONE: resetting ACTIVE, moreResults,
dyn_execed
<- execute= -1 at Sybase.pm line 216
-> err in DBD::_::common for DBD::Sybase::st
(DBI::st=HASH(0x830e4ec)~0x830a2c4) thr#813b008
<- err= undef at Sybase.pm line 217
-> FETCH for DBD::Sybase::st (DBI::st=HASH(0x830a2c4)~INNER
'syb_more_results') thr#813b008
<- FETCH= undef at Sybase.pm line 218
-> rows for DBD::Sybase::st (DBI::st=HASH(0x830e4ec)~0x830a2c4) thr#813b008
<- rows= -1 at Sybase.pm line 226
-> DESTROY for DBD::Sybase::st (DBI::st=HASH(0x830a2c4)~INNER) thr#813b008
syb_st_destroy: called on 830ea38...
syb_st_destroy(): freeing imp_sth->statement
syb_st_destroy(): cmd dropped: 1
<- DESTROY= undef at test.pl line 58
<- do= -1 at test.pl line 58
-> STORE for DBD::Sybase::db (DBI::db=HASH(0x830a300)~INNER
'syb_do_proc_status' 0) thr#813b008
<- STORE= 1 at test.pl line 61
--- connection successful ---
-> DESTROY for DBD::Sybase::db (DBI::db=HASH(0x830a300)~INNER) thr#813b008
syb_db_disconnect() -> ct_close()
<- DESTROY= undef at test.pl line 32
--- attempting connection ---
server : NYQ_SPR_CREDIT
user : gracedev
database: spr_credit_batch
-----------------------------
-> DBI->connect(dbi:Sybase:server=NYQ_SPR_CREDIT, gracedev, ****,
HASH(0x8158044))
-> connect for DBD::Sybase::dr (DBI::dr=HASH(0x8263b04)~0x8158074
'server=NYQ_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=HASH(0x830a498)~0x830a348 'select
@@version') thr#813b008
<- prepare= DBI::st=HASH(0x830a408) at Sybase.pm line 120
-> execute for DBD::Sybase::st (DBI::st=HASH(0x830a408)~0x830a3c0)
thr#813b008
syb_db_opentran() -> ct_command(
BEGIN TRAN DBI830a740
) = 1
syb_db_opentran() -> ct_send() = 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
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.