When using VisualAge for Java, you do not have to know too much about the JDBC interface to access the database. The following bits of code illustrate some key points.
To connect to the database:
java.sql.connection jc = java.sql.DriverManager.getconnection("jdbc:db2:Matrix");
To create a statement object:
java.sql.statement obj = jc.createStatement();
To execute a query from the Customer table:
java.sql.ResultSet sql = obj.executeQuery("Select * from customer");
To try these examples, you must have DB2 running on your machine. Then, you can try the examples yourself in the VisualAge for Java Scrapbook.
Team-Fly |