PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Danckert, Michael J dot (CAP, CMC)" <Michael_Danckert at mortgage dot ge dot com>
Subject: Close not working like I expect...
Date: May 25 2000 1:23PM

Here is a stripped down version of a test script that I'm working with.
There are 2 different sections of the perl script that set up, open, use a
db connection then close it.  The second dblogin or dbuse appear to be
causing "Database 'CERTPROPDB' is already open and can only have one user at
a time." messages.

I can avoid the already open error if I add an "if ( $dbproc1->DBDEAD )"
statement and enclose the second dblogin and dbuse in the if.

Is there anything else that I must do to close the first connection?

Thanks,
Mike Danckert
Michael_Danckert@Mortgage.GE.Com




#!/usr/local/bin/perl

use Sybase::DBlib;
require 'lib/path.pl';        #Sets up global vars
require 'cgi_support.pl';     #Sets up my dbmsghandle & web_error_handler
require "cgi-hand.pl";        #basic CGI stuff

$dbproc1 = &dblogin($USER,$USERPW,$SYB_SERVER_PROP);
&dbuse($dbproc1, $SYB_DB_PROP);
$SQL  = "select cn from property where cn='00102441820'\n";
&dbcmd($dbproc1, $SQL);
&dbsqlexec($dbproc1);
&dbresults($dbproc1);
($cn2) = &dbnextrow($dbproc1);
print "Number: $cn2\n";
&dbclose( $dbproc1 );

$dbproc1 = &dblogin($USER,$USERPW,$SYB_SERVER_PROP);
&dbuse($dbproc1, $SYB_DB_PROP);
$SQL  = "select cn from property where cn='00102441820'\n";
&dbcmd($dbproc1, $SQL);
&dbsqlexec($dbproc1);
&dbresults($dbproc1);
($cn2) = &dbnextrow($dbproc1);
print "Number: $cn2\n";
&dbclose( $dbproc1 );