package itat;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Example15_1 {
/**
* @param args
* @throws SQLException
*/
public static void main(String[] args){
// TODO Auto-generated method stub
Connection con;
Statement sql;
ResultSet rs;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:xu","xu","xu");
sql=con.createStatement();
rs=sql.executeQuery("select * from xu");
while(rs.next()){
String number=rs.getString(2);
String name=rs.getString(3);
System.out.print(number);
System.out.println(name);
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}