JDBC Server Programmer's Reference

}
// Test with NonStop SQLMP database.
databaseUrl = new String("/jdbc:sqlmp:");
rmiJdbcUrl = new String("t3jdbc:sqlrmi:");
if(port == null) {
port = new String("");
}
// Set up the server host string.
if(server != null) {
serverHost = new String(server + port);
}
else {
serverHost = new String("//"
+ InetAddress.getLocalHost().getHostName()
+ port);
}
// Connect to the NonStop SQLMP database.
ConnectionUrl = new String(rmiJdbcUrl + serverHost + databaseUrl);
userId = new String("jdbcAdmin");
password = new String("tandem");
java.sql.Connection cn = DriverManager.getConnection(ConnectionUrl,
userId,
password);
// Execute query against the database.
java.sql.Statement st = cn.createStatement();
java.sql.ResultSet rs = st.executeQuery("SELECT * FROM " + table);
// Print out query results.
java.sql.ResultSetMetaData md = rs.getMetaData();
while(rs.next()) {
System.out.print("\nTUPLE: | ");
for(i=1; i<= md.getColumnCount(); i++) {
System.out.print(rs.getString(i) + " | ");
} // for
} // while
// Clean up resources.
rs.close();
}
catch(Exception e){
e.printStackTrace();
}
} // main
}; // TestClient
Return to title page