Unlocking IBM Integrated Web Application Server
After the wizard is complete, you can click the link Manage Database Connections to view the data connection properties as Figure 5 indicates.
Now you've successfully set up a database connection. Next, let's take a look how the application works with the database connection we've defined. The following is the piece of Java code to use JNDI and connection ID to get a specific connection, then execute the SQL statements and return result set.
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/ProxyDS");
//<connection_id> is the database connection id specified above.
Connection dbConnect = ds.getConnection(<connection_id>, null);
String sqlText = <some valid SQL query statement text>;
PreparedStatement stmt = dbCon-nect.prepareStatement(sqlText);
ResultSet rs = stmt.executeQuery();
For a better performance, you can either use DB connection pool technology to reuse connection, or use Prepared Statement cache to reuse preparations. The database connection performance tuning is managed by the function Web Performance Advisor defined in IBM Web Administration for i GUI.
To see how it works, launch your Web Administration for i again, click the link Web Performance Advisor in the left navigation panel, select the integrated Application server and then click on the Manage Attributes button. The Database Connections tab is the starting point for updating database property values. To work with the performance attributes for a specific database connection, click on the Database Connection ID value. This is a link to the Manage database connection attributes page, as indicated in Figure 6. For example, you can click on the Advise button for a recommended maximum connection pool.
The IBM integrated Web application server for i, built on an infrastructure that leverages OSGi and Eclipse, provides a secure and easy to configure environment for hosting Web applications while requiring minimal system resources. IBM Web Administration for i provides an easy way for managing the server, installing and managing the applications, and managing other resources such as database connections are provided. If you're looking for these benefits, then the IBM integrated Web application server and its Web Administration interface are a winning combination.