You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
First steps in <strong>JDBC</strong>When using the <strong>Cincom</strong> ORDB <strong>JDBC</strong> driver, you must include certain driverspecificinformation in your programs.In the form of a tutorial, the following steps describe where and how to addthe information. It will also guide you through creating code for connecting toand querying a database from the client.To connect to and query a database from the client, you must provide code forthese tasks:♦ Registering the <strong>JDBC</strong> Driver♦♦♦♦♦♦Opening a connection to a databaseCreating a Statement objectExecuting a query and returning a ResultSet objectProcessing the ResultSetClosing the ResultSet and Statement objectsClosing the connectionYou must supply <strong>Cincom</strong> ORDB driver-specific information for the first twotasks, which allow your program to use the <strong>JDBC</strong> API to access a database. Forthe other tasks, you can use standard <strong>JDBC</strong> Java code as you would for anyJava application.Step 1: Register the <strong>JDBC</strong> DriverYou must provide the code to register your installed driver with your program.You do this with the static registerDriver() method of the <strong>JDBC</strong>DriverManager class. This class provides a basic service for managing a setof <strong>JDBC</strong> drivers.You register the driver only once in your Java application:DriverManager.registerDriver (new ordbjava.jdbc.ordbDriver());Alternatively, you can use the forName( ) method for the java.lang.Class classto load the <strong>JDBC</strong> drivers directly. For example:Class.forName ("ordbjava.jdbc.ordbDriver");<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 20Chapter: 3. Basic FeaturesSection: First steps in <strong>JDBC</strong>