import java.sql.*;
public class access{
public static void main(String args[]){
Connection con;
Statement sql; //声明Statement对象
ResultSet rs;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){
System.out.println(""+e);
}
try{
con=DriverManager.getConnection("jdbc:odbc:redsun","","");
sql=con.createStatement();
rs=sql.executeQuery("Select * FROM member");
while(rs.next()){
String name=rs.getString(1); //获得数据库第一列
String sex=rs.getString(2);
System.out.println("姓名:"+name); //输出信息
System.out.println("性别:"+sex);
}
con.close();
}
catch(SQLException el){}
}
}