Basic HTML version of Foils prepared 7 October 97

Foil 47 Example - Using Imaginary's mSQL Driver

From Overview of JDBC and its use with Microsoft Access ARL Database Tutorial -- February 98. by Nancy McCracken(Sangetta Aggarwal, Udayan Parvate, Tom Pulikal)


import java.net.URL;
import java.sql.*;
import imaginary.sql.*;
class Select {
public static void main (String argv[] ) {
try {
//load the class imaginary/sql/iMsqlDriver
Class.forName (" imaginary.sql.iMsqlDriver");
String url = jdbc:msql://host.npac.syr.edu:4333/test";
//connect to the test database using the driver URL
Connection conn = DriverManager.getConnection( url, "scott", "tiger");
//create the query statement and get the result set
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery (" select * from
test_table order by id");
System.out.println ("Got results :");
//print the results in a loop



© on Mon Oct 13 1997