After server restart I get - An I/O error occured while sending to the backend.
От | Rod |
---|---|
Тема | After server restart I get - An I/O error occured while sending to the backend. |
Дата | |
Msg-id | AANLkTilHOdiZ0kiIkPg51KGnz9BTgKK4PWQ-3QwzKkrq@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: After server restart I get - An I/O error occured while
sending to the backend.
|
Список | pgsql-jdbc |
Hi, I have simple JDBC client app running on Jetty. Using 8.3 JDBC3 driver and PostgreSQL8.3 server running on localhost. Any time I restart the PostgresQL server I get SQL error: An I/O error occured while sending to the backend. It appears that my application's connection to the server is not re-established by some reason? I am no expert in JDBC. First I was using plan JDBC. I thought that using DB connection pool will automagically reconnect and solve this problem. Switching to Apache commons DBCP did not change anything. What am I supposed to do to make it survive PostgreSQL server restart? Here is my DB connection manager class: public class DatabaseProvider { private static Connection connection; public void init() throws SQLException { connection = createConnection(); } private static Connection createConnection() throws SQLException{ try { Class.forName(ConfigurationServlet.getConfigurationProperty("database.driver")); } catch (ClassNotFoundException e) { System.err.println("Database Driver class not found: " + e.getMessage()); throw new SQLException("Driver class not found: "+e.getMessage()); } DataSource dataSource = setupDataSource(ConfigurationServlet.getConfigurationProperty("database.url")); Connection conn = dataSource.getConnection(); //Connection conn = DriverManager.getConnection(url,dbprops ); return conn; } public static DataSource setupDataSource(String connectURI) { BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName(ConfigurationServlet.getConfigurationProperty("database.driver")); ds.setUrl(connectURI); return ds; } public void shutdown() { try { connection.close(); } catch (SQLException e) { System.err.println("Error closing connection: "+e.getMessage()); } } public static Connection getConnection() { return connection; } }
В списке pgsql-jdbc по дате отправления: