package 管理信息系統;
import Java.io.*;
import Java.sql.*;
public class Testdb {
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
public static void main(String args[]){
new Testdb();
}
public Testdb(){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:Javadb";
conn=DriverManager.getConnection(url,"sa","");
stmt=conn.createStatement();
String sql="select * from tbuser";
rs=stmt.executeQuery(sql);
while(rs.next()){
System.out.println(rs.getString("user_name")+rs.getString("user_passWord")+rs.getString("user_type"));
}
rs.close();
stmt.close();
conn.close();
}catch(Exception e){e.printStackTrace();}
}
}