1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| try {
dataSource = getDataSource(request);
myConnection = dataSource.getConnection();
Statement stmt=myConnection.createStatement();
ResultSet rst=stmt.executeQuery("select title from CT_EIB_ARCHIVES");
System.out.println("******************************************");
System.out.println("********Out Put from TestDataSource ******");
while(rst.next()){
System.out.println("Title is " + rst.getString("TITLE"));
}
System.out.println("******************************************");
rst.close();
stmt.close();
catch (SQLException sqle) {
sqle.printStackTrace();
}
getServlet().log("Connection.process", sqle);
}
finally {
try {
myConnection.close();
}
catch (SQLException e) {
getServlet().log("Connection.close", e);
}
} |
Partager