import java.sql.*;
import java.lang.*;
public class link {
private final String driver="sun.jdbc.odbc.JdbcOdbcDriver";
private final String source="jdbc:odbc:HMS"; HMS为数据源名
//String conn="jdbc:microsoft:sqlserver://localhost:1433;DataBaseName=Hotel;User=;Password= ";
Connection con=null;
Statement sm=null;
ResultSet rs=null;
public link() {
try {
Class.forName(driver);
}
catch(Exception e){
System.err.println(e.getMessage());
return;
}
try{
con=DriverManager.getConnection(source);
}catch(SQLException exc){
System.err.println(exc.getMessage());
} }
public ResultSet executeQuery( String SQL){
rs=null;
try{
con=DriverManager.getConnection(source);
sm=con.createStatement();
sm=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=sm.executeQuery(SQL);
}
catch(SQLException ex){
System.err.println(ex.getMessage());
} return rs; }
}
import java.lang.*;
public class link {
private final String driver="sun.jdbc.odbc.JdbcOdbcDriver";
private final String source="jdbc:odbc:HMS"; HMS为数据源名
//String conn="jdbc:microsoft:sqlserver://localhost:1433;DataBaseName=Hotel;User=;Password= ";
Connection con=null;
Statement sm=null;
ResultSet rs=null;
public link() {
try {
Class.forName(driver);
}
catch(Exception e){
System.err.println(e.getMessage());
return;
}
try{
con=DriverManager.getConnection(source);
}catch(SQLException exc){
System.err.println(exc.getMessage());
} }
public ResultSet executeQuery( String SQL){
rs=null;
try{
con=DriverManager.getConnection(source);
sm=con.createStatement();
sm=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=sm.executeQuery(SQL);
}
catch(SQLException ex){
System.err.println(ex.getMessage());
} return rs; }
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货