Package jsp;
Import java. SQL. *; // JDBC package
Public class SQL _data {
String url = "jdbc: inetdae: 192.168.2.70? Sql7 = true "; // use your hostname and port number
String login = "sa"; // use your login here
String password = ""; // use your password here
Public Connection connection = null;
Public Statement st = null;
Public ResultSet rs = null;
Public SQL _data (){
Try {
Class. forName ("com. inet. tds. TdsDriver"). newInstance ();
DriverManager. setLoginTimeout (10 );
} Catch (Exception e ){
E. printStackTrace ();
}
}
Public void sqlclose (){
Try {
St. close ();
Connection. close ();
}
Catch (SQLException ex ){
System. err. println ("sqlclose:" + ex. getMessage ());
}
}
Public ResultSet executeQuery (String SQL ){
Try {
Connection = DriverManager. getConnection (url, login, password );
Connection. setCatalog ("register ");
St = connection. createStatement ();
Rs = st.exe cuteQuery (SQL );
}
Catch (SQLException ex ){
System. err. println ("aq.exe cuteQuery:" + ex. getMessage ());
}
Return rs;
}
}