Kbase P60870: How to check connections to a Progress database with ASP
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/06/2004 |
|
Status: Unverified
GOAL:
How to check connections to a Progress database via ASP
GOAL:
Sample ASP program to check connection to a Progress database
FIX:
The following code enables simple checking of the connection from ASP to a Progress database. It is assumed that ODBC is used to achieve this.
The code creates an connection object, opens it and closes it again. If errors were generated then details are displayed otherwise the connection properties of the object are displayed.
Change the strConnection variable as follows:
Dim strConnection: strConnection = "DSN=<DSN Name>;UID=<Username>;PWD=<Password>"
<%
'Suppresses errors
On Error Resume Next
Dim strConn
'Database connection string
Dim strConnection: strConnection = "DSN=Sports2000;UID=pub;PWD=pub"
'Creates database connection object
Dim Conn: Set Conn = Server.CreateObject("ADODB.Connection")
'Opens the connection to the database
Conn.Open strConnection
'Saves connection information
strConn = Conn
'Closes the connection to the database
Conn.Close()
'Destroys the connection object
Set Conn = Nothing
If Err.Number <> 0 Then
'If error then display description and error code
Response.Write Err.Description & " (" & Err.Number & ")"
Else
'Else display connection information
Response.Write "No Errors Reported <P> Connection Information:<BR>" & strConn
End If
%>