Sample client code

COMPONENT JAVA
Extending the Power of JDBC Drivers
Nitin Nanda
Listing 5. Sample client code.


try
{
     Class.forName("com.jr.driver.JRDriver");

     Connection connection = DriverManager.
              getConnection("jdbc:jr:myDb","sa", "");

     Statement statement = connection.createStatement();

     //"testtable" is present in the DSN
     ResultSet resultSet = statement.
        executeQuery("select * from testtable");

     while(resultSet.next())
     {
	      /* do processing here */
     }
     
     resultSet.close();
     statement.close();
     connection.close();

}
catch(Exception exception)
{
     System.out.println(exception.getMessage());
     exception.printStackTrace();
}

Upcoming Training Events

0 AM
Visual Studio Live! San Diego
September 8-12, 2025
Live! 360 Orlando
November 16-21, 2025
Cloud & Containers Live! Orlando
November 16-21, 2025
Data Platform Live! Orlando
November 16-21, 2025
Visual Studio Live! Orlando
November 16-21, 2025