AWM closes on connection to DB - Urgent!

Hi there,
I have installed Analytic Workspace Manager 10.2.0.1...and have set the database to my current database (10.2)...
However, when I try to connect to the database, it closes the window and gives the following error report :
Local Time = Fri Jan 06 12:20:12 2006
Elapsed Time = 22
# HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
# Error ID : 4F530E43505002EF
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
# Java VM: Java HotSpot(TM) Client VM (1.4.2_03-b02 mixed mode)
Any ideas as to what the problem may be?
Thanks in advance.
AN.

Hi,
This is not the forum for Analytic Workspace Manager. I would suggest to try the oracle olap forum for your questions.
OLAP
Regards,
Ben

Similar Messages

  • How to close RFC connection in one script coding

    In one script, I am using the REF command to call another 2 scripts and these called scripts shd be run on same C36 ( test system). I shd close RFC connection between these 2 scripts.
    That is , once the 1s script over the RFC shd be closed and the user has to give usename and pwd  then  2nd script shd run.
    I have tried with the following code…. But it says RFC is not open……
    REF ( Y04S_FC_RM_CJ88_112 , Y04S_FC_RM_CJ88_1 , C36_999 ).   (when execute this script RFC to C36 will be created and after execution that RFC shd be closed so I included following ABAP code)
    ABAP.
      data : dest type RFCDEST.
      move 'S4_SAPC36999' to dest.                                       
      move dest to v_dest.
    *--Close the connection before opening it incase it is opened
              call function 'RFC_CONNECTION_CLOSE'
                   exporting
                        destination          = dest
                   exceptions
                        destination_not_open = 1
                        others               = 2.
              if sy-subrc <> 0.
              endif.
              move sy-subrc to v_subrc.
    ENDABAP.
    REF ( Y04S_FC_RM_CJ44_112 , Y04S_FC_RM_CJ44_1 , C36_999 ). (here agagin the RFC will be created and this script will be exectued.)

    In one script, I am using the REF command to call another 2 scripts and these called scripts shd be run on same C36 ( test system). I shd close RFC connection between these 2 scripts.
    That is , once the 1s script over the RFC shd be closed and the user has to give usename and pwd  then  2nd script shd run.
    I have tried with the following code…. But it says RFC is not open……
    REF ( Y04S_FC_RM_CJ88_112 , Y04S_FC_RM_CJ88_1 , C36_999 ).   (when execute this script RFC to C36 will be created and after execution that RFC shd be closed so I included following ABAP code)
    ABAP.
      data : dest type RFCDEST.
      move 'S4_SAPC36999' to dest.                                       
      move dest to v_dest.
    *--Close the connection before opening it incase it is opened
              call function 'RFC_CONNECTION_CLOSE'
                   exporting
                        destination          = dest
                   exceptions
                        destination_not_open = 1
                        others               = 2.
              if sy-subrc <> 0.
              endif.
              move sy-subrc to v_subrc.
    ENDABAP.
    REF ( Y04S_FC_RM_CJ44_112 , Y04S_FC_RM_CJ44_1 , C36_999 ). (here agagin the RFC will be created and this script will be exectued.)

  • Open and close RFC connection with portals...

    Hi Experts,
    I created a RFC having a query which is taking a long time to execute. So i want to close RFC connection with portals which is via java connector(JCO)  before that query and open the connction again after that query.
    Please advice is it possible to achieve this. If yes, then how.
    Regards,
    Guddan

    Hi Guddan,
    I created a RFC having a query which is taking a long time to execute. So i want to close RFC connection with portals which is via java connector(JCO) before that query and open the connction again after that query.
    I guess i will need to understand your requirement a little more in detail, as i understand you have an RFC which has a query within to fetch some data and is taking a long time to do so. In the meantime you don't want to keep the connection open?
    My question would be, Is the role of this RFC to only execute the query and fetch the data or does it do something else?
    If it does other things and these are independent of the query execution, then you can span a parallel call within the RFC to execute the query and in the meantime the RFC does the other things (or vice versa) hence reducing the overall time taken.
    If the sole purpose of this RFC is to execute the query, then you will not be able(i mean to say there is no simple and direct way of doing this) to close the connection after the Query is started and re-establish the connection after its execution, for a simple reason that - how will you know if the query has completed it's execution, so that you can establish the connection back.
    Alternate solutions, make this a two way asynchronous call, 1) You invoke the RFC asynchronously and close the connection, the RFC in turn will execute the query and transfer the data to JCO via another RFC call.
    If this needs to be a synchronous call, then you will need to optimize the query to its best.
    Regards,
    Chen

  • Open and close database connection jsp page

    hi there, i wanna know about how to open database connection to Mysql at the beginning of the page and close the connection at the end of the page. The jsp page contain all processing code.
    plz help me...thx thx

    <html>
    <head>
    <basefont face="Arial">
    </head>
    <body>
    <%@ page language="java" import="java.sql.*" %>
    <%!
    // define variables
    String id;
    String firstName;
    String lastName;
    // define database parameters, change this according to your needs
    String host="localhost";
    String user="root";
    String pass="";
    String db="test";
    String conn;
    %>
    <table border="1" cellspacing="1" cellpadding="5">
    <tr>
    <td><b>id</b></td>
    <td><b>first name</b></td>
    <td><b>last name</b></td>
    </tr>
    <%
    Class.forName("org.gjt.mm.mysql.Driver");
    // create connection string
    conn = "jdbc:mysql://" + host + "/" + db + "?user=" + user 
    + "&password=" + pass;
    // pass database parameters to JDBC driver
    Connection Conn = DriverManager.getConnection(conn);
    // query statement
    Statement SQLStatement = Conn.createStatement();
    // generate query
    // change this query according to your needs
    String Query = "SELECT id, firstname, lastname FROM abook";
    // get result
    ResultSet SQLResult = SQLStatement.executeQuery(Query);
    while(SQLResult.next())
       id = SQLResult.getString("id");
       firstName = SQLResult.getString("firstname");
       lastName = SQLResult.getString("lastname");
            out.println("<tr><td>" + id + "</td><td>" + 
         firstName + "</td><td>" + lastName + "</td></tr>");
    // close connection
    SQLResult.close();
    SQLStatement.close();
    Conn.close();
    %>
    </table>
    </body>
    </html>hi :-)
    i've got that on the net as part of the tutorial on jsp (long long time ago)
    you just have to be resourceful in finding solutions :-)
    try google :-) there are lot's of tutorial available in there ;-)
    goodluck ;-)
    regards,

  • How to correct close database connection after report generation

    Hello
    I have problem a with alive database connection after report creation and report  closing. How to properly to close connection to database?
    Best regards
    Edited by: punkers84 on Jun 17, 2011 10:38 AM

    that's what I am doing... after viewing the report, I call the close method on the window closing event of the container window. but the connection is still open. I had a lot of other issues with my jdbc driver but after downgrading to an older version those issues are resolved.Only this one is still there! Is there any other way to close the connection (like using dbcontroller or etc.)?

  • When to open and close database connection

    im trying to connect to a oracle database using servlets
    when should i open and close the connection
    it works fine when i do both in the doPost() method
    but when i tried to open connection in init() methd .. it doesnt seem to work
    what should i do...
    the connection is initialised in the init() method but is null in the doPost() method

    " im trying to connect to a oracle database using servlets
    when should i open and close the connection
    it works fine when i do both in the doPost() method
    but when i tried to open connection in init() methd .. it doesnt seem to work
    what should i do...
    the connection is initialised in the init() method but is null in the doPost() method"
    1:
    without seeing the code i would say the the connection is null
    because you are storing it as a servlet class variable which is
    not thread safe.
    2:
    The best way to do it using connection pooling
    detailed docs on the tomcat website
    3:
    if you are not using connection pooling, then
    open and close the connection in the do* method
    or
    use init() to place the connection in the servletconfig
    and close in destroy() and use synching to access

  • Close URL Connection netstat

    hello all,
    I hope you can help me.
    Please have a look at my code below
    I open an URL Connection but I can't close it.
    If i type in a DOS Box netstat I see a lot of connection.
    Now my question is how can I close the connection.
    m_http.disconnect() seems not to work.
    public class Unbenannt1 extends Applet
      Button button1 = new Button();
      private HttpURLConnection m_http = null;
      private URL m_MyAlarmURL = null;
      private URLConnection m_MyURLConnection = null;
      private long m_TimeAlarmXML = 0;
      private boolean m_TimeUpdate = true;
      /**Das Applet initialisieren*/
      public void init()
        String a_str = "http://"+ getCodeBase().getHost() + "/x.xml";
        try
          m_MyAlarmURL = new URL( a_str );
        catch ( MalformedURLException ie )
        try
          jbInit();
        catch(Exception e)
          e.printStackTrace();
      /**Initialisierung der Komponenten*/
      private void jbInit() throws Exception
        button1.setLabel("button1");
        button1.setBounds(new Rectangle(27, 28, 78, 27));
        button1.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            button1_actionPerformed(e);
        setLayout(null);
        setBackground(java.awt.Color.lightGray);
        setSize(426,266);
        this.add(button1, null);
      void button1_actionPerformed(ActionEvent e)
        int a_int = 0;
        try
            m_MyURLConnection = m_MyAlarmURL.openConnection();
            m_http = (HttpURLConnection)m_MyURLConnection;
            m_http.setRequestMethod( "HEAD" );
            m_http.setUseCaches(false);
            m_http.connect();
            a_int = m_http.getResponseCode();
            m_http.disconnect();
            m_http = null;
            m_MyURLConnection = null;
            System.gc();
          catch ( java.io.IOException ioe  )
            a_int = 404;
    }Thanks a lot
    Prediger

    Usually those connections linger around for some time, and will then be closed by the OS once a certain timeout has been reached. I don't know how to change that timeout, though.
    Btw: the docs don't claim that the connection will be closed. The description for disconnect() is "Indicates that other requests to the server are unlikely in the near future"
    If you still see the connection after a while, then something is wrong, but I've seen connections like that hang around for several minutes even after the JVM was terminated.
    Thomas

  • How to close database connections in Crystal Reports

    I am using the following code to connect to database. I can either pass JNDIName or I can provide values for others by leaving JNDI name empty.
    If i use JNDI name, it will use a connection from the connection pool of App Server (in my case Weblogic), but it is not releasing the connection after use. Connection remains even if I logoff from the application. If i keep my max connections as 15 in weblogic, after clicking the page with crystal report 15 times all will remain active and users will not be able to login to the application.
    If i use connectionString and others without using JNDI Name, it directly connects to database. So it creates a connection in database server directly without using connection pool of weblogic. If i check weblogic, it shows no connection in use as expected, but if i check database, i can see the no. of connections increasing everytime a user clicks a crystal report page.
    When the connection touches the maximum allowed connection in server, every application using the same server goes down
    How can I close the connection which was created for the viewing the report?
    String reportName = "/reports/BankBalance.rpt";
    ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);
    if (clientDoc == null)
             clientDoc = new ReportClientDocument();
             clientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);
            // Open report
            clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);
           String connectString = ""; // jdbc:sybase:Tds:DBSERVERNAME:9812/DBNAME?ServiceName=DBNAME
           String driverName = "";    // com.sybase.jdbc3.jdbc.SybDriver
           String JNDIName = "DS_APP";
           String userName = "";
           String password = "";
           // Switch all tables on the main report and sub reports
           CRJavaHelper.changeDataSource(clientDoc, userName, password, connectString, driverName, JNDIName);
         // logon to database
          CRJavaHelper.logonDataSource(clientDoc, userName, password);
    // Store the report document in session
    session.setAttribute(reportName, clientDoc);
                   // Create the CrystalReportViewer object
                          CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();
         String reportSourceSessionKey = reportName+"ReportSource";
         Object reportSource = session.getAttribute(reportSourceSessionKey);
         if (reportSource == null)
              reportSource = clientDoc.getReportSource();
              session.setAttribute(reportSourceSessionKey, reportSource);
         //     set the reportsource property of the viewer
         crystalReportPageViewer.setReportSource(reportSource);
         crystalReportPageViewer.setHasRefreshButton(true);
         crystalReportPageViewer.setToolPanelViewType(CrToolPanelViewTypeEnum.none);
         // Process the report
         crystalReportPageViewer.processHttpRequest(request, response, application, null);

    the sample shows how to clear RAS and Enterprise resources after viewing report.
    1. If you use unmanaged RAS - as I can see you using setReportAppServer, then remove the enterprise related stuff : instantiating and cleaning code.
    The sample code is meant to give you an idea on how you can release the resources after done with viewing report. In your case all you need to do for cleaning is call close() on ReportDocumentObject. The sample will need to be modified for your requirements.

  • Need to close RFC connection

    Hi all,
    Currently we developed a application in NWDS, the same is operational from portal.
    As per the requirment we have to run the RFC many times to extract the data from R/3. After running the RFC many times
    we are getting the following Error "Error connecting using JCO.client: null"
    But if we redeploy the application the problem is solved but after a while the same issue is persisting.
    Please suggest how the problem can be solved ??
    Thanks,
    vijay.

    Hi venkat,
    Thanks for the example suggested by you.
    The following is the RFC iam executing many times.
    Z_Hr_Aprsl_Init_Input input= new Z_Hr_Aprsl_Init_Input();
    input.setI_Usrid("UserId");
    wdContext.nodeZ_Hr_Aprsl_Init_Input_new().bind(input);
    wdContext.nodeZ_Hr_Aprsl_Init_Input().currentZ_Hr_Aprsl_Init_InputElement().modelObject().execute();
    the code iam using to close the connection is
    JCO.Client client = JCO.getClient(" "); // Please specify the parameter to be used to refer the above RFC
    client.disconnect();
    Please suggest the required the parameter to close the RFC connection
    Thanks
    vijay

  • How do I close a connection when the session ends?

    I have a website that is using JavaMail to display a user's mail through the browser. I'd like to keep the connection to the mail server open during the whole session that the user is logged in, in order to improve response time. The problem is, I can't detect if a user closes their browser so that I can close the connection to the server.
    Is there a way for me to close the mail server connection when the session ends?
    Thanks.

    Create session listener, Impliment sessionDestryoyed
    method with your connection close statements.I was wondering how to use the listener for a Servlet as well, what would you type in that method to close the connection?.
    public class ServletListener
         implements
              ServletContextListener,
              ServletContextAttributeListener,
              HttpSessionListener,
              HttpSessionAttributeListener
    public void sessionDestroyed(HttpSessionEvent arg0)
              //System.out.println( arg0 );
    }

  • When and How to close database connection in JSP?

    Hi there,
    I am using MySQL and JDBC 3.0, in my system, When and How to close database connection in JSP?
    Thanks in advance.
    Lonely Wolf
    <%@ page session="true" language="java" %>
    <jsp:include page="checkauthorization.jsp" />
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    <%--
    Execute query, with wildcard characters added to the
    parameter values used in the search criteria
    --%>
    <sql:query var="availablecomputerList" dataSource="jdbc/Bookingcomputer" scope="request">
    SELECT * FROM computer where status=0
    order by s_code
    </sql:query>
    <html>
    <head>
    <title>Search Result</title>
    </head>
    <body bgcolor="white">
    <center>
    <form action="checkin.jsp" method="post">
    <input type="submit" value="Back to Check-in Page">
    </form>
    <c:choose>
    <c:when test="${availablecomputerList.rowCount == 0}">
    Sorry, no available computer found.
    </c:when>
    <c:otherwise>
    The following available computers were found:
    <table border="1">
    <th>Computer</th>
    <th>Description</th>
    <th>Status</th>
    <c:forEach items="${availablecomputerList.rows}" var="row">
    <tr>
    <td><c:out value="${row.s_code}" /></td>
    <td><c:out value="${row.description}" /></td>
    <td><c:out value="${row.status}" /></td>
    </tr>
    </c:forEach>
    </table>
    </c:otherwise>
    </c:choose>
    </center>
    </body>
    </html>

    when should you close the connection? when you're done with it.
    how should you close the connection? like this: conn.close();
    that said, doing this in a JSP page is bad form and not recommended
    JSP's typically don't contain ANY business or data logic

  • Close RFC Connection

    Hi,
    I have some problems with the availibility of my WebDynpro-Application. It seems to be, that to much connections are opened at the same time. Is it necessary to close the connection in the code or should it closed by the system automatically?
    To use a model I use the following code(example):
    wdContext.nodeZ_Rfc_GetData_Input().bind(new Z_Rfc_GetData_Input());
    wdContext.currentZ_Rfc_GetData_InputElement().modelObject().execute();
    wdContext.nodeOutput().invalidate();
    I don't know if there is a option to close the connection.

    Hi,
    Use below code:
    wdContext.currentRFC_InputElement().modelObject().modelInstance().disconnectIfAlive();
    Please check below forum ,
    webdynpro JCO - RFC Connections are not closing  in back end ECC (SM51)
    Regards
    Deepak

  • How to close timeout  connection in SQLDBC ?

    Hello,
    I use SQLDBC to access MAXDB 7.7.0.7.16 database, i have the following issue :
    When a connection reach timeout, I close the connection, and the release the connexion, and then I create a new connection
    To close connection I call my Disconnect function
                        The call close method return "Not connected", but It seems that the underlying Socket is not closed and the Database user task is not closed.
    So the number of task grow until it reach the maximun.
    Where is my error ?
    How can I be sure to close the database user task ?
    IDBError CMaxDBConnection::Disconnect()
         IDBError hr;
         if (m_pConnection)          
              EDPTRACE_DBG_INF(L"CMaxDBConnection::Disconnect %1", EDPMASK_TRC_CONNECTIONS) << (DWORD)m_pConnection;
              SQLDBC_Retcode rc = m_pConnection->close();
              if (SQLDBC_OK != rc)
                   hr = convertError(rc, m_pConnection->error(), L"CMaxDBConnection::Disconnect");               
              m_pParent->m_pEnvironment->releaseConnection(m_pConnection);
              m_pConnection = NULL;
         return hr;
    Regards
    Yann

    MAXDB 7.7.07.16 (WINDOWS 2008 R2 (64 bits) Client program in 32bits.
    Hello
    I have code a small program to illustrate my issue.
    When I create a connection with SQLDBC it create 2 user tasks in the MAXDB task Manager
    One uer task  APPPLICATION SERVER, SESSION TIMOUT, ... filled.
    T425  10 0x16AC User      2688* Command wait        823 0            76 20691065(s)
    and One User task with no session tiemout.
    T111   8 0x15B8 User       2688 Command wait       3009 0            76 24900501(s)
    T111                  USER             ( pid = 2688       ) -
    dispatcher_cnt: 2                                     command_cnt   : 2
    exclusive_cnt : 30                                    self_susp_cnt : 0
    state_vwait   : 0          state_vsleep  : 0          state_vsusp   : 0
    same_ukt_coll : 0        
    when I close the connection the task T111 is never remove !!
    Do you have any idea ?
    I try to delete environment but It does not work.
    Regards
    Yann.
    Here is the code  :
    // SQLDBC.cpp : Defines the entry point for the console application.
    #include "stdafx.h"
    #include "SQLDBC.h"
    using namespace SQLDBC;
    static void parseArgs(int argc, wchar_t **argv);
    static SQLDBC_Connection *connectDB();
    SQLDBC_Environment *g_env;
    typedef struct ConnectArgsT {
      bstrt username;
      bstrt password;
      bstrt dbname;  
      bstrt host;    
      bstrt request;    
    } ConnectArgsT;
    ConnectArgsT connectArgs;
    void exitOnError(SQLDBC_ErrorHndl &err);
    int _tmain(int argc, _TCHAR* argv[])
         SQLDBC_Retcode ret;
       parseArgs(argc, argv);
       for (int j = 0 ; j < 10 ; ++j)
            for (int i = 0 ; i < 100 ; ++ i)
                 SQLDBC_Connection *conn = connectDB();
                 ret = conn->close();
                 ret = conn->disconnect();
                 g_env->releaseConnection(conn);
            delete g_env;
            g_env = NULL;
       return 0;
    SQLDBC_Connection *connectDB()
      char errorText[200];
      SQLDBC_Retcode rc;
      if (g_env == NULL)
    Every application has to initialize the SQLDBC library by getting a
    reference to the ClientRuntime and calling the SQLDBC_Environment constructor.
           SQLDBC_IRuntime *runtime;      
           runtime = SQLDBC::GetClientRuntime(errorText, sizeof(errorText));
           if (!runtime) {
              fprintf(stderr, "Getting instance of the ClientRuntime failed %s\n", errorText);          
           g_env = new SQLDBC_Environment(runtime);      
    Create a new connection object and open a session to the database.
      SQLDBC_Connection *conn = g_env->createConnection();
      printf("Connecting to '%s' on '%s' as user '%s'\n",
             (char)connectArgs.dbname, (char)connectArgs.host, (char*)connectArgs.username);
      rc = conn->connect(connectArgs.host, connectArgs.dbname,
                         connectArgs.username, connectArgs.password);
      if(SQLDBC_OK != rc) {
        fprintf(stderr, "Can't connect to '%s'.\nERROR: %d:'%s'\n",
                connectArgs.dbname, conn->error().getErrorCode(), conn->error().getErrorText());
        exit(1);
         conn->setAutoCommit(SQLDBC_TRUE);
      return conn;
    static void parseArgs (int argc, wchar_t **argv)
      connectArgs.username = "ESKDBADM";
      connectArgs.password = "DELORME";
      connectArgs.dbname = "EDP350";
      connectArgs.host = "ly-delorme"; 
    void exitOnError(SQLDBC_ErrorHndl &err)
      if(err) {
        fprintf(stderr, "Execution stopped %d:'%s'", err.getErrorCode(), err.getErrorText());
        //exit(1);
    Yann.

  • Why should we close a connection

    Hi,
    Connection conn = DriverManager.getConnection (databaseUrl, userName, userPassword);
    Why should we close a connection
    conn.close();
    Even when i give no "close command", it works !
    Thank You
    Edited by: ashipj on ?? ????????, ???? ?:?? ???????

    My code frequently fetches data from database, so i created a class like this
    public class ConnectToDatabase
    /*             public ConnectToDatabase()
                                    Connection conn;
         public ResultSet selectS(String userQuery) throws Exception
              String userName = "root";
              String userPassword = "gal";
              String databaseUrl = "jdbc:mysql://localhost:3306/test";
              Class.forName ("com.mysql.jdbc.Driver");
              Connection conn = DriverManager.getConnection (databaseUrl, userName, userPassword);
              String query = userQuery;
              Statement S=conn.createStatement();
              ResultSet RS=S.executeQuery(query);
                                    //conn.close;
              return RS;
                                    //conn.close;
    /*              public void closeConnection()
                                    conn.close;
    }and from the main code i make call as given below (it works fine)
    ConnectToDatabase CTD=new ConnectToDatabase();
    ResultSet result=CTD.selectS(String userQuery);
    //CTD.closeConnection();Now my problem is
    1) If try to give "conn.close()" before "return RS;" It will show error (RS cannot be fetched after closing connectio)
    2) If write conn.close after return it wont be executed (ofcourse - unreachable statement)
    3) If use "CTD.closeConnection();" it gives errror saying that "cannot find conn(in closeConnection()) " i dont know why constructor is noy loaded.

  • Do I close my connection yet? How to improve it

    Hi all,
    my connection pool is not working well, the connection is not release back to pool. why??
    package formate;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import javax.sql.*;
    import pool.ConnectionPool;
    * TryJdbc.java
    * This servlet demonstrates using JDBC
    public class Formate extends HttpServlet {
       Statement stmt =null;
        ResultSet rs = null;
        Connection conn = null;
      ConnectionPool connectionPool = null;
    * Creates a connection pool.
    public void init() throws ServletException
    String jdbcDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
    String dbURL ="jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=sequences";
    try
    //instantiate the connection pool object by passing the
    //jdbc driver, database URL, username, and password
    connectionPool = new ConnectionPool(jdbcDriver, dbURL,
    "A#$","RE@89");
    //specify the initial number of connections to establish
    connectionPool.setInitialConnections(5);
    //specify number of incremental connections to create if
    //pool is exhausted of available connections
    connectionPool.setIncrementalConnections(5);
    //specify absolute maximum number of connections to create
    connectionPool.setMaxConnections(20);
    connectionPool.createPool(); //create the connection pool
    catch(Exception e)
    System.out.println("Error: " + e);
    }in my doget I have
    conn = connectionPool.getConnection();
         stmt = conn.createStatement();
    ...query
    finally {
    try {
    if(rs != null)
    rs.close();
    rs = null;
    if(stmt != null)
    stmt .close();
    stmt = null;
    if(conn != null)
    conn.close();
    conn = null;
    connection.returnConnection(conn); }
    package pool;
    import java.sql.*;
    import java.util.*;
    public class ConnectionPool
    private String jdbcDriver = "";
    private String dbUrl = "";
    private String dbUsername = "";
    private String dbPassword = "";
    private int initialConnections = 10;
    private int incrementalConnections =5;
    private int maxConnections = 50;
    private Vector connections = null;
    * Constructor stores the parameters passed by the calling
    * object.
    * @param jdbcDriver String containing the fully qualified name
    * of the jdbc driver (class name and full package info)
    * @param dbUrl String containing the database URL
    * @param dbUsername String containing the username to use when
    * logging into the database
    * @param dbPassword String containing the password to use when
    * logging into the database
    public ConnectionPool(String jdbcDriver, String dbUrl,
    String dbUsername, String dbPassword)
    this.jdbcDriver = jdbcDriver;
    this.dbUrl = dbUrl;
    this.dbUsername = dbUsername;
    this.dbPassword = dbPassword;
    * Returns the initial number of connections to create.
          * @return Initial number of connections to create.
    public int getInitialConnections()
    return initialConnections;
          * Sets the initial number of connections to create.
    * @param initialConnections Initial number of connections to
    * create
    public void setInitialConnections(int initialConnections)
    this.initialConnections = initialConnections;
    * Returns the number of incremental connections to create if
    * the initial connections are all in use.
    * @return Number of incremental connections to create.
    public int getIncrementalConnections()
    return incrementalConnections;
    * Sets the number of incremental connections to create if
    * the initial connections are all in use.
    *@param incrementalConnections Number of incremental
    * connections to create.
    public void setIncrementalConnections(
    int incrementalConnections)
    this.incrementalConnections = incrementalConnections;
    * Returns the absolute maximum number of connections to
          * create. If all connections are in use, the getConnection()
    * method will block until one becomes free.
    * @return Maximum number of connections to create.
    public int getMaxConnections()
    return maxConnections;
    * Sets the absolute maximum number of connections to create.
    * If all connections are in use, the getConnection() method
    * will block until one becomes free.
    * @param maxConnections Maximum number of connections to
    * create.
    public void setMaxConnections(int maxConnections)
    this.maxConnections = maxConnections;
    * Creates a pool of connections. Number of connections is
    * determined by the value of the initialConnections property.
    public synchronized void createPool() throws Exception
    //make sure that createPool hasn't already been called
    if (connections!=null)
    return; //the pool has already been created, return
    //instantiate JDBC driver object from init param jdbcDriver
    Driver driver = (Driver)
    (Class.forName(jdbcDriver).newInstance());
    DriverManager.registerDriver(driver); //register JDBC driver
    connections = new Vector();
    //creates the proper number of initial connections
    createConnections(initialConnections);
    * Creates the specified number of connections, places them in
    * a PooledConnection object, and adds the PooledConnection to
    * the connections vector.
    * @param numConnections Number of connections to create.
    private void createConnections(int numConnections) throws
    SQLException
    //create the specified number of connections
    for (int x=0; x < numConnections; x++)
    //have the maximum number of connections been created?
    //a maxConnections value of zero indicates no limit
    if (maxConnections > 0 &&
    connections.size() >= maxConnections)
    break; //break out of loop because we're at the maximum
    //add a new PooledConnection object to connections vector
    connections.addElement(new PooledConnection(
    newConnection()));
    System.out.println("Database connection created...");
    * Creates a new database connection and returns it.
    * @return New database connection.
    private Connection newConnection() throws SQLException
    //create a new database connection
    Connection conn = DriverManager.getConnection (dbUrl,
    dbUsername, dbPassword);
    //if this is the first connection, check the maximum number
    //of connections supported by this database/driver
    if (connections.size()== 0)
    DatabaseMetaData metaData = conn.getMetaData();
    int driverMaxConnections = metaData.getMaxConnections();
    //driverMaxConnections value of zero indicates no maximum
    //or unknown maximum
    if (driverMaxConnections > 0 &&
    maxConnections > driverMaxConnections)
    maxConnections = driverMaxConnections;
    return conn; //return the new connection
    * Attempts to retrieve a connection from the connections
    * vector by calling getFreeConnection(). If no connection is
    * currently free, and more can not be created, getConnection()
    * waits for a short amount of time and tries again.
    * @return Connection object
    public synchronized Connection getConnection()throws
    SQLException
    //make sure that createPool has been called
    if (connections == null)
    return null; //the pool has not been created
    Connection conn = getFreeConnection();//get free connection
    while (conn == null) //no connection was currently free
    //sleep for a quarter of a second and then check to see if
    //a connection is free
    wait(250);
    conn = getFreeConnection(); //try again to get connection
    return conn;
    * Returns a free connection from the connections vector. If no
    * connection is available, a new batch of connections is
    * created according to the value of the incrementalConnections
    * variable. If all connections are still busy after creating
    * incremental connections, the method will return null.
    * @return Database connection object
    private Connection getFreeConnection() throws SQLException
    //look for a free connection in the pool
    Connection conn = findFreeConnection();
    if (conn == null)
    //no connection is free, create additional connections
    createConnections(incrementalConnections);
    //try again to find a free connection
    conn = findFreeConnection();
    if (conn == null)
    //there are still no free connections, return null
    return null;
    return conn;
    * Searches through all of the pooled connections looking for
    * a free connection. If a free connection is found, its
    * integrity is verified and it is returned. If no free
    * connection is found, null is returned.
    * @return Database connection object.
    private Connection findFreeConnection()throws SQLException
    Connection conn = null;
    PooledConnection pConn = null;
    Enumeration enum = connections.elements();
    //iterate through the pooled connections looking for free one
    while (enum.hasMoreElements())
    pConn =(PooledConnection)enum.nextElement();
    if (!pConn.isBusy())
    //this connection is not busy, get a handle to it
    conn = pConn.getConnection();
    pConn.setBusy(true); //set connection to busy
    //connection is no longer valid, create a new one
    conn = newConnection();
    //replace invalid connection with new connection
    pConn.setConnection(conn);
    break; //we found a free connection, stop looping
    return conn;
    * Test the connection to make sure it is still valid. If not,
    * close it and return FALSE.
    * @param conn Database connection object to test.
    * @return True indicates connection object is valid.
    * Turns off the busy flag for the current pooled connection.
    * All ConnectionPool clients should call returnConnection() as
    * soon as possible following any database activity (within a
    * finally block).
    * @param conn Connection object
    public void returnConnection(Connection conn)
    //make sure that createPool has been called
    if (connections== null)
    return; //the pool has not been created
    PooledConnection pConn = null;
    Enumeration enum = connections.elements();
    //iterate through the pooled connections looking for the
    //returned connection
    while (enum.hasMoreElements())
    pConn =(PooledConnection)enum.nextElement();
    //determine if this pooled connection contains the returned
    //connection
    if (conn == pConn.getConnection())
    //the connection has been returned, turn off busy flag
    pConn.setBusy(false);
    break;
    * Refreshes all of the connections in the connection pool.
    public synchronized void refreshConnections()throws
    SQLException
    //make sure that createPool has been called
    if (connections == null)
    return; //the pool has not been created
    PooledConnection pConn = null;
    Enumeration enum = connections.elements();
    while (enum.hasMoreElements())
    pConn =(PooledConnection)enum.nextElement();
    if (!pConn.isBusy())
    wait(10000); //wait 5 seconds
    closeConnection(pConn.getConnection());
              pConn.setConnection(newConnection());
              pConn.setBusy(false);
    * Closes all of the connections and empties the connection
    * pool. Once this method has been called, the createPool()
    * method can again be called.
    public synchronized void closeConnections() throws SQLException
    //make sure that createPool has been called
    if (connections == null)
    return; //the pool has not been created
    PooledConnection pConn = null;
    Enumeration enum = connections.elements();
    while (enum.hasMoreElements())
    pConn = (PooledConnection)enum.nextElement();
    if (!pConn.isBusy())
    wait(5000); //wait 5 seconds
    closeConnection(pConn.getConnection());
    connections.removeElement(pConn);
    connections = null;
    * Closes a database connection.
    * @param conn Database connection to close.
    private void closeConnection(Connection conn)
    try
    conn.close();
    catch (SQLException e)
    * Sleeps for a specified number of milliseconds.
    *@param mSeconds Number of seconds to sleep.
    private void wait(int mSeconds)
    try
    Thread.sleep(mSeconds);
    catch (InterruptedException e)
    * Inner class encapsulating the properties of a pooled
    * connection object. These properties include a JDBC database
    * connection object and a flag indicating whether or not the
    * database object is currently in use (busy).
    class PooledConnection
    Connection connection = null;
    boolean busy = false;
    public PooledConnection(Connection connection)
    this.connection = connection;
    public Connection getConnection()
    return connection;
    public void setConnection(Connection connection)
    this.connection = connection;
    public boolean isBusy()
    return busy;
    public void setBusy(boolean busy)
    this.busy = busy;
    }thank you

    If you are using connection pooling then those places in your code where you used to close a connection need to be replaced by code that returns the connection to the pool.
    It's the job of the pool implementation to decide whether or not connections need closing (or opening), depending on the rules you set up for the pooler.

Maybe you are looking for

  • Problem regional formats setting

    Hi all, in my Dashboard I am using the SDK KPI Tile to show some values (but this problem occurs in others components too). In the initial view of my datasource I selected scaling factor 1,000. The KPI Tile should display the value 300 000 as 300 T€.

  • Cisco CRS Historical Reports error "run time error 364 application defined or object-defined error"

    Hi All, we are getting an error when we open historical report

  • How to back up from Photoshop Elements 8 to Revel

    My photos were backed up from PSE 8 to the Elements backup on photoshop.com.  Now they have been automatically moved to Revel.  How do I back up more photos from PSE 8 to Revel?  When I try to do a backup from PSE 8 it connects to the old photoshop.c

  • Can I reinstall MS explorer?

    I have a website that really wants IE. The bad news is that I trashed it as soon as I got this machine. How can I find the download to reinstall it?

  • Buffer Paramater Settings

    Hi Experts, In our Development and Production systems , we have been Observed that , Lot of Swaps at Program Buffer (PXA) Especially Development systems .. Some times we were experianced Lot of swaps  Export and Import Buffers also When we saw at ST0