목차
없음
본문내용
import java.sql.*;
import java.io.*;
import java.lang.*;
class PetHotel {
public String driver, user, password, url;
public Connection con;
public Statement stmt;
public Statement stmt1;
public ResultSet result;
public ResultSet result1;
public ResultSet result2;
public PetHotel(String driver, String user, String password, String url) {
this.driver = driver;
this.user = user;
this.password = password;
this.url = url;
}
public void connect() {
try {
Class.forName(driver);
con = DriverManager.getConnection(url, user, password);
stmt = con.createStatement();
} //20
catch(ClassNotFoundException e1) {
System.err.println(e1.getMessage());
}
catch(SQLException e2) {
System.err.println(e2.getMessage());
}
}
public PreparedStatement getPreparedStatementQuery (String query) {
PreparedStatement pstmt;
try {
pstmt = con.prepareStatement(query);
}
catch (SQLException e) {
System.out.println(e);
pstmt = null;
}
return pstmt;
} //40
public void remove(String query) throws IOException, SQLException, NullPointerException{
try {
stmt.executeUpdate(query);
}
catch (SQLException e) {
System.out.println(e);
}
}
import java.io.*;
import java.lang.*;
class PetHotel {
public String driver, user, password, url;
public Connection con;
public Statement stmt;
public Statement stmt1;
public ResultSet result;
public ResultSet result1;
public ResultSet result2;
public PetHotel(String driver, String user, String password, String url) {
this.driver = driver;
this.user = user;
this.password = password;
this.url = url;
}
public void connect() {
try {
Class.forName(driver);
con = DriverManager.getConnection(url, user, password);
stmt = con.createStatement();
} //20
catch(ClassNotFoundException e1) {
System.err.println(e1.getMessage());
}
catch(SQLException e2) {
System.err.println(e2.getMessage());
}
}
public PreparedStatement getPreparedStatementQuery (String query) {
PreparedStatement pstmt;
try {
pstmt = con.prepareStatement(query);
}
catch (SQLException e) {
System.out.println(e);
pstmt = null;
}
return pstmt;
} //40
public void remove(String query) throws IOException, SQLException, NullPointerException{
try {
stmt.executeUpdate(query);
}
catch (SQLException e) {
System.out.println(e);
}
}
소개글