2 Replies Latest reply on Sep 19, 2006 9:24 AM by Rajesh Chande

    java.sql.SQLException: Already closed

    Peter Pei Guo Newbie

      In my web service, I need to access Oracle database, so I created the oracle-ds.xml file in my deploy directory like this:
      <?xml version="1.0" encoding="UTF-8"?>




      And in my code I have this function to get connection for me:
      private Connection getConnection() throws Exception {

      InitialContext initialContext = new InitialContext();
      javax.sql.DataSource ds = (javax.sql.DataSource) initialContext.lookup("java:hhsDB");
      java.sql.Connection conn = ds.getConnection();
      return conn;

      But it keeps giving me "java.sql.SQLException: Already closed", even after I removed those .close() calls from my code... What should I do?