Statement stmnt = null; // statement for category

Statement stmnt2 = null; // statement for book 

Statement stmnt3 = null; // statement for thumbnail

ResultSet query = null; 

Connection conn = null;

ResultSet getBooks = null;

ResultSet getThumbnail = null;

//InputStream thumbnail = null;

try {

Class.forName(“com.mysql.jdbc.Driver”).newInstance();

}catch (ClassNotFoundException cnf){

System.out.print(“Error”);

}

 

try{ 

conn = DriverManager.getConnection(“jdbc:mysql://localhost/ebooks”, “root”, “thuyhien”);

stmnt = (Statement) conn.createStatement();

stmnt2 = (Statement) conn.createStatement();

query = stmnt.executeQuery(“Select * from Category”); 

getBooks = stmnt2.executeQuery(“select * from Books”);

}catch (SQLException sex){

System.out.println(“Unable to connect to database”);

}