Import Java. SQL. * ;
Public Class Lookup {
Public Static Void Main (string [] ARGs)
Throws Sqlexception, classnotfoundexception {
// Database connection string defined
String dburl = " JDBC: ODBC: dbjdbc " ;
// Database username
String user = " Manager " ;
// Database User Password
String Password = " Ora912 " ;
// Load the JDBC-ODBC bridge driverProgram
Class. forname ( " Sun. JDBC. ODBC. jdbcodbcdriver " );
// Establish a connection with the data source specified by the URL
Connection C = Drivermanager. getconnection (dburl, user, password );
// Use statement for query
Statement S = C. createstatement ();
Resultset R = S.exe cutequery ( " Select empno, name from EMP " );
While (R. Next ()){
// Print Field Information
System. Out. println (R. getstring ( " Empno " ) + " ,
" + R. getstring ( " Name " ));
}
// Close statement, and the resultset on it will also be closed
S. Close ();
}
}