Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6844887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:25:58+00:00 2026-05-27T00:25:58+00:00

I get Java.sql.Connection closed Exception whenever i upload my application on My production Server.The

  • 0

I get Java.sql.Connection closed Exception whenever i upload my application on My production Server.The production server is Jboss .
I have also tried on QA,DEV server where this problem does not occur.
Ours is a web application and whenever we traverse to a particular tab this exception occurs.

This is the Trace :

2011-11-11 14:32:12,983 ERROR [STDERR] java.sql.SQLException: Closed Connection
2011-11-11 14:32:12,984 ERROR [STDERR] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
2011-11-11 14:32:12,984 ERROR [STDERR] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
2011-11-11 14:32:12,984 ERROR [STDERR] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
2011-11-11 14:32:12,984 ERROR [STDERR] at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:897)
2011-11-11 14:32:12,984 ERROR [STDERR] at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:816)
2011-11-11 14:32:12,984 ERROR [STDERR] at com.amadeus.mis.usermanagement.MisDb.prepareStatement(MisDb.java:72)
2011-11-11 14:32:12,984 ERROR [STDERR] at com.amadeus.mis.usermanagement.MisDb.getCompId(MisDb.java:1002)
2011-11-11 14:32:12,984 ERROR [STDERR] at com.amadeus.mis.usermanagement.MisDb.loadUnLinkedUsers(MisDb.java:1033)
2011-11-11 14:32:12,984 ERROR [STDERR] at org.apache.jsp.LinkUser_jsp._jspService(LinkUser_jsp.java:445)
2011-11-11 14:32:12,985 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
2011-11-11 14:32:12,985 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
2011-11-11 14:32:12,985 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
2011-11-11 14:32:12,985 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
2011-11-11 14:32:12,985 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
2011-11-11 14:32:12,985 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

I have also attached a code sample,This is the code where the error does occur.

public List<String>loadLinkedUsers(String uname)
    throws Exception
    {

        List<String> userList = new ArrayList<String>();

        String[]temp=uname.split("_");
        String myschema=temp[0]+"_"+temp[1];
        if(!getUserType(uname).equalsIgnoreCase("RC"))
        {
        PreparedStatement stmt = null;

         stmt = prepareStatement("select res_user_id from"+" "+myschema+".res_user where login_id = ? and res_user_id !='Administrator'");
         stmt.setString(1,uname);

        try {

            ResultSet rs = stmt.executeQuery();
            while(rs.next())
            {

                userList.add(rs.getString(1));

            }
            rs.close();
        } catch (Exception e) {
            System.out.println("Exception"+e.getMessage());
        }
        stmt.close();
        }
        return userList;

    }

    public  int getCompId(String userName)
    {
        PreparedStatement stmt;
        int temp=0;
        try{
        stmt = prepareStatement("Select comp_id from mis.users where login_id = ?");
        stmt.setString(1,userName);
        ResultSet rs=stmt.executeQuery();
        while(rs.next())
        {
            temp=rs.getInt(1);
        }

        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        return temp;
    }
    /**
     * Load the information about users that are not Linked to 
     * the user who is logged in.
     * (login_id, user_email, user_type_id from table mis.users)
     * @param login
     * @param users Vector that is filled with user information of type User.
     *              The previous data is not cleared. 
     * @throws SQLException
     */
    public List<String> loadUnLinkedUsers(String uname)
    throws Exception
    {

        List<String>userList = new ArrayList<String>();

        String[]temp=uname.split("_");
        String myschema=temp[0]+"_"+temp[1];
        int comp_id=getCompId(uname);

        if(!getUserType(uname).equalsIgnoreCase("RC"))
        {
        PreparedStatement stmt1=null;
        String query1="select res_user_id from"+" "+myschema+".res_user where login_id=? and res_user_id='Administrator'";
        stmt1 = prepareStatement(query1);
        stmt1.setString(1,uname);
        try {

            ResultSet rs1 = stmt1.executeQuery();
             /*if(!rs1.next())
             {
                userList.add("Administrator");
             }*/

        } catch (Exception e) {
            System.out.println("Exception"+e.getMessage());
        }

        PreparedStatement stmt = null;
        String query="SELECT u.login_id FROM mis.users u LEFT JOIN mis.user_type t ON u.user_type_id = t.user_type_id  WHERE comp_id = ? minus select res_user_id from"+" "+myschema+".res_user where login_id =?";
        stmt = prepareStatement(query);
        stmt.setInt(1,comp_id);
        stmt.setString(2,uname);

        try {

            ResultSet rs = stmt.executeQuery();
            while(rs.next())
            {
                userList.add(rs.getString(1));

            }
            rs.close();
        } catch (Exception e) {
            System.out.println("Exception"+e.getMessage());
        }
        stmt.close();
        }
        return userList;

    }

Please note that this is the function used to create Prepared Statements.

protected Connection m_Connection;

    /**
     * Prepare a statement from the current connection
     * @param strSql
     * @return Prepared statement
     * @throws SQLException
     */
    protected PreparedStatement prepareStatement(String strSql) throws SQLException
    {
        logger.debug("SQL=  " + strSql);
        return m_Connection.prepareStatement(strSql);
    } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:25:59+00:00Added an answer on May 27, 2026 at 12:25 am

    I finally did resolve the issue by replacing the classes12.jar and also using initial context instead driver manager.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

sql server 200 java 1.4 jboss 3 HI am getting exception message You cannot
I've been struggling to get a Java program to connect to MS SQL Server,
Lets say i have the following bit of code import java.sql.Connection; import java.sql.DriverManager; import
I have a problem with making connection to local SQL server 2008 R2, here
I have a Java EE application running on Glassfish and connecting to MSSQL Server
Lots of times in Java logs I'll get something like: Caused by: java.sql.BatchUpdateException: failed
I get a java.lang.outOfMemoryError exception, while writing a big file to the servletOutputStream. Every
I have encountered an error, java.sql.SQLException: Column count doesn't match value count at row
platform :sql server 2000 java 1.4 String queryStringForCustomer = {call MIGRATE_CUSTOMERS_FILE(?,?)}; String queryStringForCard =
Currently, I load the below custom driver (TestDriver.java), get a connection, create a Statement,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.