servlets - Java Oracle JDBC Connection Timeout -


I have developed some JSON web services using Servlets for my mobile app. I am using Hosting (Oracle + Private Tomcat), I have a single class DBOperations.java that has many static functions which are called in Servets for database operation. I use the getConnection () method in each function to get the connection object, create the statement and execute the query. There is a problem after losing the connection for some time. I am using the following code to reset the connection again.

  conn conform to the public stable connection; Description stmt; Get public static connection () throws SQLException {if (conn == null || conn.isClosed ()) {try {class.forName ( "oracle.jdbc.driver.OracleDriver"); Conn = DriverManager.getConnection (DB_URL, "Username", "Password"); Return canon; } Grip (Classonautound Expression | Accloxation X) {}} and {Return Conn; } Return conn; }  

I'm unable to figure out how I'm not set up to handle the timeout / off connection problem would cause the above code connection again. To get it back to the working state, I need to restart Tommack. Any suggestions or help is highly appreciated.

You must use connection pooling, and everything Tokekat server. Create a JNDI datasource to get one and you will never face such issue.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -