//Connect to the database using java.
Connection Connection = empty;
Stat = null statement;
Try {
class . forname(" Oracle . JDBC . driver . Oracle driver "); //If it is db2, it is class.forname ("com.ibm.db2.jdbc.app.db2driver"). new instance();
Conn = drivermanager.getconnection ("JDBC: Oracle: thin: @ dbserver:1521:demo", "user name" and "password");
string sqlString = " select * from Books "; //retrieve the SQL of the book
stat = conn . create statement();
return stat . execute(SQL string);
}catch (exception e){
//Exception handling
} Finally {
if(null! = connected) {
conn . close();
}
if(null! = stat ){
stat . close();
}
}