ASA Programming Guide
JDBC Programming
Establishing JDBC connections
Establishing a connection from a server-side JDBC class
In this simple example, InternalConnect() is the only method used in the application.
The application requires only one of the libraries (JDBC) imported in the first line of the JDBCExamples.java class. The others are for external connections. The package named java.sql contains the JDBC classes.
The InternalConnect() method carries out the following tasks:
Connects to the default running database using the current connection:
DriverManager.getConnection establishes a connection using a connection string of jdbc:default:connection.
Prints Hello World to the current standard output, which is the server window. System.out.println carries out the printing.
If there is an error in the attempt to connect, an error message appears in the server window, together with the place where the error occurred.
The try and catch instructions provide the framework for the error handling.
Terminates the class.