import java.sql.*;
class Employee
{
public static void main(String args[])
{
Statement st;
Connection con;
try{
System.out.println("正在连接数据库...");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:mydsn");
System.out.println("已连接到数据库");
Statement stmt=con.createStatement();
String query="select * from Employees";
ResultSet rs=stmt.executeQuery("select * from Employees");
while(rs.next())
{
String name=rs.getString("Address");
System.out.println(name);
}
stmt.close();
con.close();
}
catch (Exception em)
{
System.out.println("出现的异常为:"+em);
}
}
}