[Helma-user] pieces of code doesn't work with oracle
kRAkEn/gORe
kunitoki at gmail.com
Wed Dec 19 10:22:56 CET 2007
I'm using oracle 10gR2 with helma and "SELECT 1" isn't a valid sql
command in oracle (at least
"SELECT 1 FROM DUAL", so i get a "Connection closed" exception from
time to time while executing
queries...
public Connection getConnection(DbSource src) {
Connection con = (Connection) sqlConnections.get(src);
if (con != null && !testedConnections.contains(src)) {
// Check if the connection is still alive by executing a
simple statement.
try {
Statement stmt = con.createStatement();
stmt.execute("SELECT 1");
stmt.close();
testedConnections.add(src);
} catch (SQLException sx) {
try {
con.close();
} catch (SQLException ignore) {/* nothing to do */}
return null;
}
}
return con;
}
thanx
More information about the Helma-user
mailing list