August 1999
Intermediate to advanced
1488 pages
72h 53m
English
database.connected()
The connected() method of the database object tells if the connection to the database is still active.
Listing 8.41 creates a connection to a database. If the connection is made, any code within that section is executed. If the connection fails, the error is written to the page.
<SERVER>
// Open a connection
var myConn = database.connect("ORACLE", "mySID", "myApp", "appsPWD", "myTNS");
if (myConn.connected()) {
// You are connected, so perform any tasks here
}else{
// There was an error connecting to the database
write('Error ('+myConn.majorErrorCode()+'): '+myConn.majorErrorMessage);
}
</SERVER>
|
Read now
Unlock full access