From af3d007e78246144f2f50aaadc05f81bae000f84 Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Sun, 12 Oct 2014 18:46:56 +0200 Subject: Use JDBC4, in order to use the .isValid() method. Note that the PostgreSQL implementation does not have this in the 9.1-901 version. Try 9.2-1002 instead (sucks: this is not in Debian stable...). --- org/madore/damlengine/WeblogDatabaseConnection.java | 2 +- org/madore/damlengine/WeblogServlet.java | 4 ++-- org/madore/damlengine/cmdlines | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/org/madore/damlengine/WeblogDatabaseConnection.java b/org/madore/damlengine/WeblogDatabaseConnection.java index dfacebb..1a1828d 100644 --- a/org/madore/damlengine/WeblogDatabaseConnection.java +++ b/org/madore/damlengine/WeblogDatabaseConnection.java @@ -21,7 +21,7 @@ public final class WeblogDatabaseConnection { public static Connection getConnection() throws SQLException { Connection conn = pconn.get(); - if ( conn == null || conn.isClosed() ) { + if ( conn == null || conn.isClosed() || ! conn.isValid(5) ) { String dbHost = null; if ( ! DamlEngine.runAsServlet ) dbHost = System.getenv("DAMLENGINE_PGHOST"); diff --git a/org/madore/damlengine/WeblogServlet.java b/org/madore/damlengine/WeblogServlet.java index 0e0ebe4..2ceb448 100644 --- a/org/madore/damlengine/WeblogServlet.java +++ b/org/madore/damlengine/WeblogServlet.java @@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletResponse; /* Thinkos about the mess that is tomcat: - * - Make sure that /usr/share/java/postgresql-jdbc3.jar (or whatever + * - Make sure that /usr/share/java/postgresql-jdbc4.jar (or whatever * contains the class org.postgresql.Driver) is symlinked from * /var/lib/tomcat7/common (or some path listed in the common.loader * property of the catalina.properties file). Similarly, @@ -34,7 +34,7 @@ import javax.servlet.http.HttpServletResponse; public class WeblogServlet extends HttpServlet { - private static final long serialVersionUID = 2014101202L; + private static final long serialVersionUID = 2014101203L; @Override public void init(ServletConfig cfg) diff --git a/org/madore/damlengine/cmdlines b/org/madore/damlengine/cmdlines index 29ecd0f..1128cd5 100644 --- a/org/madore/damlengine/cmdlines +++ b/org/madore/damlengine/cmdlines @@ -1,2 +1,2 @@ -export CLASSPATH=$HOME/java/damlengine:/usr/share/java/xercesImpl.jar:/usr/share/java/xml-resolver-1.2.jar:/usr/share/java/xml-commons-resolver-1.1.jar:/usr/share/java/postgresql-jdbc3.jar:/usr/share/java/servlet-api-3.0.jar +export CLASSPATH=$HOME/java/damlengine:/usr/share/java/xercesImpl.jar:/usr/share/java/xml-resolver-1.2.jar:/usr/share/java/xml-commons-resolver-1.1.jar:/usr/share/java/postgresql-jdbc4.jar:/usr/share/java/servlet-api-3.0.jar java org.madore.damlengine.DamlEngine some/file.daml -- cgit v1.2.3