• RELEVANCY SCORE 3.91

    DB:3.91:Connection ==Null And Connection Is Closed, Difference sk





    Hi experts,

    I wonder what are the differences between "Connection==null" and "Connection is closed"?

    I closed a connection on one JSP page after a bean has retrieved data. Then, on the same page I call another bean to connect to the database. Because the Connection object has been created earlier, therefore Connection is not NULL, but it is closed. So, the second bean has to initiate another connection(if I knew how to test the "closed" status)
    Is it true that if the Connection is closed, then it should become null?

    I think I must have make quite a few mistakes in above statement:). Please help. Thanks a lot.

    DB:3.91:Connection ==Null And Connection Is Closed, Difference sk

    connection.isClosed() will tell you if the connection object is closed or not. If it is closed, then the connection object can be dropped because you will not be able to create any new statements from that connection object. Just recreate another connection to use when this occurs.

  • RELEVANCY SCORE 3.82

    DB:3.82:Closing Connection To Db After Redirect 8k





    Hi to everyone!
    I have this code below and I wanted to know if my database connection is actually going to get closed. Does the redirect prevent my connection from being properly closed?
    Thanx!

    %
    Connection conn = null;
    try {
    conn = dataSource.getConnection();

    response.sendRedirect("gohere.jsp"); %

    Some html

    % } catch (Exception e) {
    // some error log
    } finally {
    conn.close();
    } %

    DB:3.82:Closing Connection To Db After Redirect 8k

    @Op. Your jsp page shouldn't connect directly to the database.

  • RELEVANCY SCORE 3.80

    DB:3.80:Closing Data Connection cj





    My program connects to a SQL database that I connect to on port 23 because outgoing connections to port 3306 are blocked from work.

    In my Database class I have this:
    public static Connection sqlConnection ()
    {
    Connection connection = null;
    String serverName = null;
    String mydatabase = null;
    String url = null;
    String dbuser = null;
    String dbpass = null;
    String port = "23";
    try
    {
    System.out.println ("Trying port " + port + "...");
    String driverName = "com.mysql.jdbc.Driver";
    Class.forName (driverName);

    serverName = "server_address";
    mydatabase = "database";
    url = "jdbc:mysql://" + serverName + ":" + port + "/" + mydatabase;
    //url = "jdbc:mysql://" + serverName + "/" + mydatabase; // a JDBC url
    dbuser = "user";
    dbpass = "pass";
    connection = DriverManager.getConnection (url, dbuser, dbpass);
    }
    catch (SQLException e)
    {
    // Could not connect to the database
    JOptionPane.showMessageDialog (null,"bUnable to connect to the database./b\n\nPlease check your network connection."
    + "Contact the administrator if the problem persists.", "Connection Error",
    JOptionPane.ERROR_MESSAGE);
    System.out.println ("Error: " + e.getMessage ());
    }
    catch (ClassNotFoundException e)
    {
    // Could not find the database driver
    System.out.println ("Error: " + e.getMessage ());
    JOptionPane.showMessageDialog (null,"Could not find the database driver.", "Connection Error",
    JOptionPane.ERROR_MESSAGE);
    }
    return connection;
    }From my other classes I call the connection by using:
    Connection connection = Database.sqlConnection ();and close my connection with:
    connection.close (); System.out.println ("Connection closed.");This way in my console I can see when the connection is opening and closing.
    run:
    java.awt.Dimension[width=0,height=0]
    Trying port 23...
    6
    Tristan Lee
    tristan.lee@fedex.com
    1
    2
    0
    2
    0
    Connection closed.
    Trying port 23...
    Connection closed.
    Trying port 23...
    Connection closed.
    Trying port 23...
    Connection closed.
    Trying port 23...
    Connection closed.When I use netstat to view my current connections, they still show a connection that, to me, looks like a connection that's staying open until it simply times out.
    [tristan@tristan ~]$ netstat
    Active Internet connections (w/o servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State
    tcp 0 115 192.168.1.110:59820 205.188.9.53:aol ESTABLISHED
    tcp 0 0 192.168.1.110:39436 64.12.31.96:aol ESTABLISHED
    tcp 0 280 192.168.1.110:60949 cs8.msg.dcn.yahoo.com:mmcc ESTABLISHED
    tcp 0 70 192.168.1.110:40097 by1msg5276706.phx.gbl:msnp ESTABLISHED
    tcp 0 0 192.168.1.110:49336 oam-m07b.blue.aol.com:aol ESTABLISHED
    tcp 0 0 ::ffff:192.168.1.110:43641 cpe-24-95-42-77.colu:telnet TIME_WAIT
    tcp 0 0 ::ffff:192.168.1.110:60616 cpe-24-95-42-77.colu:telnet TIME_WAIT
    tcp 0 0 ::1:36998 ::1:38330 TIME_WAIT
    tcp 0 0 ::ffff:192.168.1.110:51197 cpe-24-95-42-77.colu:telnet TIME_WAIT
    tcp 0 0 ::ffff:192.168.1.110:53461 cpe-24-95-42-77.colu:telnet TIME_WAIT
    tcp 0 0 ::ffff:192.168.1.110:37406 cpe-24-95-42-77.colu:telnet TIME_WAITWhy aren't my connections being closed?

    DB:3.80:Closing Data Connection cj

    Better than what? I don't know what problem you're trying to solve so I can't answer that, but IMHO you should close those other items immediately you are done with them. If that's what this code does, good. It has no bearing on the TIME_WAIT: only Connection.close() would affect that. There's no sensible way to avoid the TIME_WAIT delay (there are stupid/insecure ways), and if you're using a connection pool there is probably a further delay in there as well.

  • RELEVANCY SCORE 3.73

    DB:3.73:Re: Session Is Inactive In Oracle Even Though Jdbc Connection Is Closed 1s


    after properly closing the connections ,try to set all the Connection objects and ResulSet objects to null (force to null) , most likely these inactive sessions will dissapear.

    might be a java garbage collection issue?

    anyhow. I managed to get most of these inactive sessions to disappear. although I am using a Servlet. some of them are still not closed

    Regards

    DB:3.73:Re: Session Is Inactive In Oracle Even Though Jdbc Connection Is Closed 1s

    We are not using the connection pool as our application is a standalone application. We are closing the JDBC connection in JAVA but still the session is showing as INACTIVE in oracle. When we close the application then all the inactive sessions are removed from the oracle. Please let us know why the sessions are not being removed when we close the JDBC connection.

  • RELEVANCY SCORE 3.70

    DB:3.70:Going On 6 Weeks! Still Having Issues! cf



    12:13am 9/13/2013 - Connection Lost12:23am 9/13/2013 - Connection Reestablished06:56pm 9/13/2013 - Connection Lost07:06pm 9/13/2013 - Connection Reestablished03:01am 9/14/2013 - Connection Lost03:11am 9/14/2013 - Connection Reestablished03:59pm 9/14/2013 - Connection Lost04:09pm 9/14/2013 - Connection Reestablished04:10pm 9/14/2013 - Connection Lost04:14pm 9/14/2013 - Connection Reestablished04:19pm 9/14/2013 - Connection Lost04:23pm 9/14/2013 - Connection Reestablished07:36pm 9/14/2013 - Connection Lost07:46pm 9/14/2013 - Connection Reestablished07:53pm 9/14/2013 - Connection Lost08:03pm 9/14/2013 - Connection Reestablished08:08pm 9/14/2013 - Connection Lost08:18pm 9/14/2013 - Connection Reestablished08:23pm 9/14/2013 - Connection Lost08:32pm 9/14/2013 - Connection Reestablished08:33pm 9/14/2013 - Connection Lost08:42pm 9/14/2013 - Connection Reestablished08:43pm 9/14/2013 - Connection Lost08:51pm 9/14/2013 - Connection Reestablished08:51pm 9/14/2013 - Connection Lost08:52pm 9/14/2013 - Connection Reestablished10:11pm 9/14/2013 - Connection Lost10:21pm 9/14/2013 - Connection Reestablished04:32pm 9/15/2013 - Connection Lost04:42pm 9/15/2013 - Connection Reestablished05:51pm 9/16/2013 - Connection Lost06:01pm 9/16/2013 - Connection Reestablished12:13am 9/13/2013 - Connection Lost12:23am 9/13/2013 - Connection Reestablished06:56pm 9/13/2013 - Connection Lost07:06pm 9/13/2013 - Connection Reestablished03:01am 9/14/2013 - Connection Lost03:11am 9/14/2013 - Connection Reestablished03:59pm 9/14/2013 - Connection Lost04:09pm 9/14/2013 - Connection Reestablished04:10pm 9/14/2013 - Connection Lost04:14pm 9/14/2013 - Connection Reestablished04:19pm 9/14/2013 - Connection Lost04:23pm 9/14/2013 - Connection Reestablished07:36pm 9/14/2013 - Connection Lost07:46pm 9/14/2013 - Connection Reestablished07:53pm 9/14/2013 - Connection Lost08:03pm 9/14/2013 - Connection Reestablished08:08pm 9/14/2013 - Connection Lost08:18pm 9/14/2013 - Connection Reestablished08:23pm 9/14/2013 - Connection Lost08:32pm 9/14/2013 - Connection Reestablished08:33pm 9/14/2013 - Connection Lost08:42pm 9/14/2013 - Connection Reestablished08:43pm 9/14/2013 - Connection Lost08:51pm 9/14/2013 - Connection Reestablished08:51pm 9/14/2013 - Connection Lost08:52pm 9/14/2013 - Connection Reestablished10:11pm 9/14/2013 - Connection Lost10:21pm 9/14/2013 - Connection Reestablished04:32pm 9/15/2013 - Connection Lost04:42pm 9/15/2013 - Connection Reestablished05:51pm 9/16/2013 - Connection Lost06:01pm 9/16/2013 - Connection Reestablished06:03pm 9/16/2013 - Connection Lost06:03pm 9/16/2013 - Connection Reestablished06:05pm 9/16/2013 - Connection Lost06:07pm 9/16/2013 - Connection Reestablished06:10pm 9/16/2013 - Connection Lost06:11pm 9/16/2013 - Connection Reestablished07:14pm 9/16/2013 - Connection Lost07:16pm 9/16/2013 - Connection Reestablished02:34pm 9/17/2013 - Connection Lost05:47pm 9/17/2013 - Connection Lost06:06pm 9/17/2013 - Connection Lost10:18pm 9/17/2013 - Connection Lost10:28pm 9/17/2013 - Connection Reestablished03:21pm 9/18/2013 - Connection Lost05:06pm 9/18/2013 - Connection Lost05:16pm 9/18/2013 - Connection Reestablished06:26pm 9/18/2013 - Connection Lost06:36pm 9/18/2013 - Connection Reestablished06:37pm 9/18/2013 - Connection Lost06:47pm 9/18/2013 - Connection Reestablished06:49pm 9/18/2013 - Connection Lost06:59pm 9/18/2013 - Connection Reestablished07:33pm 9/18/2013 - Connection Lost07:43pm 9/18/2013 - Connection Reestablished08:06pm 9/18/2013 - Connection Lost08:16pm 9/18/2013 - Connection Reestablished10:08pm 9/18/2013 - Connection Lost10:18pm 9/18/2013 - Connection Reestablished11:12pm 9/18/2013 - Connection Lost11:22pm 9/18/2013 - Connection Reestablished11:23pm 9/18/2013 - Connection Lost11:28pm 9/18/2013 - Connection Reestablished08:32pm 9/19/2013 - Connection Lost08:42pm 9/19/2013 - Connection Reestablished09:11pm 9/19/2013 - Connection Lost09:14pm 9/19/2013 - Connection Reestablished10:39pm 9/19/2013 - Connection Lost09:41pm 9/20/2013 - Connection Lost09:45pm 9/20/2013 - Connection Reestablished09:51pm 9/20/2013 - Connection Lost10:01pm 9/20/2013 - Connection Reestablished08:24am 9/22/2013 - Connection Lost08:24am 9/22/2013 - Connection Reestablished08:07pm 9/23/2013 - Connection Lost08:17pm 9/23/2013 - Connection Reestablished08:38pm 9/23/2013 - Connection Lost08:48pm 9/23/2013 - Connection Reestablished08:56pm 9/23/2013 - Connection Lost09:04pm 9/23/2013 - Connection Reestablished10:01pm 9/23/2013 - Connection Lost10:11pm 9/23/2013 - Connection Reestablished10:15pm 9/23/2013 - Connection Lost10:25pm 9/23/2013 - Connection Reestablished10:31pm 9/23/2013 - Connection Lost10:41pm 9/23/2013 - Connection Reestablished08:55pm 9/24/2013 - Connection Lost09:00pm 9/24/2013 - Connection Reestablished06:30pm 9/28/2013 - Connection Lost06:32pm 9/28/2013 - Connection Reestablished06:36pm 9/28/2013 - Connection Lost06:38pm 9/28/2013 - Connection Reestablished06:52pm 9/28/2013 - Connection Lost06:54pm 9/28/2013 - Connection Reestablished06:58pm 9/28/2013 - Connection Lost07:08pm 9/28/2013 - Connection Reestablished09:19pm 9/28/2013 - Connection Lost09:21pm 9/28/2013 - Connection Reestablished09:33pm 9/28/2013 - Connection Lost09:35pm 9/28/2013 - Connection Reestablished07:04pm 9/30/2013 - Connection Lost07:06pm 9/30/2013 - Connection Reestablished05:23pm 10/1/2013 - Connection Lost05:28pm 10/1/2013 - Connection Reestablished05:30pm 10/1/2013 - Connection Lost05:32pm 10/1/2013 - Connection Lost09:27pm 10/1/2013 - Connection Lost09:57pm 10/1/2013 - Connection Lost09:59pm 10/1/2013 - Connection Reestablished07:47pm 10/2/2013 - Connection Lost07:57pm 10/2/2013 - Connection Reestablished07:58pm 10/2/2013 - Connection Lost08:08pm 10/2/2013 - Connection Reestablished08:08pm 10/4/2013 - Connection Lost08:10pm 10/4/2013 - Connection Reestablished08:21pm 10/4/2013 - Connection Lost08:22pm 10/4/2013 - Connection Reestablished08:24pm 10/4/2013 - Connection Lost08:25pm 10/4/2013 - Connection Reestablished08:26pm 10/4/2013 - Connection Lost08:26pm 10/4/2013 - Connection Reestablished08:29pm 10/4/2013 - Connection Lost08:29pm 10/4/2013 - Connection Reestablished08:31pm 10/4/2013 - Connection Lost08:32pm 10/4/2013 - Connection Reestablished08:35pm 10/4/2013 - Connection Lost08:45pm 10/4/2013 - Connection Reestablished06:42pm 10/7/2013 - Connection Lost06:44pm 10/7/2013 - Connection Reestablished06:49pm 10/7/2013 - Connection Lost06:59pm 10/7/2013 - Connection Reestablished09:04pm 10/7/2013 - Connection Lost09:06pm 10/7/2013 - Connection Reestablished09:07pm 10/7/2013 - Connection Lost09:08pm 10/7/2013 - Connection Reestablished09:12pm 10/7/2013 - Connection Lost09:13pm 10/7/2013 - Connection Reestablished08:09am 10/8/2013 - Multiple Modem Resets x208:13am 10/8/2013 - Connection Reestablished08:18am 10/8/2013 - Modem Reset08:25am 10/8/2013 - Connection Reestablished05:48pm 10/10/2013 - Connection Lost05:50pm 10/10/2013 - Connection Reestablished09:25pm 10/12/2013 - Connection Lost09:25pm 10/12/2013 - Connection Reestablished04:53pm 10/15/2013 - Connection Lost04:55pm 10/15/2013 - Connection Reestablished05:10pm 10/15/2013 - Connection Lost05:15pm 10/15/2013 - Connection Reestablished05:30pm 10/15/2013 - Connection Lost05:40pm 10/15/2013 - Connection Reestablished05:46pm 10/15/2013 - Connection Lost05:56pm 10/15/2013 - Connection Reestablished

    Things Done
    Swaped out for New Purchased Modem Comcast Rented ModemSwaped out almost everything thing possible outside and at nodes.Swaped out bad suppressedwhite circle "washer" for connector in attic6 Techs in the home, though only 1 tech ever checked my ran lines (Doing their job properly and he was a Business Tech that I got as a special visit.)Over 20+ visits outside my house from multiple line techs.Took down whole subdivision twice to look into my issue.Took down 4 customers within subdivision due to their noise back into line.Spoken with Comcast on the phone over 500 minutesCalled Comcast over 50 timesSpoken to 2 Line Techs, 2 Local Superviors, Multiple Make it Right department Supervisors, CorperateExecutive Support, Denver Support, Countless Make It Right Agents.Have over 10 Direct #'s and names of people I shouldn't have.3 ESL tickets open, 2 closed without confirmation issue is fixed and only on their own assumption it was.Cost Comcast $1000+ in labor, support and on call tech services.

    DB:3.70:Going On 6 Weeks! Still Having Issues! cf


    Didn't say you were Comcast. And the traceroute was a seperate thought altogether. yes the historcal plot would confirm if the modem had sync all those times you timed out trying to reach their server. Bottom line is, I was just trying to pinpoint the real issue, the modem or the server you are trying to connect to.

  • RELEVANCY SCORE 3.66

    DB:3.66:One Short Logical Question- What Happens At Con.Close? ms


    Ok it's eays to define a connection-pool
    in the bea console and to assign a JNDI-name.
    For me the important question is the con.close
    attribut.
    Is the connection-been closed?
    If yes how do I have to programm that the connection is given back to a connection-pool and not closed?
    This question is elementary for us.
    Thanks!

    Connection con = datasource.getConnection();
    ....
    con.close();

    DB:3.66:One Short Logical Question- What Happens At Con.Close? ms

    Christian Strong wrote:

    Ok it's eays to define a connection-pool
    in the bea console and to assign a JNDI-name.
    For me the important question is the con.close
    attribut.
    Is the connection-been closed?
    If yes how do I have to programm that the connection is given back to a connection-pool and not closed?
    This question is elementary for us.
    Thanks!

    Connection con = datasource.getConnection();
    ....
    con.close();You should close the connection. We want standard JDBC coding. When
    you close a pool connection, we know it, and we use that signal to
    know you're done with the pooled connection, so we can put it back
    into the pool for the next user.
    thanks
    Joe

  • RELEVANCY SCORE 3.62

    DB:3.62:Connection Closed Error When Using Binding 38


    Hi,
    I am running WLS 7.0.1.0 with TopLink 9.0.3 as the persistence layer for
    EJB1.1 beans with CMP. When I use bind parameters I get a connection
    closed exception the second time the query is invoked.

    This is the query I see on server console when it is invoked the first
    time. This query returns the expected results:
    -------
    [TopLink]: ServerSession(91035)--Connection(887977)--SELECT
    LAST_CHANGED_ID, ALIAS_NAME, REFERENCE_ID, ALIAS_TYPE,
    REFERENCE_QUAL_CODE, ALIAS_QUAL_CODE, TLINK_VERSION, LAST_CHANGED_DATE,
    DELETED_FLAG FROM GLOBAL_ALIAS WHERE (DELETED_FLAG =
    ?)
    bind = [N]
    --------

    However, when I run the same query the second time I get the
    following error:
    ----------
    [TopLink Error]: ServerSession(91035)--Connection(0)--null--EXCEPTION
    [TOPLINK-4002] (TopLink (WLS CMP) - 9.0.3.1 (Build 426)):
    oracle.toplink.exceptions.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: Connection has already
    been closed.
    INTERNAL EXCEPTION: java.sql.SQLException: Connection has already been
    closed.
    ERROR CODE: 0
    ----------

    Then when I execute the query again the third time I see the following
    sql query and it
    works fine.
    ---
    [TopLink]: ServerSession(91035)--Connection(889939)--SELECT
    LAST_CHANGED_ID, ALI
    AS_NAME, REFERENCE_ID, ALIAS_TYPE, REFERENCE_QUAL_CODE, ALIAS_QUAL_CODE,
    TLINK_V
    ERSION, LAST_CHANGED_DATE, DELETED_FLAG FROM GLOBAL_ALIAS WHERE
    (DELETED_FLAG =
    ?)
    bind = [N]
    ----

    Does WebLogic close its connection to the database pool after each
    transaction? Is there something that needs to be done on the database?
    Any help will be greatly appreciated.

    Thanks in Advance,
    Anup.

    DB:3.62:Connection Closed Error When Using Binding 38

    Hi. Our transaction coordinator does prevent any code from using a
    pool connection that was part of a transaction, after that transaction
    ends. Applications must obtain and use pool connections totally
    within or totally outside a UserTransaction, to prevent unintended
    or unclear interference of the transaction contents and/or locking.

    Joe Weinstein

    PS: Also post any followup to the ejb newsgroup, because this issue
    is more at the EJB level than JDBC.

    Anup Vachali wrote:

    Hi,
    I am running WLS 7.0.1.0 with TopLink 9.0.3 as the persistence layer for
    EJB1.1 beans with CMP. When I use bind parameters I get a connection
    closed exception the second time the query is invoked.

    This is the query I see on server console when it is invoked the first
    time. This query returns the expected results:
    -------
    [TopLink]: ServerSession(91035)--Connection(887977)--SELECT
    LAST_CHANGED_ID, ALIAS_NAME, REFERENCE_ID, ALIAS_TYPE,
    REFERENCE_QUAL_CODE, ALIAS_QUAL_CODE, TLINK_VERSION, LAST_CHANGED_DATE,
    DELETED_FLAG FROM GLOBAL_ALIAS WHERE (DELETED_FLAG =
    ?)
    bind = [N]
    --------

    However, when I run the same query the second time I get the
    following error:
    ----------
    [TopLink Error]: ServerSession(91035)--Connection(0)--null--EXCEPTION
    [TOPLINK-4002] (TopLink (WLS CMP) - 9.0.3.1 (Build 426)):
    oracle.toplink.exceptions.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: Connection has already
    been closed.
    INTERNAL EXCEPTION: java.sql.SQLException: Connection has already been
    closed.
    ERROR CODE: 0
    ----------

    Then when I execute the query again the third time I see the following
    sql query and it
    works fine.
    ---
    [TopLink]: ServerSession(91035)--Connection(889939)--SELECT
    LAST_CHANGED_ID, ALI
    AS_NAME, REFERENCE_ID, ALIAS_TYPE, REFERENCE_QUAL_CODE, ALIAS_QUAL_CODE,
    TLINK_V
    ERSION, LAST_CHANGED_DATE, DELETED_FLAG FROM GLOBAL_ALIAS WHERE
    (DELETED_FLAG =
    ?)
    bind = [N]
    ----

    Does WebLogic close its connection to the database pool after each
    transaction? Is there something that needs to be done on the database?
    Any help will be greatly appreciated.

    Thanks in Advance,
    Anup.

  • RELEVANCY SCORE 3.60

    DB:3.60:I Get This Error The Underlying Connection Was Closed The Connection Was Closed Unexpectedly. When I Call Webservicewcf. 8f


    [System.Net.WebException] {"The underlying connection was closed: The connection was closed unexpectedly."}
    Data {System.Collections.ListDictionaryInternal}
    HelpLink null
    Hresult -2146233079
    InnerException null
    Message The underlying connection was closed: The connection was closed unexpectedly.
    Response null
    Source System
    StackTrace at System.Net.HttpWebRequest.GetResponse()
    at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
    Status System.Net.WebExceptionStatus.ConnectionClosed
    TargetSite {System.Net.WebResponse GetResponse()}

    Method that I call must return List of my object but it throw this error. Please give solutions for me.

    DB:3.60:I Get This Error The Underlying Connection Was Closed The Connection Was Closed Unexpectedly. When I Call Webservicewcf. 8f

    Hi Kaiser,

    Thank you for the reply.

    I am glad that the issue is fixed.

    For assistance with issues related to Windows feel free to post on Microsoft Community.

  • RELEVANCY SCORE 3.60

    DB:3.60:Closing Resultset And Statements dd


    Hi!

    I just got told that I do not need to close my resultsets and statements in the code, it it enough that the connection are closed. Is this correct?

    Eg:

    public method myMethod() {
    ResultSet rs = null;
    Statement sqlStmt = null;

    try {
    ....
    query = "SELECT something";

    rs = sqlStmt.executeQuery(query);

    if (rs.next())
    do something...

    // close rs
    if (rs != null) {
    rs.close();
    rs = null;
    sqlStmt.close();
    sqlStmt = null;
    }

    } // end try

    catch (errors)...

    finally {
    if (con != null) { -- Is this line enough to close everything and release connections?
    try {
    con.close();
    }
    catch (exception)...
    }
    } // end finally

    DB:3.60:Closing Resultset And Statements dd

    No, you have to explicitly close the resultset, statement, and connection in order to release resources allocated to each of them. Closing the connection will only relase the connection, not the resultset, and statement.

    you could do all of it in the finally as follows:

    finally {

    try {

    if (rs != null) {
    rs.close();
    }
    if (stmt != null) {
    stmt.close();
    }
    if (conn != null) {
    conn.close();
    }

    } catch (Exception e) {}

    }

    also there is no need to set rs = null, stmt = null after the close()

  • RELEVANCY SCORE 3.59

    DB:3.59:Re: Session Beans - Beating A Dead Horse - Please Help? sa


    When the session kills the bean, the connection is closed. Here's that code from the bean (it's checking when the session is unloading):

    public void valueUnbound(HttpSessionBindingEvent event) {
    try {
    connection.close();
    }
    catch (SQLException e) { connection = null; }
    finally {
    connection = null;
    }
    }

    DB:3.59:Re: Session Beans - Beating A Dead Horse - Please Help? sa

    The usual solution to these resource constraints isto
    use Pooled connections. A good rule of thumb isNEVER
    KEEP A STATEMENT OPEN BETWEEN REQUESTS. Thisrequires
    careful exception handling to close open statements
    and connections.If that is the case, then I'll need to code a
    connection pool. I just know that every single page
    is querying the database and that connecting to the
    database is probably the slowest part of the
    application. But...now that you mention it...you're
    probably right about keeping that connection alive
    when there are limited connections available. I'll go
    about writing a connection pool or grab one out of a
    book or website and see what I can do with it. I was
    actually avoiding the use of the pool because it seems
    like it would add overhead to the server/database, but
    maybe it's the better way?

    JonTake a look at the JDBC Optional Package API. Correctly coding a Connection Pool is no small task. And yes keeping the pooled connections open to save logging-in to the database repeatedly is part of the motivation.

    http://java.sun.com/products/jdbc/jdbc20.stdext.javadoc/

    The ConnectionPoolDataSource will return a PooledConnection. This stuff is built into the JDBC-ODBC Bridge Driver in JDK 1.4. Other JDBC drivers also support it. Look at the examples in 1.4

    http://java.sun.com/j2se/1.4/docs/guide/jdbc/getstart/bridge.html

  • RELEVANCY SCORE 3.53

    DB:3.53:Loading Dbwsclient.Jar 87


    Having problems while loading dbwsclient.jar.

    loadjava -u user/password@dev -r -v -f -noverify -genmissing C:\temp\webservices2\sqlj\lib\dbwsclient.jar

    This user has all JAVA* roles and create any proc, create any table.

    Get following type of message over and over --- for all classes.

    generating: HTTPClient/RoResponse
    creating : class HTTPClient/RoResponse
    loading : class HTTPClient/RoResponse
    Error while getLoadLOB null
    Closed Connection
    Error while deleting MD5 of HTTPClient/RoResponse
    Closed Connection
    generating: java/util/Comparator
    creating : class java/util/Comparator
    loading : class java/util/Comparator
    Error while getLoadLOB null
    Closed Connection
    Error while deleting MD5 of java/util/Comparator
    Closed Connection
    generating: java/awt/Panel
    creating : class java/awt/Panel
    loading : class java/awt/Panel
    Error while getLoadLOB null
    Closed Connection
    Error while deleting MD5 of java/awt/Panel
    Closed Connection

    Thanks for advice.

    DB:3.53:Loading Dbwsclient.Jar 87

    Hi,

    Have you followed the instructions and troubleshooting suggestions in the Callout Users Guide @http://www.oracle.com/technology/sample_code/tech/java/jsp/callout_users_guide.htm?

    Kuassi http://db360.blogspot.com

  • RELEVANCY SCORE 3.51

    DB:3.51:Xsql-Servlet/Db-Connections ck


    Hello,
    i4m using the XSQL-Servlet (1.0.4.3) within Tomcat (3.2.1) and the connection-pooling-part of the XSQLConfig.xml is as follows:

    connection-pool
    initial2/initial
    increment1/increment
    timeout-seconds60/timeout-seconds
    dump-allowedyes/dump-allowed
    /connection-pool

    The problem is that once a DB-Connection is created it is never closed again. So the number of connections grows on and on.

    Who can help me to find out what4s wrong?

    Is it possible to set a maximum number of db-connections somewhere (not in the DB itself)?

    Thank you.
    null

    DB:3.51:Xsql-Servlet/Db-Connections ck

    If you request the same XSQL page over and over, and monitor the results of:

    SELECT COUNT(*) FROM V$SESSION

    from a SQL*Plus session logged on as SYS, are you saying that the number of connections just keeps growing?

    You might try the latest 9.0.2B release of the XDK to see if any of the fixes included in that release fix it, but the best of my recollection was that XSQL 1.0.4.3 had no connection leakage issues.

  • RELEVANCY SCORE 3.49

    DB:3.49:Cannot Get Local Connection, No Available Resource, Wait-Time Expired zx


    Hi Friends,

    Please answer my queries below.
    Thanks and Regards

    Busincess Requirement
    ---------------------
    I have to display a particular set of rows in a dashboard or screen, and it is being refreshed every 1 minute, also user can update from that screen displayed values.

    The below program extracts some data from database and passes to the front end through a collection where it is being displayed.

    Code Logic Flow
    ---------------
    1. CockpitAction calls CockpitOraDAO for database results
    2. CockpitOraDAO is a singleton class.
    3. After getting the CockpitOraDAO object, the action will then call the getLabAreaCockpitDetails() method.
    getLabAreaCockpitDetails will
    - Get the Connetion from the OracleConnectionManager class (It is a plain class with getPooledConnection() and releaseConnection() methods).
    - Execute the query and put the result to a collection
    - close the connection
    - return result to the calling action.
    This getLabAreaCockpitDetails() are called around once in every 1 minute

    So, I believe everytime a call is made to action for cockpit display, it will take the existing object of the CockpitOraDAO class and make a call to database. i.e there will be only one object of CockpitOraDAO reside in application server at any particular interval of time.

    My Understandings
    -----------------
    1. Only 1 object of CockpitOraDAO will reside in application server (provided it is not user longer and garbage collected) at a particular instance.
    2. Many objects of Connection will be created and destroyed.(Each time the getLabAreaCockpitDetails() method is called, we will get one connection from connection pool and in finally the Connection will be released to connection pool).

    My Problems
    -----------
    It is showing the "Cannot get Local Connection, No available resource, Wait-time expired"
    after running around 1 full day.

    My doubts
    ---------
    1. Can anybody say why I get this error ?
    2. There may be some connections are not closed. But I have checked at finally block, the status of the connection is closed after calling this method.

    3. There may be some problem due to the singleton instane of CockpitOraDAO, Is it affecting performance ?

    4. Is it valid that I have to make CockpitOraDAO as Singleton ?

    public class CockpitOraDAO extends DAOAdaptor //implements BISample
    {
    private static CockpitOraDAO instance=null;
    private static boolean debug = true;

    /*
    * The below method will be used to provide the singleton intance of the CockpitOraDAO object.
    */
    public static CockpitOraDAO getInstance()
    {
    if (instance == null)
    {
    synchronized (CockpitOraDAO.class)
    {
    if (instance == null)
    {
    instance = new CockpitOraDAO();
    }
    }
    }

    return instance;
    }

    /*
    * The below method will be used to get the cockpit details of the lab area.
    * This will return collecton of sample details for the specific lab.
    */

    public Collection getLabAreaCockpitDetails(Collection prevCockpitDetailList,Collection filterCriteria) throws Exception
    {
    if(debug)
    System.out.println("Inside CockpitOraDAO::getLabAreaCockpitDetails() method");
    Connection conn = null;
    boolean sampleExists = false;
    PreparedStatement pstmt=null;
    ResultSet rs=null;
    String returnStr=null;
    StringBuffer sqlQuery = null;
    String tempComment1=null, tempComment2=null;
    LabCockpitDO labc=null;
    LabCockpitDO labc2=null;
    Collection resultList=null, manCommentList=null, labCommentList=null, labCompCommentList=null;
    ArrayList result1List=null, prevCockpitDetail1List=null,filterList = null;
    OracleConnectionManager manager = null;
    boolean flag = false;

    try
    {
    labc2 = new LabCockpitDO();
    prevCockpitDetail1List = (ArrayList) prevCockpitDetailList;
    sqlQuery = new StringBuffer();

    sqlQuery.append("select s.sample_sample_no sample_no, s.sample_inspection_lot_no inspection_lot_no,");
    ....
    ....

    manager = new OracleConnectionManager();
    conn = manager.getPooledConnection("myDS");
    pstmt = conn.prepareStatement(sqlQuery.toString());
    if(debug)
    System.out.println("Query********"+sqlQuery.toString());
    rs = pstmt.executeQuery();
    ....
    ....
    }
    catch(Exception e)
    {
    //System.out.println(e);
    throw e;
    }
    finally
    {
    try
    {
    manager.releaseConnection("myDS");
    if(debug)
    System.out.println("Connection Status Closed=true/ Open=false=["+conn.isClosed()+"]");

    if(conn!=null || !conn.isClosed())
    conn.close();

    if(debug)
    System.out.println("Connection Status After Closing Connection Closed=true/ Open=false=["+conn.isClosed()+"]");
    if(rs != null)
    rs.close();
    if(pstmt != null)
    pstmt.close();

    conn = null;
    pstmt=null;
    rs = null;

    sqlQuery=null;
    returnStr=null;
    labc=null;
    labc2=null;
    manCommentList=null;
    labCommentList=null;
    labCompCommentList=null;
    tempComment1=null;
    tempComment2=null;
    resultList=null;
    prevCockpitDetailList=null;
    prevCockpitDetail1List=null;
    }
    catch(Exception e)
    {
    //System.out.println("Unable to Release Connection ="+e);
    throw e;
    }

    }
    //if(debug)
    //System.out.println(resultList);
    return result1List;
    }

    DB:3.49:Cannot Get Local Connection, No Available Resource, Wait-Time Expired zx

    Hi Friends,

    Please answer my queries below.
    Thanks and Regards

    Busincess Requirement
    ---------------------
    I have to display a particular set of rows in a dashboard or screen, and it is being refreshed every 1 minute, also user can update from that screen displayed values.

    The below program extracts some data from database and passes to the front end through a collection where it is being displayed.

    Code Logic Flow
    ---------------
    1. CockpitAction calls CockpitOraDAO for database results
    2. CockpitOraDAO is a singleton class.
    3. After getting the CockpitOraDAO object, the action will then call the getLabAreaCockpitDetails() method.
    getLabAreaCockpitDetails will
    - Get the Connetion from the OracleConnectionManager class (It is a plain class with getPooledConnection() and releaseConnection() methods).
    - Execute the query and put the result to a collection
    - close the connection
    - return result to the calling action.
    This getLabAreaCockpitDetails() are called around once in every 1 minute

    So, I believe everytime a call is made to action for cockpit display, it will take the existing object of the CockpitOraDAO class and make a call to database. i.e there will be only one object of CockpitOraDAO reside in application server at any particular interval of time.

    My Understandings
    -----------------
    1. Only 1 object of CockpitOraDAO will reside in application server (provided it is not user longer and garbage collected) at a particular instance.
    2. Many objects of Connection will be created and destroyed.(Each time the getLabAreaCockpitDetails() method is called, we will get one connection from connection pool and in finally the Connection will be released to connection pool).

    My Problems
    -----------
    It is showing the "Cannot get Local Connection, No available resource, Wait-time expired"
    after running around 1 full day.

    My doubts
    ---------
    1. Can anybody say why I get this error ?
    2. There may be some connections are not closed. But I have checked at finally block, the status of the connection is closed after calling this method.

    3. There may be some problem due to the singleton instane of CockpitOraDAO, Is it affecting performance ?

    4. Is it valid that I have to make CockpitOraDAO as Singleton ?

    public class CockpitOraDAO extends DAOAdaptor //implements BISample
    {
    private static CockpitOraDAO instance=null;
    private static boolean debug = true;

    /*
    * The below method will be used to provide the singleton intance of the CockpitOraDAO object.
    */
    public static CockpitOraDAO getInstance()
    {
    if (instance == null)
    {
    synchronized (CockpitOraDAO.class)
    {
    if (instance == null)
    {
    instance = new CockpitOraDAO();
    }
    }
    }

    return instance;
    }

    /*
    * The below method will be used to get the cockpit details of the lab area.
    * This will return collecton of sample details for the specific lab.
    */

    public Collection getLabAreaCockpitDetails(Collection prevCockpitDetailList,Collection filterCriteria) throws Exception
    {
    if(debug)
    System.out.println("Inside CockpitOraDAO::getLabAreaCockpitDetails() method");
    Connection conn = null;
    boolean sampleExists = false;
    PreparedStatement pstmt=null;
    ResultSet rs=null;
    String returnStr=null;
    StringBuffer sqlQuery = null;
    String tempComment1=null, tempComment2=null;
    LabCockpitDO labc=null;
    LabCockpitDO labc2=null;
    Collection resultList=null, manCommentList=null, labCommentList=null, labCompCommentList=null;
    ArrayList result1List=null, prevCockpitDetail1List=null,filterList = null;
    OracleConnectionManager manager = null;
    boolean flag = false;

    try
    {
    labc2 = new LabCockpitDO();
    prevCockpitDetail1List = (ArrayList) prevCockpitDetailList;
    sqlQuery = new StringBuffer();

    sqlQuery.append("select s.sample_sample_no sample_no, s.sample_inspection_lot_no inspection_lot_no,");
    ....
    ....

    manager = new OracleConnectionManager();
    conn = manager.getPooledConnection("myDS");
    pstmt = conn.prepareStatement(sqlQuery.toString());
    if(debug)
    System.out.println("Query********"+sqlQuery.toString());
    rs = pstmt.executeQuery();
    ....
    ....
    }
    catch(Exception e)
    {
    //System.out.println(e);
    throw e;
    }
    finally
    {
    try
    {
    manager.releaseConnection("myDS");
    if(debug)
    System.out.println("Connection Status Closed=true/ Open=false=["+conn.isClosed()+"]");

    if(conn!=null || !conn.isClosed())
    conn.close();

    if(debug)
    System.out.println("Connection Status After Closing Connection Closed=true/ Open=false=["+conn.isClosed()+"]");
    if(rs != null)
    rs.close();
    if(pstmt != null)
    pstmt.close();

    conn = null;
    pstmt=null;
    rs = null;

    sqlQuery=null;
    returnStr=null;
    labc=null;
    labc2=null;
    manCommentList=null;
    labCommentList=null;
    labCompCommentList=null;
    tempComment1=null;
    tempComment2=null;
    resultList=null;
    prevCockpitDetailList=null;
    prevCockpitDetail1List=null;
    }
    catch(Exception e)
    {
    //System.out.println("Unable to Release Connection ="+e);
    throw e;
    }

    }
    //if(debug)
    //System.out.println(resultList);
    return result1List;
    }

  • RELEVANCY SCORE 3.48

    DB:3.48:Does Connection Need To Be Closed In Try Block? dj


    A Connecton is closed in finally block,Does it need call close() to close it in try block?
    example:

    ...
    Connection con=null
    try{
    ...
    con=...;
    ...
    //Is it superfluous?
    con.close();
    }catch (Exception e){
    ...
    }finally{
    try{
    if(con!=null) con.close();
    }catch(Exception ex){
    ...
    }
    }

    DB:3.48:Does Connection Need To Be Closed In Try Block? dj

    Yes, that's just a method call like any other, finally will still be run.

  • RELEVANCY SCORE 3.48

    DB:3.48:Ado To Ms Access Database. 3s


    I am having problems with executing a command object in ADO. The specific problem I have revolves around the proper type for the SQL string. Following examples on the internet, I established it with a _bstr_t. This though is not working
    with the * VARIANT type that is required in the Execute method. Can someone help me with the proper establishment of the SQL string? Listed below is the complete program
    #include stdio.h
    #include string
    using std::string;

    int cyc = 0;

    #import c:\program files\common files\system\ado\msado15.dll rename (EOF,EOFile)
    using namespace std;

    struct StartOLEProcess{
    StartOLEProcess( ) {
    ::CoInitialize(NULL);
    }
    ~StartOLEProcess( ) {
    ::CoUninitialize( );
    }
    } _start_StartOLEProcess;

    void main(void)
    {
    // define our variables which will be used as references to the
    // Connection and Recordset objects

    ADODB::_ConnectionPtr con = NULL;
    ADODB::_RecordsetPtr rec = NULL;
    ADODB::_CommandPtr com = NULL;
    ADODB::_ParameterPtr par = NULL;

    // create two strings for use with the creation of a Connection
    // and a Recordset object

    bstr_t sConString;
    bstr_t sSQLString;

    // create a variable to hold the result to function calls

    HRESULT hr = S_OK;

    // long variable needed for Execute method of Connection object

    VARIANT *vRecordsAffected = NULL;

    // create instance of an ADO Connection object, ADO Command object, ADO Parameter object, ADO Record object

    hr = con.CreateInstance(__uuidof(ADODB::Connection));
    hr = com.CreateInstance(__uuidof(ADODB::Command));
    hr = par.CreateInstance(__uuidof(ADODB::Parameter));
    hr = rec.CreateInstance(__uuidof(ADODB::Record));

    printf(Connection object created.\n);

    // open the data source with the Connection object

    sConString = LProvider=Microsoft.Jet.OLEDB.4.0;
    LData Source=C:\\Users\\Mike Certini\\Documents\\Trading\\Databases\\TradingAnalysis#2.mdb;

    // open the connection.

    hr = con-Open(sConString, L, L, -1);

    printf(Connection has been opened.\n);
    // create and store SQL string for command string.

    bstr_t strSQL(INSERT INTO mytable(id,desc));

    // activate connection string.

    com-ActiveConnection = con;

    // establish command string parameters.

    com-CommandText = strSQL;
    com-CommandType = ADODB::adCmdStoredProc;

    // Define Integer/variant.
    VARIANT vtInt;
    int intNum = 1;
    vtInt.vt = VT_I2;
    vtInt.iVal = intNum;

    // Define Character/variant.
    VARIANT vText;
    vText.vt = VT_BSTR;
    vText.bstrVal = _bstr_t(This is text);

    // Complete parameter objects

    hr = com-Parameters-Append(com-CreateParameter(_bstr_t(id),ADODB::adInteger,ADODB::adParamInput,4,intNum));
    hr = com-Parameters-Append(com-CreateParameter(_bstr_t(desc),ADODB::adChar,ADODB::adParamInput,15,vText));

    // Execute command object

    try
    {
    rec = com-Execute(strSQL, NULL, ADODB::adCmdStoredProc);
    }
    catch(_com_error e)
    {
    _bstr_t bstrSource(e.Source());
    _bstr_t bstrDescription(e.Description());

    // Print COM errors.
    printf(Error\n);
    printf(\tCode = %08lx\n, e.Error());
    printf(\tCode meaning = %s\n, e.ErrorMessage());
    printf(\tSource = %s\n, (LPCSTR) bstrSource);
    printf(\tDescription = %s\n, (LPCSTR) bstrDescription);
    }

    rec-Close( );
    rec = NULL;

    printf(Closed an removed the Recordset object from memory.\n);

    // close and remove the Connection object from memory

    con-Close( );
    con = NULL;

    printf(Closed and removed the
    Connection object from memory.\n);
    }

    DB:3.48:Ado To Ms Access Database. 3s

    Hi,
    This forum is for posting questions about data access to SQL Server. Since you are working with Access, I would suggest you post the question in
    Access for Developers.Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

  • RELEVANCY SCORE 3.48

    DB:3.48:Difference Between Connection = Null And Connection.Close() 77


    is it correct

    connection = null means connection object is eligible for garbage collection and does not return to connection pool

    and f or

    connection.close() means the connection object return to the
    connection pool

    is there any other difference between this ....?????

    DB:3.48:Difference Between Connection = Null And Connection.Close() 77

    i am using JBoss server where connection pooling is handled by the server.

    at a time only 20 connection will be avalilable ( as per the setting in jboss) if all the 20 connection is in use if u want 21 connection it will throw an exception " no manage connection ".

    In this senario -- if we do connection.close() its internally return the connection object to connection pool or it just close the connection and create an new connection object for new request.

  • RELEVANCY SCORE 3.48

    DB:3.48:Connection Has Already Been Closed ca



    We are on Weblogic 7.0 SP1 on HP UX 11i. Database is Oracle ver 9.0.1.3. Using
    thin driver for database access.

    Intermittently we get the error: "Connection has already been closed" from DAO
    programs. The stack trace shows that this error is preceded by java.sql.SQLException:
    java.lang.NullPointerException. The error is appearing in the finally block when
    we attempt to close the connection if it is not null. Here's the code piece:

    finally {
    try {
    if(connection != null)
    {
    connection.close();
    connection = null;
    } catch (SQLException sqlException) {
    log4j.error(sqlException.toString());
    }

    What we are not able to understand is, this piece of code can be executed only
    if connection object is not null and if so, why this error - 'Connection has already
    been closed'?

    We noticed a bug reported in SP1:
    Bug No: CR062827

    Description : Fixed a problem with prepared statement code that was provoking
    a null pointer exception; the prepared statement object was being set to null.

    Our error message is preceded by Nullpointer Exception and there is a possibility
    that it could be from PreparedStatement due to this bug. But, BEA has not given
    information on what happens to Connection when Prepared Statement throw this exception.

    Whether any of you facing the same kind of problem?
    Thanks in advance,

    DB:3.48:Connection Has Already Been Closed ca

    Hi Chitra,
    AFAIS the connection is closed and then u are trying to reassign it to null
    value which is not possible.
    you assign the connection to null and then close it, hope this won't give
    you the exceptions.
    hope this helps
    SP

    "chitra" chitra@hotmail.com wrote in message
    news:3e47da4c$1@newsgroups.bea.com...

    We are on Weblogic 7.0 SP1 on HP UX 11i. Database is Oracle ver 9.0.1.3.Using
    thin driver for database access.

    Intermittently we get the error: "Connection has already been closed" fromDAO
    programs. The stack trace shows that this error is preceded byjava.sql.SQLException:
    java.lang.NullPointerException. The error is appearing in the finallyblock when
    we attempt to close the connection if it is not null. Here's the codepiece:

    finally {
    try {
    if(connection != null)
    {
    connection.close();
    connection = null;
    } catch (SQLException sqlException) {
    log4j.error(sqlException.toString());
    }

    What we are not able to understand is, this piece of code can be executedonly
    if connection object is not null and if so, why this error - 'Connectionhas already
    been closed'?

    We noticed a bug reported in SP1:
    Bug No: CR062827

    Description : Fixed a problem with prepared statement code that wasprovoking
    a null pointer exception; the prepared statement object was being set tonull.

    Our error message is preceded by Nullpointer Exception and there is apossibility
    that it could be from PreparedStatement due to this bug. But, BEA has notgiven
    information on what happens to Connection when Prepared Statement throwthis exception.

    Whether any of you facing the same kind of problem?
    Thanks in advance,

  • RELEVANCY SCORE 3.41

    DB:3.41:Jsp Sessions And Database Connections x8


    Hi,
    IAm using Session for my JSP application.It works fine,but i got a problem when using the Database connection when trying to insert into one of the session page.The Connection is not being closed(still in active state on my Oracle server) even when i logout(session.invalidate) of my application.
    I closed my database connection properly.
    here is how i wrote my JSP program.
    %@ page session="true"%
    %
    Object str_obj=session.getAttribute("user");
    String usr=(Object)str_obj;

    if(usr!=null)
    {
    //code to open database connections and isert the data
    //and close the database connection
    }
    else
    {
    //redirect to Login.html
    }
    %
    Logout
    /html

    Am i doing wrong any where pls tell me why my database connections are not bing closed even though iam killing my session,closing connection.
    Is there any Cache thing still storing somewhere(in the browser/webserver)?

    Thanks in Adavance

    Regards
    Rao.

    DB:3.41:Jsp Sessions And Database Connections x8

    Hi Rao,

    I have same problem that you had and solved it about jsp session invalidate() methode. I used it but stil session stay samwhere. u told u solved it i wonder how did you got it anyway. can u pls tell me how?

  • RELEVANCY SCORE 3.41

    DB:3.41:Closing Connection 3s


    Hello, I work with jdeveloper. I had 10.1.2 which used java version 1.4.2 and I used a simple connection class to call stored procedures in an Oracle db. I have jdeveloper 10.1.3 which uses java version 1.5.0 and the same class fails when I try to use ResultSets. I use to close the connection then return the resultset to whatever called it, now it tells me the connection is already closed when I try to access the resultset. I know this is why it's failing now, because it works if I don't close anything.
    Can someone tell me how/why this has changed, and what I can do about it?
    Thanks

    Classes that use to work:

    public class dbConn {
    public dbConn() {
    }

    public static Connection getCon()
    {
    InitialContext ctx = null;
    DataSource ds = null;
    Connection conn = null;
    try {
    ctx = new InitialContext();
    ds = (DataSource) ctx.lookup("jdbc/app1");
    conn = ds.getConnection();
    }
    catch(Exception e){
    System.out.println("Connection Error");
    e.printStackTrace();
    }
    return conn;
    }

    public static void closeCon(CallableStatement proc, Connection conn)
    {
    try {
    proc.close();
    conn.close();
    }
    catch(SQLException e){
    System.out.println("Error closing connections: "+e);
    }
    }

    public static void main()
    {
    }
    }

    public static ResultSet GenResSet(String uname, String procName)
    {
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    String callString = "{ call "+procName+"(?,?) }";
    try {
    conn = dbConn.getCon();
    proc = conn.prepareCall(callString);
    proc.registerOutParameter(1,OracleTypes.CURSOR);
    proc.setString(2, uname);
    proc.execute();
    rs = (ResultSet)proc.getObject(1);
    }
    catch(SQLException e) {
    System.out.println("sql error");
    e.printStackTrace();
    }
    finally {
    dbConn.closeCon(proc,conn);
    }
    return rs;
    }

    DB:3.41:Closing Connection 3s

    Ok thanks. So I can learn.. what exactly is my
    misconception about how it works? My beginner view is
    you stored a cursor set from a database query in a
    result set then you could iterate through it. Why
    does it have to be stored in a collection first? I
    was closing the connection before I returned it, or
    so I thought. It went through the finally code to
    close everytime, but I could still use the results.
    Maybe it wasn't closing them?That's exactly your misconception. After you close the connection, your ResultSet is not valid. In simple words, you need a live connection to fetch values from the ResultSet. In your method, you close the connection in the finally block and return the resultset. You will need to hold the results in something else, which would be some suitable collection.

  • RELEVANCY SCORE 3.40

    DB:3.40:Persistent Database Connection In Oc4j dk


    Hi

    I am usinf OC4J for my application as the server. The database connection is made at runtime and then closed.
    I want the database connection to persist. When I use debug on, I find that 5 connection are opened , this is shown in the log file but not at the database level where I m checking with the help of v$session.

    Below is the data-sources.xml file which I am using for accessing the database.

    data-source
    class="com.evermind.sql.DriverManagerDataSource"
    name="SvgDS"
    location="jdbc/SvgDS"
    xa-location="jdbc/xa/SvgXADS"
    ejb-location="jdbc/SvgEjbDS"
    connection-driver="oracle.jdbc.driver.OracleDriver"
    username="itspri_public"
    password="itspri000"
    url="jdbc:oracle:thin:@192.9.44.4:1581:als"
    max-connections="10"
    min-connections="5"
    max-connect-attempts="10"
    connection-retry-interval="1"
    inactivity-timeout="30"
    wait-timeout="30"
    /

    I am accessing this datasource in my DAO with the help of following code. Can anybody give a workaround or solution to my problem.

    package itspri;

    import java.io.*;
    import java.util.*;
    import javax.naming.*;
    import java.sql.*;
    import javax.sql.*;
    import itspri.*;

    public class DAOCounty
    {
    String strQuery="";
    String temp="";
    DataSource jdbcURL;
    String queryString = " ";

    // Default constructor, making connection to database
    public DAOCounty() throws SVGException
    {
    connCounty();

    }

    // Method to make connection with database using data source through JNDI lookup
    public void connCounty() throws SVGException
    {
    try
    {
    InitialContext context = null;
    Context initCtx = new InitialContext();
    Context envCtx = (Context)initCtx.lookup("java:comp/env");

    jdbcURL = (DataSource) envCtx.lookup("jdbc/pool/SvgDS");
    //jdbcURL = (DataSource) initCtx.lookup("jdbc/pool/SvgDS");
    }catch(NamingException naminge)
    {
    throw new SVGException("SVG003", naminge);
    }

    }

    public ArrayList getCounties() throws SVGException
    {
    ResultSet result_county = null;
    Connection connection = null;
    Statement stmt = null;

    /* if connection has been lost either due to server shutdown or something else get connection again */
    ArrayList alCounty = new ArrayList();
    try
    {
    connection = jdbcURL.getConnection();

    strQuery = "SELECT CNTY_LICENSE_REGISTRATION,CNTY_NM"+
    " FROM DP.COUNTIES " +
    " WHERE CNTY_LICENSE_REGISTRATION BETWEEN 1 AND 56 order by CNTY_NM";

    stmt = connection.createStatement();
    result_county = stmt.executeQuery(strQuery);
    while(result_county.next())
    {
    PopupCountyParameter cy = new PopupCountyParameter();
    cy.countyNumber = result_county.getString(1);
    cy.countyName = result_county.getString(2);

    alCounty.add(cy);
    }
    }catch(SQLException sqle)
    {
    throw new SVGException("SVG003", sqle, sqle.getErrorCode()+"");
    }
    catch(Exception e)
    {
    throw new SVGException("SVG003", e);
    }
    finally
    {
    try{
    if (result_county != null)
    result_county.close();
    result_county = null;

    /****if (stmt != null)
    stmt.close();
    stmt = null;

    if (connection != null)
    connection.close(); ***************/
    connection = null;
    }catch(SQLException ex)
    {
    throw new SVGException("SVG003", ex, ex.getErrorCode()+"");
    }
    }
    return alCounty;
    }
    }

    Arvind

    DB:3.40:Persistent Database Connection In Oc4j dk

    Hi

    I am usinf OC4J for my application as the server. The database connection is made at runtime and then closed.
    I want the database connection to persist. When I use debug on, I find that 5 connection are opened , this is shown in the log file but not at the database level where I m checking with the help of v$session.

    Below is the data-sources.xml file which I am using for accessing the database.

    data-source
    class="com.evermind.sql.DriverManagerDataSource"
    name="SvgDS"
    location="jdbc/SvgDS"
    xa-location="jdbc/xa/SvgXADS"
    ejb-location="jdbc/SvgEjbDS"
    connection-driver="oracle.jdbc.driver.OracleDriver"
    username="itspri_public"
    password="itspri000"
    url="jdbc:oracle:thin:@192.9.44.4:1581:als"
    max-connections="10"
    min-connections="5"
    max-connect-attempts="10"
    connection-retry-interval="1"
    inactivity-timeout="30"
    wait-timeout="30"
    /

    I am accessing this datasource in my DAO with the help of following code. Can anybody give a workaround or solution to my problem.

    package itspri;

    import java.io.*;
    import java.util.*;
    import javax.naming.*;
    import java.sql.*;
    import javax.sql.*;
    import itspri.*;

    public class DAOCounty
    {
    String strQuery="";
    String temp="";
    DataSource jdbcURL;
    String queryString = " ";

    // Default constructor, making connection to database
    public DAOCounty() throws SVGException
    {
    connCounty();

    }

    // Method to make connection with database using data source through JNDI lookup
    public void connCounty() throws SVGException
    {
    try
    {
    InitialContext context = null;
    Context initCtx = new InitialContext();
    Context envCtx = (Context)initCtx.lookup("java:comp/env");

    jdbcURL = (DataSource) envCtx.lookup("jdbc/pool/SvgDS");
    //jdbcURL = (DataSource) initCtx.lookup("jdbc/pool/SvgDS");
    }catch(NamingException naminge)
    {
    throw new SVGException("SVG003", naminge);
    }

    }

    public ArrayList getCounties() throws SVGException
    {
    ResultSet result_county = null;
    Connection connection = null;
    Statement stmt = null;

    /* if connection has been lost either due to server shutdown or something else get connection again */
    ArrayList alCounty = new ArrayList();
    try
    {
    connection = jdbcURL.getConnection();

    strQuery = "SELECT CNTY_LICENSE_REGISTRATION,CNTY_NM"+
    " FROM DP.COUNTIES " +
    " WHERE CNTY_LICENSE_REGISTRATION BETWEEN 1 AND 56 order by CNTY_NM";

    stmt = connection.createStatement();
    result_county = stmt.executeQuery(strQuery);
    while(result_county.next())
    {
    PopupCountyParameter cy = new PopupCountyParameter();
    cy.countyNumber = result_county.getString(1);
    cy.countyName = result_county.getString(2);

    alCounty.add(cy);
    }
    }catch(SQLException sqle)
    {
    throw new SVGException("SVG003", sqle, sqle.getErrorCode()+"");
    }
    catch(Exception e)
    {
    throw new SVGException("SVG003", e);
    }
    finally
    {
    try{
    if (result_county != null)
    result_county.close();
    result_county = null;

    /****if (stmt != null)
    stmt.close();
    stmt = null;

    if (connection != null)
    connection.close(); ***************/
    connection = null;
    }catch(SQLException ex)
    {
    throw new SVGException("SVG003", ex, ex.getErrorCode()+"");
    }
    }
    return alCounty;
    }
    }

    Arvind

  • RELEVANCY SCORE 3.40

    DB:3.40:Webmail jz





    Hi!

    I got some problem when i try to download and open attachment in webmail.

    Get this error:

    br /
    bNotice/b: (null)(): [CLOSED] IMAP connection broken (server response) (errflg=2) in bUnknown/b on line b0/bbr /

    What is the problem?

    Kent

    DB:3.40:Webmail jz




    Hi!

    I got some problem when i try to download and open attachment in webmail.

    Get this error:

    br /
    bNotice/b: (null)(): [CLOSED] IMAP connection broken (server response) (errflg=2) in bUnknown/b on line b0/bbr /

    What is the problem?

    Kent

  • RELEVANCY SCORE 3.40

    DB:3.40:Message Consumer Closing Due To Error In Listening Thread , 8j



    Hi,I close the subscriber and associated session , connection etc by calling public static void stop() throws JMSException { if (topicSession != null){ topicSession.close(); } if (topicConnection != null){ topicConnection.stop(); topicConnection.close(); } }Everytime I am being thrown with following messages ,(mq.SpyMessageConsumer 736 ) Message consumer closing due to error in listening thread.javax.jms.IllegalStateException: Session is closed. at org.jboss.mq.SpyMessage.doAcknowledge(SpyMessage.java:319) at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:728) at java.lang.Thread.run(Thread.java:534)(mq.Connection 460 ) Connection failure, use javax.jms.Connection.setExceptionListener() to handle this error and reconnectjavax.jms.IllegalStateException: Session is closed. at org.jboss.mq.SpyMessage.doAcknowledge(SpyMessage.java:319) at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:728) at java.lang.Thread.run(Thread.java:534)This looks like a warning message. Is this a bug?ThanksSundar

    DB:3.40:Message Consumer Closing Due To Error In Listening Thread , 8j


    No. If you do consumer.close(); before session.close()you won't see this message.

  • RELEVANCY SCORE 3.40

    DB:3.40:Reg Rfc Connection xa



    hi all

    when is rfc connection closed

    DB:3.40:Reg Rfc Connection xa


    RFC connection is closed when the calling program on the client stops executing or if the the connection is explicitly closed.

    Archana

  • RELEVANCY SCORE 3.39

    DB:3.39:13.1 Lwip Does Not Respond To Rst Packet 9f



    lwip is responding(calling the receive callback function) to the FIN packet sent by a properly closed connection on the PC, but
    does not respond(as it used to in 12.X) to the OS sent RST packet when the
    process is killed and teh PC OS cleans up the connections.

    I am using 13.1 tools and using lwip in RAW mode.

    I would expect the receive callback function to be called with a NULL buffer letting me know that the connection had been closed.

    In 13.1, is there a new way to tell when a connection is reset versus closed?

    DB:3.39:13.1 Lwip Does Not Respond To Rst Packet 9f


    Hello,

    I'm having a similar problem with LWIP and am not getting any response from the echo server with ISE 13.1.

    case 1:

    I have done the following:

    - Export HW design to sdk

    - Design a 'raw' application following the instructions specified inhttp://www.xilinx.com/support/documentation/applic​ation_notes/xapp1026.pdf

    - choose standalone OS_ver in bsp settings as 3.01.a and choose LWIP130 library v3.00.a

    - Build the elf files

    When I download the bit and elf files into the fpga, and connect via tcp (teraterm), I do not get any response from the echo server.

    case 2:

    If I perform the same set of operations with ISE 12.3 and LWIP130 library 2.00.a, while keeping everything else constant I get the desired response from the echo server via tcp.

    case 3: 

    If I user ISE 12.3 with LWIP130 library v3.00.a, the end result is the same as case 1.

    After going through some webcases from xilinx forums, here are a few additional design changes I had done case 1:

    * changed to higher board IP address

    * changed the OS_Version and driver_versions in system.mss file

    * increased stack/heap size

    However, there is no significant change in the state of the original problem. At this moment, I have run out of options and any help in this area is much appreciated.

    Best,

    Vijay

    Here is my mss file:

    PARAMETER VERSION = 2.2.0BEGINOS

    PARAMETER OS_NAME = standalone

    PARAMETER OS_VER = 3.01.a

    PARAMETER PROC_INSTANCE = microblaze_0

    PARAMETER STDIN = RS232_Uart_1PARAMETER STDOUT = RS232_Uart_1

    END

    BEGIN PROCESSORPARAMETER DRIVER_NAME = cpuPARAMETER DRIVER_VER = 1.13.bPARAMETER HW_INSTANCE = microblaze_0PARAMETER COMPILER = mb-gccPARAMETER ARCHIVER = mb-arENDBEGIN DRIVERPARAMETER DRIVER_NAME = bramPARAMETER DRIVER_VER = 3.00.aPARAMETER HW_INSTANCE = dlmb_cntlrENDBEGIN DRIVERPARAMETER DRIVER_NAME = bramPARAMETER DRIVER_VER = 3.00.aPARAMETER HW_INSTANCE = ilmb_cntlrENDBEGIN DRIVERPARAMETER DRIVER_NAME = genericPARAMETER DRIVER_VER = 1.00.aPARAMETER HW_INSTANCE = lmb_bramENDBEGIN DRIVERPARAMETER DRIVER_NAME = uartlitePARAMETER DRIVER_VER = 2.00.aPARAMETER HW_INSTANCE = RS232_Uart_1ENDBEGIN DRIVERPARAMETER DRIVER_NAME = gpioPARAMETER DRIVER_VER = 3.00.aPARAMETER HW_INSTANCE = LEDs_8BitENDBEGIN DRIVERPARAMETER DRIVER_NAME = gpioPARAMETER DRIVER_VER = 3.00.aPARAMETER HW_INSTANCE = DIP_Switches_8BitENDBEGIN DRIVERPARAMETER DRIVER_NAME = mpmcPARAMETER DRIVER_VER = 4.01.aPARAMETER HW_INSTANCE = DDR3_SDRAMENDBEGIN DRIVERPARAMETER DRIVER_NAME = lltemacPARAMETER DRIVER_VER = 3.00.aPARAMETER HW_INSTANCE = Hard_Ethernet_MACENDBEGIN DRIVERPARAMETER DRIVER_NAME = tmrctrPARAMETER DRIVER_VER = 2.00.aPARAMETER HW_INSTANCE = xps_timer_0ENDBEGIN DRIVERPARAMETER DRIVER_NAME = genericPARAMETER DRIVER_VER = 1.00.aPARAMETER HW_INSTANCE = clock_generator_0ENDBEGIN DRIVERPARAMETER DRIVER_NAME = uartlitePARAMETER DRIVER_VER = 2.00.aPARAMETER HW_INSTANCE = mdm_0ENDBEGIN DRIVERPARAMETER DRIVER_NAME = genericPARAMETER DRIVER_VER = 1.00.aPARAMETER HW_INSTANCE = proc_sys_reset_0ENDBEGIN DRIVERPARAMETER DRIVER_NAME = intcPARAMETER DRIVER_VER = 2.02.aPARAMETER HW_INSTANCE = xps_intc_0END

  • RELEVANCY SCORE 3.39

    DB:3.39:Idle Time Out Question pk



    If the quey is taking longer than idle-timeout-minutes configuration, Will Jboss Connection pool make that connection idle (meaning close the connection) ?E.g.conn.executeQuery is taking 15 minutes and idle-timeout-minutes is 10 mins, Will conn.close() throw null pointer exception because connection was closed by idle timeout setting.

    DB:3.39:Idle Time Out Question pk


    Incidently, if the code were:

    Connection c; // no initalizer
    try
    {
    c = allocateConnection();
    }
    catch (SQLException e)
    {
    }
    finally
    {
    c.close();
    }

  • RELEVANCY SCORE 3.38

    DB:3.38:Connection Getting Closed Automatically xf


    I have written an web application and deployed in tomcat. I am using simple pojo java beans to access the database connection in my jsps. The problem is after some time (30-45 mts) if no activity is done on this application I am getting the null pointer exception. I suspect that the connection with the database is getting closed.

    Will the database (mysql) automatically get closed in java?

    DB:3.38:Connection Getting Closed Automatically xf

    the database is not in java
    you use java to access the database
    if the database is closing connections, this probably has nothing to do with java unless your code is closing the connection(s) somewhere

  • RELEVANCY SCORE 3.37

    DB:3.37:Hibernate Got Connection Closed On Oracle Database!! mk


    I am using Hibernate with oracle database10.2.0.4.
    when i am inserting data about 1000 record i got the following error:

    org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not
    execute query; uncategorized SQLException for SQL [select this_.id as id106_0_,
    this_.CLASS as CLASS106_0_, this_.description as descript3_106_0_, this_.ENTITY_NAME
    as ENTITY4_106_0_ from ACL_CLASS this_ where this_.CLASS=?]; SQL state [null]; error
    code [17008]; Closed Connection; nested exception is java.sql.SQLException: Closed
    Connection
    at
    org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:124).....

    ---------------
    i dont know what makes this problem and how could i solve that?

    DB:3.37:Hibernate Got Connection Closed On Oracle Database!! mk

    i dont know what makes this problempossibly COMMIT inside of LOOP

    and how could i solve that?eliminate COMMIT

    Handle: user12189421
    Status Level: Newbie
    Registered: Dec 2, 2009
    Total Posts: 46
    Total Questions: 24 (24 unresolved)
    so many questions without ANY answers.
    :-(

    http://forums.oracle.com/forums/ann.jspa?annID=718

    Edited by: sb92075 on Nov 20, 2010 7:12 AM

  • RELEVANCY SCORE 3.36

    DB:3.36:Hitting The Exceptions " Internal Error: Connection Is Closed By Foreign Host " And "Internalerror: Session.Connect: Java.Net.Socketexception: Connection Reset " Intermittenly In The Vco Web Client. f7


    Hitting the exceptions " Internal Error: connection is closed by foreign host " and "InternalError: Session.connect: java.net.SocketException: Connection reset " intermittenly in the vCO web client.This occurs when we are trying to establish a SSH connection from vCO server to other linux servers and execute shell scripts.

    Any suggestions as to what would possibly be causing this error.

    DB:3.36:Hitting The Exceptions " Internal Error: Connection Is Closed By Foreign Host " And "Internalerror: Session.Connect: Java.Net.Socketexception: Connection Reset " Intermittenly In The Vco Web Client. f7

    Hitting the exceptions " Internal Error: connection is closed by foreign host " and "InternalError: Session.connect: java.net.SocketException: Connection reset " intermittenly in the vCO web client.This occurs when we are trying to establish a SSH connection from vCO server to other linux servers and execute shell scripts.

    Any suggestions as to what would possibly be causing this error.

  • RELEVANCY SCORE 3.36

    DB:3.36:Connectivity Problem On Linux aj


    hi, this has been tested using OJDBC 1.4 and 6, on openJDK 1.6 AND oracle 1.7.0_15 the problem is : launching the first time the attached sketch, everything is fine, and connection is open in 5/10ms. (with netstat you can see after the program end some connection stay in time_wait) After that, if you launch again the program, you'll see that connection will hang for 20/30 seconds, seems like until the time-wait connection go into timeout a now connection to DB cannot be established. I think this is a bug of the driver that doesn't close in appropriate way the connection. ---------------- public class DatabaseTest { static{ //System.out.println("E "+new File("").getAbsolutePath()); long time; // Enable logging DriverManager.setLogWriter(new PrintWriter((System.err))); System.out.println("Setting tns PATH, looking in the same directory as .jar"); time = System.currentTimeMillis(); System.setProperty("oracle.net.tns_admin",new File("").getAbsolutePath()); System.out.println("time used msec: "+(System.currentTimeMillis()-time) ); System.out.println("Driver db caricati"); } public static void main(String args[]){ Connection conn = null; System.out.println("Starting connection"); conn = getNewConnection("TNS_NAME", "USER","PASSWORD"); System.out.println("Connection ok"); try { if (conn != null){ System.out.println("Connection closed"); conn.close(); }else{ System.out.println("Connection was not established"); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static Connection getNewConnection(String sid, String username, String password){ Connection connection = null; try { String url = "jdbc:oracle:thin:@" + sid; System.out.println("Connecting to DB"); System.out.println("Using connection string: "+url+" login: "+username+" "+password); long time = System.currentTimeMillis(); OracleDataSource ds = new oracle.jdbc.pool.OracleDataSource(); ds.setURL(url); ds.setLoginTimeout(2); connection = ds.getConnection(username, password); ds.close(); System.out.println("time used msed: "+(System.currentTimeMillis()-time) ); return connection; } catch (SQLException e) { // Could not connect to the database e.printStackTrace(); } return null; } }

    DB:3.36:Connectivity Problem On Linux aj

    hi, this has been tested using OJDBC 1.4 and 6, on openJDK 1.6 AND oracle 1.7.0_15 the problem is : launching the first time the attached sketch, everything is fine, and connection is open in 5/10ms. (with netstat you can see after the program end some connection stay in time_wait) After that, if you launch again the program, you'll see that connection will hang for 20/30 seconds, seems like until the time-wait connection go into timeout a now connection to DB cannot be established. I think this is a bug of the driver that doesn't close in appropriate way the connection. ---------------- public class DatabaseTest { static{ //System.out.println("E "+new File("").getAbsolutePath()); long time; // Enable logging DriverManager.setLogWriter(new PrintWriter((System.err))); System.out.println("Setting tns PATH, looking in the same directory as .jar"); time = System.currentTimeMillis(); System.setProperty("oracle.net.tns_admin",new File("").getAbsolutePath()); System.out.println("time used msec: "+(System.currentTimeMillis()-time) ); System.out.println("Driver db caricati"); } public static void main(String args[]){ Connection conn = null; System.out.println("Starting connection"); conn = getNewConnection("TNS_NAME", "USER","PASSWORD"); System.out.println("Connection ok"); try { if (conn != null){ System.out.println("Connection closed"); conn.close(); }else{ System.out.println("Connection was not established"); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static Connection getNewConnection(String sid, String username, String password){ Connection connection = null; try { String url = "jdbc:oracle:thin:@" + sid; System.out.println("Connecting to DB"); System.out.println("Using connection string: "+url+" login: "+username+" "+password); long time = System.currentTimeMillis(); OracleDataSource ds = new oracle.jdbc.pool.OracleDataSource(); ds.setURL(url); ds.setLoginTimeout(2); connection = ds.getConnection(username, password); ds.close(); System.out.println("time used msed: "+(System.currentTimeMillis()-time) ); return connection; } catch (SQLException e) { // Could not connect to the database e.printStackTrace(); } return null; } }

  • RELEVANCY SCORE 3.36

    DB:3.36:Pool Time Out f3


    Hi,
    I use a connection pool and JDBC thin to connect to a oracle database in a servlets.

    After some time the connection is silently closed if there is no activity.

    So usually if the app is left unused in night the connection is lost and webserver has to be restarted to get the connections back.

    Please let me know how I can avoid this.

    Thanks
    Venkatesh
    null

    DB:3.36:Pool Time Out f3

    Hi,
    I use a connection pool and JDBC thin to connect to a oracle database in a servlets.

    After some time the connection is silently closed if there is no activity.

    So usually if the app is left unused in night the connection is lost and webserver has to be restarted to get the connections back.

    Please let me know how I can avoid this.

    Thanks
    Venkatesh
    null

  • RELEVANCY SCORE 3.36

    DB:3.36:Thne Server/Client Connection Is Not Closed f1



    Hi,

    I am created remote client on PC and server application using Lwip stack in my ML605 board.

    the client send data to server. Before this, the client demands connectionandthe server accept and open connection

    Once data are received, the server close connection.

    This application run correctely for limited number of connections. Exceeded this number, the connection will not be closed, so I can not reconnect the client(pc) into the server(board).

    my_server_recv_callback(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err){u32_t i;

    /* close socket if the peer has sent the FIN packet */ if (p == NULL) {

    tcp_arg(tpcb,NULL); tcp_recv(tpcb,NULL); tcp_close(tpcb);

    xil_printf("\n\rMy Serveur: Connection Closed"); return ERR_OK; }

    /* all we do is say we've received the packet */ /* we don't actually make use of it */

    tcp_recved(tpcb, p-tot_len); ptr_data=(u8_t*)p-payload;

    /*recupérer la taille totale des données reçues*/lenght_tot+=p-len;//xil_printf("\n\rlenght_tot = %d\n\r",lenght_tot);

    /*stocker les données reçues*/ store_data(p-len);

    pbuf_free(p);

    }

    Please, Can anyone help me to fix this problem?

    thanks

    DB:3.36:Thne Server/Client Connection Is Not Closed f1


    Hi,

    I am created remote client on PC and server application using Lwip stack in my ML605 board.

    the client send data to server. Before this, the client demands connectionandthe server accept and open connection

    Once data are received, the server close connection.

    This application run correctely for limited number of connections. Exceeded this number, the connection will not be closed, so I can not reconnect the client(pc) into the server(board).

    my_server_recv_callback(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err){u32_t i;

    /* close socket if the peer has sent the FIN packet */ if (p == NULL) {

    tcp_arg(tpcb,NULL); tcp_recv(tpcb,NULL); tcp_close(tpcb);

    xil_printf("\n\rMy Serveur: Connection Closed"); return ERR_OK; }

    /* all we do is say we've received the packet */ /* we don't actually make use of it */

    tcp_recved(tpcb, p-tot_len); ptr_data=(u8_t*)p-payload;

    /*recupérer la taille totale des données reçues*/lenght_tot+=p-len;//xil_printf("\n\rlenght_tot = %d\n\r",lenght_tot);

    /*stocker les données reçues*/ store_data(p-len);

    pbuf_free(p);

    }

    Please, Can anyone help me to fix this problem?

    thanks

  • RELEVANCY SCORE 3.36

    DB:3.36:Resultset ,Statement And Connection cx


    Do ResultSets Statements always have to be closed before closing the Connection object.
    When a Connection is closed isn't the RS and stmt closed automatically /
    Manoj

    DB:3.36:Resultset ,Statement And Connection cx

    I agree with cMueller. It is implicit. But as a matter of discipline and to optimize resources, it is advisable that yo close all your resultset and connection objects.

  • RELEVANCY SCORE 3.35

    DB:3.35:Connection Pool Question j7


    I am confusing about how to set up a JDBC connection to Oracle in servlet:

    Here is the sample to setup connection pool:

    http://technet.oracle.com/sample_code/tech/java/sqlj_jdbc/files/jdbc20/ConnectionPooling/Readme.html

    please note:
    PooledConnection pooledconn = null;

    Connection connection = null;

    These two variables are local variable they are not close explicitly if no exception is thrown. They suppose to be close by garbage collection. But if PooledConnection is close the physical connection to database is also closed!

    Please shed some light here.

    DB:3.35:Connection Pool Question j7

    Hi Xin,

    PooledConnection pooledconn = null;

    Connection connection = null;

    These two variables are local variable they are not
    close explicitly if no exception is thrown.Connection is closed in the finally block, so even if there is an exception or not, connection will be closed.

    } finally { // return connection object to the pool.
    if (connection != null) {
    try {
    connection.close(); // close the logical connection.
    pooledconn.close(); // return connection to pool
    } catch (SQLException e) {
    context.log(e.toString());
    }
    }

    But if PooledConnection is closed the physical connection to
    database is also closed! Calling .close() on PooledConnection doesn't close the physical connection, it returns the connection to connection pool.

    There is a one-to-one correspondance between the PooledConnection
    and the logical OracleConnection. At any given time, there can be only
    one Logical OracleConnection per PooledConnection.

    Regards
    Elango.

  • RELEVANCY SCORE 3.35

    DB:3.35:Java.Sql.Sqlexception: Connection Is Closed 39


    Hello there,
    I was deployed the web application and run well in a long time. But in near days. I got the problems is "java.sql.SQLException: Connection is closed." from Web server.
    My database: Postgres
    applied STRUTS FRAMEWORD.

    My code open connection are:

    public ArrayList getAllTargetGroup(DataSource dataSource) throws SQLException, Exception
    {
    Connection conn = null;
    ResultSet rs = null;
    TargetGroupFilterForm tgInfo = null;
    ArrayList listTargetGroup = new ArrayList();

    try
    {

    conn = dataSource.getConnection();

    String strQuery = " SELECT DISTINCT ahk.targetgroups.tgid, ahk.targetgroups.description "
    + " FROM ahk.targetgroups "
    + " WHERE ((Not (ahk.targetgroups.description) Is Null))"
    + " ORDER BY ahk.targetgroups.description";

    java.sql.Statement stmt=null;
    conn.setAutoCommit(false);
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    rs = stmt.executeQuery(strQuery);
    rs.beforeFirst();
    while(rs.next())
    {
    tgInfo = new TargetGroupFilterForm();
    tgInfo.setTgid(rs.getString("tgid")); // Get ID of company
    tgInfo.setDescription(rs.getString("description")); // Name of company
    listTargetGroup.add(tgInfo);
    }
    conn.commit();
    conn.close();
    }
    catch (SQLException sqle)
    {
    conn.close();
    throw sqle;
    }
    finally
    {
    try
    {
    if (conn.isClosed() == false)
    conn.close();
    }
    catch(Exception ex)
    {
    throw ex;
    }
    }

    return listTargetGroup;
    }

    Please give me a way to fix this problems.
    Thanks

    DB:3.35:Java.Sql.Sqlexception: Connection Is Closed 39

    Thanks for your reply,
    I have some new info, but the problem is i cannot trace in my test because it don't happen. I only receive the shortly java.sql.SQLException: Connection is closed exception that all, I have for one day to do test that function but not happen.
    :(
    Thanks

  • RELEVANCY SCORE 3.35

    DB:3.35:[Cachedconnectionmanager] Closing A Connection For You 13



    JBoss4.2.0.GAjBPM 3.2.0.GAHi,I'm trying to use jBPM 3 in an existing application. I can deploy processes definitions, but when I try to get the process list, I get an error message :[CachedConnectionManager] Closing a connection for youInvestigating on this error I found that : - The error occurs in "org.jbpm.persistence.db.DbPersistenceService" when the "Connection getConnection(boolean resolveSession)" method is called - The connection hasn't been closed because when the "Exception closeConnection()" method is called, the variable mustConnectionBeClosed is set to falseLooking for the reason why "mustConnectionBeClosed", here is the code executed :In my class : jbpmContext.getGraphSession().findLatestProcessDefinitions()In DbPersistenceService : public GraphSession getGraphSession() { if (graphSession==null) { Session session = getSession(); //-- 1 ... public Session getSession() { if ( (session==null) (getSessionFactory()!=null) ) { Connection connection = getConnection(false); //-- 2 if (isCurrentSessionEnabled) { ... } else if (connection!=null) { log.debug("creating hibernate session with connection "+connection); session = getSessionFactory().openSession(connection); mustSessionBeClosed = true; mustSessionBeFlushed = true; mustConnectionBeClosed = false; //-- 4 ... public Connection getConnection(boolean resolveSession) { if (connection==null) { if (persistenceServiceFactory.getDataSource()!=null) { try { log.debug("fetching jdbc connection from datasource"); connection = persistenceServiceFactory.getDataSource().getConnection(); mustConnectionBeClosed = true; //-- 3 ..."mustConnectionBeClosed" is first set to true (//-- 3) getting the connection, then set to false (//-- 4) some lines further, after opening the session.Is this normal ? How to avoid the error message ? Did I miss something in the configuration ?RegardsA. ROY

    DB:3.35:[Cachedconnectionmanager] Closing A Connection For You 13


    I'm running into the same problem using jbpm-3.1.1, hibernate-3.2.4.SP1 and JBoss 4.0.5.GA.But I'm using this testcode (with a minimum-workflow consisting of a start and an end node) as CMT bean:
    public void showError() {

    log.info("Request received");
    JbpmContext wfContext = wfConfiguration.createJbpmContext();
    ProcessInstance process = wfContext.newProcessInstance("HelloWorld");
    process.signal();

    // Session hibernateSession = wfContext.getSession();
    wfContext.close();
    }

  • RELEVANCY SCORE 3.34

    DB:3.34:Does Mysql Or Other Data Base Connection.. k3


    Auto close the connection after the query is done or is it like java, and possibly any other language - where you have to close the data base? and if You dont what are the ramifications of committing data to a data base and closing the application with out
    properly closing the data base connection?

    If you are to close the connection Look at the following code, and tell me - please - why its not closing when I tell it to.
    The code to open and close a connection

    private
    MySqlConnection connection;

    public
    void
    OpenConnection()
    {
    string
    MyConString = SERVER=localhost;

    DATABASE=test;

    UID=root;

    PASSWORD=2474776;
    ;
    connection = new
    MySqlConnection(MyConString);
    connection.Open();
    }

    public
    void
    closeConnection()
    {
    if
    (connection != null
    )
    {
    connection.Close();
    MessageBox.Show(Data Vase Connection Closed.
    , Closed Connection
    );
    }
    else

    {
    MessageBox.Show(The Data Base connection was not closed
    ,
    Error 102
    ,
    MessageBoxButtons.AbortRetryIgnore,
    MessageBoxIcon.Error);
    }

    }

    DB:3.34:Does Mysql Or Other Data Base Connection.. k3

    my question is why to close it before checking if it is null or not? he should check first then close or he will get null reference exception if the object is not created yet.

    Alan-SY

    An application can call Close more than one time. No exception is generated. - MSDN
    http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.close.aspx
    also, i get your point that we are debating about, my answer is more focussed on the connection.close() and yours is checking for null; in terms of considering the entire code,yes checking for null and connection.close() would be safe way;

    Balaji Baskar
    [Please mark the post as answer if it answers your question]
    [http://codesupport.wordpress.com]

  • RELEVANCY SCORE 3.33

    DB:3.33:Socket 74 Client Closed Connection p8



    What does this repeating message in vmware.log mean and is there any way to stop it?

    Jul 06 20:37:40.862: vmx| SOCKET 86 client closed connection

    Jul 06 20:37:45.835: vmx| SOCKET 87 client closed connection

    Jul 06 20:37:50.808: vmx| SOCKET 88 client closed connection

    Jul 06 20:37:55.799: vmx| SOCKET 89 client closed connection

    Jul 06 20:38:00.987: vmx| SOCKET 90 client closed connection

    Jul 06 20:38:05.948: vmx| SOCKET 91 client closed connection

    Jul 06 20:38:10.855: vmx| SOCKET 92 client closed connection

    Jul 06 20:38:15.840: vmx| SOCKET 93 client closed connection

    Jul 06 20:38:20.978: vmx| SOCKET 94 client closed connection

    Jul 06 20:38:25.929: vmx| SOCKET 95 client closed connection

    Jul 06 20:38:30.917: vmx| SOCKET 96 client closed connection

    Jul 06 20:38:35.903: vmx| SOCKET 97 client closed connection

    Jul 06 20:38:40.964: vmx| SOCKET 98 client closed connection

    Jul 06 20:38:45.921: vmx| SOCKET 99 client closed connection

    Jul 06 20:38:50.967: vmx| SOCKET 100 client closed connection

    Jul 06 20:38:55.862: vmx| SOCKET 101 client closed connection

    Thanks,

    - Pasi -

    DB:3.33:Socket 74 Client Closed Connection p8


    What does this repeating message in vmware.log mean and is there any way to stop it?

    Jul 06 20:37:40.862: vmx| SOCKET 86 client closed connection

    Jul 06 20:37:45.835: vmx| SOCKET 87 client closed connection

    Jul 06 20:37:50.808: vmx| SOCKET 88 client closed connection

    Jul 06 20:37:55.799: vmx| SOCKET 89 client closed connection

    Jul 06 20:38:00.987: vmx| SOCKET 90 client closed connection

    Jul 06 20:38:05.948: vmx| SOCKET 91 client closed connection

    Jul 06 20:38:10.855: vmx| SOCKET 92 client closed connection

    Jul 06 20:38:15.840: vmx| SOCKET 93 client closed connection

    Jul 06 20:38:20.978: vmx| SOCKET 94 client closed connection

    Jul 06 20:38:25.929: vmx| SOCKET 95 client closed connection

    Jul 06 20:38:30.917: vmx| SOCKET 96 client closed connection

    Jul 06 20:38:35.903: vmx| SOCKET 97 client closed connection

    Jul 06 20:38:40.964: vmx| SOCKET 98 client closed connection

    Jul 06 20:38:45.921: vmx| SOCKET 99 client closed connection

    Jul 06 20:38:50.967: vmx| SOCKET 100 client closed connection

    Jul 06 20:38:55.862: vmx| SOCKET 101 client closed connection

    Thanks,

    - Pasi -

  • RELEVANCY SCORE 3.32

    DB:3.32:Hibernate Connection Lost 7p


    I am connecting to the database via the entity manager
    In my bean i have injected the entity manager
    My table has huge amountof data say 1,00,000 records
    I am retrieving data fine for some time and later i am getting null pointer exception because of my connection to the database is closed
    How can i solve this problem ?
    Thanks Mahi

    DB:3.32:Hibernate Connection Lost 7p

    You can start by providing some forensics and some insight into what you currently have. Full stacktrace, code, current configuration, etc? Are you using seam managed persistence context? What does your current EntityManager configuration look like? EJB/POJO? EAR/WAR? 1M records (assuming that's what you meant), in itself, isn't particularly concerning.

  • RELEVANCY SCORE 3.31

    DB:3.31:Bgp Flapping Due To Closed Tcp Connection 8a



    bgp connection is flapping and on checking the neighbor statstics we get following message - keepalive are termporarily in throtlle due to closed tcp window

    DB:3.31:Bgp Flapping Due To Closed Tcp Connection 8a


    just a doubt if can help with...i beleive MTU is negotiated while establishing a tcp connection and which ever is smaller from both the end interfaces is selected. so why did bgp have a problem ?

  • RELEVANCY SCORE 3.30

    DB:3.30:Resultsets Are Not Closed ma


    some times i notice resultsets are not closed though connection and preparedstatements are closed. how meaningful is this ?

    DB:3.30:Resultsets Are Not Closed ma

    I don't know.

    I always explicitly close my ResultSets, so it's not an issue.

  • RELEVANCY SCORE 3.29

    DB:3.29:How To Close Timeout Connection In Sqldbc ? zc



    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

    DB:3.29:How To Close Timeout Connection In Sqldbc ? zc


    Hello,

    I add RECONNECT properties but it does not change any thing.

    Here is the new code :

    SQLDBC::SQLDBC_ConnectProperties properties;

    properties.setProperty("RECONNECT", "0");

    rc = conn-connect(connectArgs.host, connectArgs.dbname,

    connectArgs.username, connectArgs.password, properties);

    Do you have any idea how to avoid leak ?

    Can I manually close task as a workaround ?

    Yann.

  • RELEVANCY SCORE 3.29

    DB:3.29:Closed Connection From Connection Pool pk


    Hi All,

    We are experiencing closed connection sometimes when we run sql on a connection retrieved from connection pool.

    Here is how we set up connection pool:

    ods = new OracleDataSource();
    ods.setDriverType("thin");
    ods.setURL("whatever");
    ods.setUser("dbuser");
    ods.setPassword("dbpwd");
    ods.setConnectionCachingEnabled(true);
    if ( failOverEnabled) {
    ods.setFastConnectionFailoverEnabled(true);
    }

    To obtain conn, we do : ods.getConnection()

    Mostly this works, but sometimes when we let the pool idle over night, next morning SQL statements run from app server code run into closed connections.

    How to overcome this issue ?. Should we be setting connection params ?. If so which ones. DB and JDBC 10.2.04.

    Thanks for any help.

    Vissu

    DB:3.29:Closed Connection From Connection Pool pk

    Hi. In order to get any benefit from FCF, you would also
    have to specify the ONSConfiguration property, so the
    driver gets notifications. However, fast failover isn't
    going to be able to reconstitute any statements or
    computational programing state when a connection
    fails or is closed. Any application code that is retaining
    a now-dead connection must close that connection and
    make new statements with a new connection.
    FCF enables your code to quickly get a new good
    connection, not to transparently replace connections
    that are in application hands.
    When using connection pooling, the best coding
    style is to get, use, and close a connection ASAP,
    for each user invoke. The driver can cache statements
    and connections, so all those create calls will be quick,
    and then you will be much less exposed to connections
    that are killed by idleness, which will then be mostly
    when the connections are in the driver's pool, unused
    by the application.

    Joe Weinstein

  • RELEVANCY SCORE 3.28

    DB:3.28:The Underlying Connection Was Closed: A Connection That Was Expected To Be Kept Alive Was Closed By The Server sm


    Dear forum
    Please help
    I'm running an application that receive some messages (mail)
    I'm running under server 2012.
    For some reason the messages are stop to being received due to the session that is being closed.
    i can read the log saying:
    HTTPS ReceiveProcess(): Null segement received
    Closing session, dispatch Timer: 60000 ms.
    The underlying connection was closed: A connection that was expected to be kept alive was closed by the
    server
    Changing session Thread Time from 60 000ms to 2000ms.
    BatapWebService socket closed.

    Can anyone tell me how to fix that it's very annoyin that is closing the connexion and my messages are not
    being received.
    I need to restart the server each time to be able to receive all messages.
    is that a parameter i have to change?
    please help

    DB:3.28:The Underlying Connection Was Closed: A Connection That Was Expected To Be Kept Alive Was Closed By The Server sm

    I'm not familiar with that app. Looking it up, it appears to be an air travel industry (aerospace, airline, airtraffic control,government, etc)messaging system.

    http://www.sita.aero/
    Since you have it running on Windows 2012, there may be an incompatibility. I would suggest at this time to contact their support department for assistance.Ace Fekay
    MVP, MCT, MCSE 2012, MCITP EA & MCTS Windows 2008/R2, Exchange 2013, 2010 EA & 2007, MCSE & MCSA 2003/2000, MCSA Messaging 2003
    Microsoft Certified Trainer
    Microsoft MVP - Directory Services
    Complete List of Technical Blogs: http://www.delawarecountycomputerconsulting.com/technicalblogs.php

    This posting is provided AS-IS with no warranties or guarantees and confers no rights.

  • RELEVANCY SCORE 3.27

    DB:3.27:Re: Closed Connection, While Borrowed From Ucp (Maxconnectionsreusetime Is Set) fs


    I would turn on JDBC logging and see when the connection is closed.

    DB:3.27:Re: Closed Connection, While Borrowed From Ucp (Maxconnectionsreusetime Is Set) fs

    I used: - ucp in version 11.2.0.1.0 - ojdbc in version 11.2.0.2.0 - connected to oracle 10g r2 ( 10.2.0.1.0 ) Documentation of UCP clearly says for maxConnectionReuseTime: - borrowed connections are closed only after they are returned to the pool and the reuse time has been exceeded My Junit-Testcase on the other hand shows, that the connection is closed, while it is borrowed from pool and therefore raises an exception. Can anyone reproduce this? ----- import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Date; import java.util.logging.Level; import java.util.logging.Logger; import junit.framework.TestCase; import oracle.ucp.UniversalConnectionPoolAdapter; import oracle.ucp.admin.UniversalConnectionPoolManager; import oracle.ucp.admin.UniversalConnectionPoolManagerImpl; import oracle.ucp.jdbc.PoolDataSource; import oracle.ucp.jdbc.PoolDataSourceFactory; public class UCPTest extends TestCase { private String user = "xxx"; private String pass = "xxx"; private String url = "jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.90)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = db.oracle.com)))"; private String poolname = "testpool"; private PoolDataSource pds; private UniversalConnectionPoolManager mgr; private int maxConnectionReUseTime = 5; // in seconds @Override protected void setUp() throws Exception { Logger.getLogger("oracle.ucp").setLevel(java.util.logging.Level.FINEST); Logger.getLogger("oracle.ucp.jdbc.PoolDataSource").setLevel(java.util.logging.Level.FINEST); mgr = UniversalConnectionPoolManagerImpl.getUniversalConnectionPoolManager(); mgr.setLogLevel(Level.FINE); pds = PoolDataSourceFactory.getPoolDataSource(); pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource"); pds.setUser(user); pds.setPassword(pass); pds.setURL(url); pds.setInitialPoolSize(1); pds.setMaxPoolSize(10); pds.setConnectionPoolName(poolname); // timer starts, when phys connection is created. // borrowed connection is closed only after it is returned to the pool and reuse time has been exceeded (not while using it!) pds.setMaxConnectionReuseTime(maxConnectionReUseTime); mgr.createConnectionPool((UniversalConnectionPoolAdapter)pds); mgr.startConnectionPool(poolname); } @Override protected void tearDown() throws Exception { mgr.destroyConnectionPool(poolname); super.tearDown(); } public void testPool() throws Exception { // documentation: http://download.oracle.com/docs/cd/E14072_01/java.112/e12265.pdf // assert that harvesting feature is OFF (equal to Integer.MAX_VALUE according to documentation assertEquals(pds.getConnectionHarvestTriggerCount(), Integer.MAX_VALUE); // assert that ttl is OFF and does not interfere assertEquals(pds.getTimeToLiveConnectionTimeout(),0); // documentation in page 4-3 says: "Borrowed connections are closed only after they are returned to the pool and the reuse time has been exceeded". // = a borrowed connection is not closed! // = a borrowed connection is closed only, when connection is returned to pool and reuse time has been exceeded // so, borrow the connection from the pool and dont return it before reuse time Connection c = pds.getConnection(); // do something with it for at least the maxconnectionreusetime // this should not raise an exception, since we never return the borrowed connection before that reuse time int workingTime = maxConnectionReUseTime + pds.getTimeoutCheckInterval()+5; System.out.println(new Date()); try { for(int i = 1; i workingTime; i++) { PreparedStatement ps = c.prepareStatement("select 1 from dual"); ResultSet rs = ps.executeQuery(); while (rs.next()) { // sunshine. } rs.close(); ps.close(); // sleep a second Thread.sleep(1000); } } catch (SQLException ex) { System.out.println(ex.getErrorCode()); // 31 means connection is closed fail(); } finally { System.out.println(new Date()); c.close(); } } }

  • RELEVANCY SCORE 3.27

    DB:3.27:Connecting To Sharepoint Online List Via Odata Feed Is Giving An Error. zz


    I am trying to access my OData feed. It seems to only work in the browser after I have first logged into the site. So how do I log in when trying to access the feed from C#? I am actually doing this in a metro app. I have tried the following but each time
    it takes about 30 seconds and then it returns to the callback with an exception:
    ServiceReference1.TeamSiteDataContext c = new TeamSiteDataContext(new Uri(http://myteamsite.sharepoint.com/TeamSite/_vti_bin/listdata.svc));
    DataServiceQueryServiceReference1.ListTest2Item query = (DataServiceQueryServiceReference1.ListTest2Item)c.ListTest2;

    c.Credentials = new NetworkCredential(bcollins@myteamsite.onmicrosoft.com, mypassword);

    var task = TaskIEnumerableServiceReference1.ListTest2Item.Factory.FromAsync(query.BeginExecute, query.EndExecute, null);
    var result = await task.ContinueWith(t =
    {
    if (t.Exception == null)
    return t.Result.ToList();
    else
    return null;
    });

    The full error is:

    There was an error downloading 'http://myteamsite.sharepoint.com/teamsite/_vti_bin/ListData.svc/ListTest2/_vti_bin/ListData.svc/$metadata'.
    The underlying connection was closed: An unexpected error occurred on a receive.
    Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
    An existing connection was forcibly closed by the remote host
    Metadata contains a reference that cannot be resolved: 'http://myteamsite.sharepoint.com/teamsite/_vti_bin/ListData.svc/ListTest2'.
    An error occurred while receiving the HTTP response to http://myteamsite.sharepoint.com/teamsite/_vti_bin/ListData.svc/ListTest2.
    This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.
    The underlying connection was closed: An unexpected error occurred on a receive.
    Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
    An existing connection was forcibly closed by the remote host
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    DB:3.27:Connecting To Sharepoint Online List Via Odata Feed Is Giving An Error. zz

    Office 365 implements Active Authentication. . In Office 365 the STS is located at

    https://login.microsoftonline.com/extSTS.srf. To request the token from the STS we pass the username and password using the SAML 1.1 protocol. If the authentication is successful the STS returns a security token. This security token is sent to SharePoint
    and if SharePoint successfully validates the token it will return two cookies (called
    FedAuth and rtFa). These two tokens must then be passed along with all requests to SharePoint.
    To be able to remotely invoke methods on SharePoint Online using Client Object Model (CSOM), web services or WebDAV we need to authenticate first, according to above. Then we need to pass along the cookies for each request. And this is how we do it. Once
    you have the cookies (FedAuth and rtFA) you need to create a
    CookieContainer object in which you add the cookies. This CookieContainer must then be added to the request done by the Client Object Model before the request is done. The

    client runtime Context object has an event called
    ExecutingWebRequest that can be used for this.
    Once both the cookies are received then on every request to theshare pointonline should go with this cookie header then SP online can use these headers toauthenticatethe request
    Use below blog for more details
    http://msdn.microsoft.com/en-us/library/hh147177.aspx

    suryakant

  • RELEVANCY SCORE 3.27

    DB:3.27:Connection Leakage jm


    Ours is a web application using struts framework running in Weblogic 8.1 with Oracle 8.1

    The application while running is throwing connection leakage error.

    In the DAO classes, for each method, we are getting the connection object and after the db transaction, closing the connection. Below I am giving a sample code.
    We have a class DBUtil which handles the action of getting connection from the pool and closing which in turn returns to the pool. All methods including closeConnection(Connection conn) are static methods.

    Another thing to note is the leakage error comes when multiple users run the application at the same time.

    Sample Code :
    public void getResults().......{
    Connection conn;
    try{
    conn = getDBConnection(); //getting from pool using datasource.
    }catch()...
    .........
    finally{
    DBUtil.closeConnection(conn);
    }
    }

    public static void closeConnection (Connection con) throws UtilException {

    try {
    if(con != null !con.isClosed()) {
    Debug.debug("******* Connection Getting Closed.******* : "+con);
    con.close();
    --openConnections;
    Debug.debug("******* Connection Closed.******* [ No. Of Open Connections : "+openConnections+" ]");
    }
    }
    catch (Exception ex) {
    throw new UtilException ("DBUtil.closeConnection(Connection)", ex, ErrorCodes.ERROR_CONN_CLOSURE);
    }
    }

    Please help me as early as possible.

    DB:3.27:Connection Leakage jm

    Rajitha R Krishnan wrote:

    Ours is a web application using struts framework running in Weblogic 8.1 with Oracle 8.1

    The application while running is throwing connection leakage error.

    In the DAO classes, for each method, we are getting the connection object and after the db transaction, closing the connection. Below I am giving a sample code.
    We have a class DBUtil which handles the action of getting connection from the pool and closing which in turn returns to the pool. All methods including closeConnection(Connection conn) are static methods.

    Another thing to note is the leakage error comes when multiple users run the application at the same time.

    Sample Code :
    public void getResults().......{
    Connection conn;
    try{
    conn = getDBConnection(); //getting from pool using datasource.
    }catch()...
    .........
    finally{
    DBUtil.closeConnection(conn);
    }
    }

    public static void closeConnection (Connection con) throws UtilException {

    try {
    if(con != null !con.isClosed()) {
    Debug.debug("******* Connection Getting Closed.******* : "+con);
    con.close();
    --openConnections;
    Debug.debug("******* Connection Closed.******* [ No. Of Open Connections : "+openConnections+" ]");
    }
    }
    catch (Exception ex) {
    throw new UtilException ("DBUtil.closeConnection(Connection)", ex, ErrorCodes.ERROR_CONN_CLOSURE);
    }
    }

    Please help me as early as possible.Hi. The first thing I see is that your closeConnection() method
    should not check isClosed(). Just close it. If you ever close
    a connection more than once and get an exception, you need to
    know it and fix your code that's exposing it to multiple
    closes. What service pack level of 8.1 are you running?
    When you get your Debug output, do you always see the
    right number of "Connection Getting Closed" messages and
    "No. Of Open Connections :" with the right number? Is there
    a matching message in getConnection() that prints out the
    connection too, and shows the open connection number?
    Joe

  • RELEVANCY SCORE 3.27

    DB:3.27:Httpconnection Establishment Error -Please Help!!!! 3f


    Hi
    I am using J2ME for mobile developments for blackberry phones. Hope this forum could help me solve my problem.
    In my application I need to establish HttpConnection or StreamConnection successfully. I need to give the parameters of APN settings in the code itself, without manually entering the APN settings in the phone. Therefore I have cleared all the APN settings in the phone.

    I have written the following code segments,

    HttpConnection connection = null;
    InputStream stream = null;
    StringBuffer b = new StringBuffer();

    *try {*
    connection = (HttpConnection)Connector.open("http://www.google.com/"";WAPGatewayIP=IP"";WapGatewayAPN=APN") ;
    stream = connection.openInputStream();
    boolean firstItr = true;
    int test=0;
    int ch;
    *while ((ch = stream.read()) != -1) {*
    b.append((char) ch);

    *if(firstItr){*
    test = ch;
    firstItr = false;
    *}*
    *}*
    Form form = new Form("Test");
    form.append(b.toString());
    Alert aleart = new Alert(null,"Connection successful \n"+test, null, AlertType.INFO);

    aleart.setTimeout(1000);
    Display.getDisplay(this).setCurrent(aleart,form);
    stream.close();
    connection.close();
    System.out.println("connection closed");
    destroyApp(false);
    *} catch (IOException e) {*
    Alert aleart = new Alert(null,"Connection unsuccessful "+e.toString(), null, AlertType.ERROR);
    aleart.setTimeout(1000);
    Display.getDisplay(this).setCurrent(aleart);
    *}*

    That is the code i have written. Sometimes the connection establishment throws no exceptions but it doesnt give out any data. The method '*stream.read()*' returns -1 always.

    At some instances the connection does not establish successfully and throws an open tunnel IOEXception.

    Please help me to overcome this issue. I have done a lot of internet search but still failed to find an answer. I will be very greatful a is anyone can help me in this.

    DB:3.27:Httpconnection Establishment Error -Please Help!!!! 3f

    My honest advice, setup a local wap server and gateway and test it with. sometimes. if your code works locally, then it might be that google or whosoever sets up that wap gateway is playing pranks with you.

    Another thing is if you are not the one who sets up the gateway, why dont you contatct the person, he will be in the best position to help. Recently i got problems connecting to google mail through my code too using both the xml and php api

    ciao

  • RELEVANCY SCORE 3.26

    DB:3.26:Connection Object 3j



    After the connection Object is used, it is closed

    con.close(); // this will close the connection

    con = null; // Is it a must to give this line ??? or is it advisable to equal it to null;

    DB:3.26:Connection Object 3j

    close() i sused by connection to disconnect from database and free some resources but it doesn't make connection object to be garbage collected.
    setting conn to null is hint to garbage collector: "I do not need this object any more".

    So calling close() is must for good code and setting to null is polite but not very neccessary. It is more important where you create a lot of short live objects eg. in loop.

  • RELEVANCY SCORE 3.26

    DB:3.26:Unity Connection Schedules pj



    We have a client who's office is closed every First and Third Friday of each month... When creating an office hours schedule in Unity Connection is there a way to specify Closed on these days without having to add each one specifically, say as a holiday?

    DB:3.26:Unity Connection Schedules pj


    Hi Joshua,

    You'll have to configure these days as Holidays

    The regular "schedules" are based on a repeating 1 week (7 day)

    timeframe.

    Cheers!

    Rob

  • RELEVANCY SCORE 3.26

    DB:3.26:Closed Statement And Closed Connection 3p


    I am getting two seperate occurrences of Closed Statement and Closed Connection. The Closed Connection error is actually thrown from a RuntimeException catch block from a throw clause:

    catch (SQLException e) {
    OraPool.rollback( ctx );//db connection pool
    throw e;
    }
    catch (RuntimeException e) {
    OraPool.rollback( ctx );
    throw e;//-- SQL Exception thrown from here
    }I am wondering if the thrown exception is a SQLException then why is it not being caught within the SQLException block?
    Has anybody experienced this?

    DB:3.26:Closed Statement And Closed Connection 3p

    Hmm.. thanks guys...So I need to really trap what the RuntimeException is all about.

  • RELEVANCY SCORE 3.25

    DB:3.25:Connection Release fc


    I have question regarding the release of connections back to the connection pool. If a connection is not explicitly released by an object, is that connection returned back to the connection pool when the object is destroyed or is the connection actually closed. I am assuming that the connection is actually returned back to the connection pool.

    If the connection is returned back to the connection pool, is it only returned back when the object is destroyed or does weblogic identify unused connections and return them back to the connection pool even before the garbage collector kicks in.

    DB:3.25:Connection Release fc


    "Ragu Sarma" rss@dcmsolutions.com wrote in message
    news:3d1c82e1$1@newsgroups.bea.com...
    I have question regarding the release of connections back to theconnection pool. If a connection is not explicitly released by an object, is
    that connection returned back to the connection pool when the object is
    destroyed or is the connection actually closed.

    That's right

    If the connection is returned back to the connection pool, is it onlyreturned back when the object is destroyed or does weblogic identify unused
    connections and return them back to the connection pool even before the
    garbage collector kicks in.

    This is not correct. There is no way to identify "unused" connection
    untill it's garbage collected.

    Regards,

    Slava Imeshev

  • RELEVANCY SCORE 3.25

    DB:3.25:Pooled/Cached Connection And Statement Caching pd


    REPOST:-
    I have found that with both a Pooled Connection and a Cached Connection if you enable statement caching you will get connection closed errors on any call after the first logical connection is closed.
    Is there any fix or work around besides either not using cached statements or oracles conn pool?

    Tks
    Rob

    null

    DB:3.25:Pooled/Cached Connection And Statement Caching pd

    Rob
    where did you find the pooled/cached connection support? what platform are you using? i'm looking for this sort of support for JDBC connection on my linux box (where i'm doing my development).
    Thanks,
    Kevin.

  • RELEVANCY SCORE 3.25

    DB:3.25:The Peer Prematurely Closed The Connection Error zf


     
    When I tried to Access the 2005 cube through the ADODB  The peer prematurely closed the connection error error is coming the line con.Open(conn,sa,,0)
    and the connection string is
     
    string conn=Provider=MSOLAP;Data Source=.;Initial Catalog=Adventure Works Dw;Thanks in advance

    DB:3.25:The Peer Prematurely Closed The Connection Error zf

    It's possibly some sort of authentication error. Are your client and SSAS server in the same domain?
     
    The following whitepaper has some good information on troubleshooting connection issues http://www.microsoft.com/technet/prodtechnol/sql/bestpractice/cisql2005ascs.mspx
     

  • RELEVANCY SCORE 3.25

    DB:3.25:Why Transaction Connection Becomes Null After Calling Transaction Commit()? ca


    Hi, we are using Oracle.DataAccess version 2.111.6.0.

    Notice that after a Transaction Commit() is called, immediately the Connection becomes null.

    We created the Transaction like this in one method:

    connection = new OracleConnection(connectionString);
    connection.Open();
    transaction = connection.BeginTransaction();

    After that, the transaction object is passed along for various db operations. At the end of the transaction, we call:

    transaction.Commit();

    After that,

    transaction.Connection is null.

    Why? Do we need not to worry about the Connection not being Closed and Disposed?

    Thank you very much!

    Regards,

    Ping

  • RELEVANCY SCORE 3.25

    DB:3.25:Oracle Forms And Internet Connection 9m


    Is it necessary to have a running Internet connection to run the forms. I am using Oracle froms 10g they run good when my internet connection is active and dont display on browser when internet connection is closed/disconnected.
    Is there way to run forms without connection of internet. I mean stand alone environment.

    Regards

    DB:3.25:Oracle Forms And Internet Connection 9m

    Hi!

    You do not need a internet connection to runs forms,
    but you need a active network connection.

    If you remove to cable from your network adapter,
    you will have problems with network applications like forms and the database listener.

    Try to install the Microsoft loopback adatper.
    Here is a link to the how to: [http://support.microsoft.com/kb/839013]

    Regards

  • RELEVANCY SCORE 3.25

    DB:3.25:How To Setup Oracle Connection Pool In Servlet ? mp


    Here is the sample from Oracle to setup connection pool:

    http://technet.oracle.com/sample_code/tech/java/sqlj_jdbc/files/jdbc20/ConnectionPooling/Readme.html

    please note:
    PooledConnection pooledconn = null;
    Connection connection = null;

    These two variables are local variable they are not close explicitly if no Exception is thrown. They suppose to be closed by garbage collection. But if PooledConnection is close the physical connection to database is also closed!

    Please shed some light here.

    DB:3.25:How To Setup Oracle Connection Pool In Servlet ? mp

    Thank you I got the answer myself.
    http://technet.oracle.com/sample_code/tech/java/sqlj_jdbc/files/jdbc20/ConnectionPooling/Readme.html

  • RELEVANCY SCORE 3.25

    DB:3.25:Closing Connection Closes The Result Sets ? z8


    Is it true that if you close a connection, all the results sets
    associated with that connection will be also closed and you don't have
    to close them ?

    DB:3.25:Closing Connection Closes The Result Sets ? z8

    Horea Raducan wrote:

    Is it true that if you close a connection, all the results sets
    associated with that connection will be also closed and you don't have
    to close them ?Yes. This is mandated by the JDBC spec. For safety and performance,
    however, it is best if you close the result set asap, then close the
    statement asap, and most crucially, never forget to close the connection.
    The reason why you want to close resultsets and statements asap,
    is because they may involve DBMS resources like cursors etc, and these
    can be freed for re-use when you close the object, but may remain
    unuseable for a while if you rely on the connection close() to
    clean up after you.
    Joe

  • RELEVANCY SCORE 3.25

    DB:3.25:Maintaining Active Directory Connection c8


    Hi,

    I'm using LDAP to connect to Active Directory. I'm maintaining a static connection; so that all users can use the same connection and this connection is not closed. But, I observed that this connection gets automatically closed after some time, say 10 mins.
    Any idea why this happens. Is there any way to check whether the connection is still open? Please help.

    Thanks in advance
    Jenz

    DB:3.25:Maintaining Active Directory Connection c8

    Hi,

    I'm using LDAP to connect to Active Directory. I'm maintaining a static connection; so that all users can use the same connection and this connection is not closed. But, I observed that this connection gets automatically closed after some time, say 10 mins.
    Any idea why this happens. Is there any way to check whether the connection is still open? Please help.

    Thanks in advance
    Jenz

  • RELEVANCY SCORE 3.24

    DB:3.24:Have Doubt?? Can Any One Clear It zc


    Hi guys i have doubt.It will be nice if
    some one clears it
    around.
    Question:
    when making a connection to the database using
    ConnectionPooling should we close
    connection,statementobject and resultSet.
    like this(this is the way i am doing too.)
    try
    {
    ---opening a connection,rs,stmt
    other code
    ---
    ---
    }catch() {
    ---
    }
    finally{
    if(rs!=null)
    rs.close();
    if(stmt!=null)
    stmt.close();
    if(conn!=null)
    conn.close()
    }
    Doubt:
    Is it not Sufficient to close the connection.Can any one
    explain in detail why resultset and statment should be
    closed.

    DB:3.24:Have Doubt?? Can Any One Clear It zc

    The result set and statement must always be closed when you are done with them.

    The connection is always returned to the pool. How that is done depends on the pool.

  • RELEVANCY SCORE 3.24

    DB:3.24:Invalid Attempt To Call Read When Reader Is Closed c1


    I use same connection for multiple DataContexts (connections are pooled anyway, right?). And i never call Connection.Close() manualy. For some unknown reason at foreach connection.State is Closed. Any ideas why connection might be closed? And why LINQ doens't open it automaticaly?

    Code Snippet

    DB:3.24:Invalid Attempt To Call Read When Reader Is Closed c1

    I have the same problem.
    Is anybody know what I do wrong?
     

  • RELEVANCY SCORE 3.23

    DB:3.23:"Connection Closed By Foreign Host" When Telent Iphone Ip From Mac Terminal z9


    Issue: "connection closed by foreign host"Precondition:My mac and iPhone on same networkMac IP: 192.168.22.48iPhone IP:192.168.22.10Open the terminalhit 192.168.22.10 37265Press enter keyTrying 192.168.22.48...Connected to 192.168.22.48.Escape character is '^]'.Connection closed by foreign host.its connected, but after few second its closed.please suggest how can resolve this issue.

    DB:3.23:"Connection Closed By Foreign Host" When Telent Iphone Ip From Mac Terminal z9

    Issue: "connection closed by foreign host"Precondition:My mac and iPhone on same networkMac IP: 192.168.22.48iPhone IP:192.168.22.10Open the terminalhit 192.168.22.10 37265Press enter keyTrying 192.168.22.48...Connected to 192.168.22.48.Escape character is '^]'.Connection closed by foreign host.its connected, but after few second its closed.please suggest how can resolve this issue.

  • RELEVANCY SCORE 3.23

    DB:3.23:How To Create Jndi Name In Jboss 3 3f


    in weblogin i know how to create JNDI name for database connection purpose, but i don't know how to create the JNDI in Jboss3

    my friend gave this but i am having some doubts in this please clarify my doubt that is please explain these two statments present i am using mssql server 2000
    env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
    env.put(Context.PROVIDER_URL, "jnp://localhost:1099");

    import java.sql.*;
    import java.util.*;
    import javax.sql.DataSource;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.transaction.UserTransaction;
    import org.apache.log4j.Logger;

    public class DataSourceManager
    {
    private static Logger logger = Logger.getLogger(DataSourceManager.class);

    private Context initialContext = null;
    private DataSource dataSource = null;
    private static DataSourceManager instance = null;

    public Connection getConnection()
    {
    Connection connection = null;
    try
    {
    connection = dataSource.getConnection();
    if (connection != null)
    {
    logger.debug("DataSourceManager: Connection Granted...");
    }
    }
    catch (SQLException se)
    {
    logger.error("DataSourceManager: Error in getting connection : " + se);
    }
    return connection;
    }

    /*
    * DataSourceManager constructor initializes the DataSource
    */
    private DataSourceManager()
    {
    try
    {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
    env.put(Context.PROVIDER_URL, "jnp://localhost:1099");

    /* Initialize context and dataSource */
    initialContext = new InitialContext(env);

    dataSource = (DataSource)initialContext.lookup("java:/PointBaseDS");
    }
    catch (Exception e)
    {
    e.printStackTrace();
    logger.error("Exception in setting DataSource: " + e.getMessage());
    }
    }

    /*
    * getInstance method for the DataSourceManager
    */
    public static synchronized DataSourceManager getInstance()
    {
    if (instance == null)
    instance = new DataSourceManager();

    return instance;

    }

    public void freeConnection(Connection conn)
    {
    if (conn != null)
    {
    try
    {
    logger.debug("DataSourceManager: Closing Connection " + conn);
    conn.close();
    logger.debug("DataSourceManager: is Connection closed? " + conn.isClosed());
    }
    catch (SQLException se)
    {
    logger.error("DataSourceManager: Error in closing connection : " + se);
    }
    }
    }

    /* get current timestamp in sql date format */
    public static java.sql.Timestamp getSqlTimeStamp()
    {
    java.sql.Timestamp current = new java.sql.Timestamp(new java.util.Date().getTime());
    return current;
    }

    /**
    * Return a new transaction object
    * @return User Transactio object
    */
    public UserTransaction getTransaction()
    {
    UserTransaction ut = null;
    try
    {
    ut = (UserTransaction) initialContext.lookup("java:comp/UserTransaction");
    return ut;
    }
    catch (javax.naming.NamingException nme)
    {
    nme.printStackTrace();
    logger.error("Exception in Getting a Transaction Object: " + nme.getMessage());
    }

    DB:3.23:How To Create Jndi Name In Jboss 3 3f

    in weblogin i know how to create JNDI name for database connection purpose, but i don't know how to create the JNDI in Jboss3

    my friend gave this but i am having some doubts in this please clarify my doubt that is please explain these two statments present i am using mssql server 2000
    env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
    env.put(Context.PROVIDER_URL, "jnp://localhost:1099");

    import java.sql.*;
    import java.util.*;
    import javax.sql.DataSource;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.transaction.UserTransaction;
    import org.apache.log4j.Logger;

    public class DataSourceManager
    {
    private static Logger logger = Logger.getLogger(DataSourceManager.class);

    private Context initialContext = null;
    private DataSource dataSource = null;
    private static DataSourceManager instance = null;

    public Connection getConnection()
    {
    Connection connection = null;
    try
    {
    connection = dataSource.getConnection();
    if (connection != null)
    {
    logger.debug("DataSourceManager: Connection Granted...");
    }
    }
    catch (SQLException se)
    {
    logger.error("DataSourceManager: Error in getting connection : " + se);
    }
    return connection;
    }

    /*
    * DataSourceManager constructor initializes the DataSource
    */
    private DataSourceManager()
    {
    try
    {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
    env.put(Context.PROVIDER_URL, "jnp://localhost:1099");

    /* Initialize context and dataSource */
    initialContext = new InitialContext(env);

    dataSource = (DataSource)initialContext.lookup("java:/PointBaseDS");
    }
    catch (Exception e)
    {
    e.printStackTrace();
    logger.error("Exception in setting DataSource: " + e.getMessage());
    }
    }

    /*
    * getInstance method for the DataSourceManager
    */
    public static synchronized DataSourceManager getInstance()
    {
    if (instance == null)
    instance = new DataSourceManager();

    return instance;

    }

    public void freeConnection(Connection conn)
    {
    if (conn != null)
    {
    try
    {
    logger.debug("DataSourceManager: Closing Connection " + conn);
    conn.close();
    logger.debug("DataSourceManager: is Connection closed? " + conn.isClosed());
    }
    catch (SQLException se)
    {
    logger.error("DataSourceManager: Error in closing connection : " + se);
    }
    }
    }

    /* get current timestamp in sql date format */
    public static java.sql.Timestamp getSqlTimeStamp()
    {
    java.sql.Timestamp current = new java.sql.Timestamp(new java.util.Date().getTime());
    return current;
    }

    /**
    * Return a new transaction object
    * @return User Transactio object
    */
    public UserTransaction getTransaction()
    {
    UserTransaction ut = null;
    try
    {
    ut = (UserTransaction) initialContext.lookup("java:comp/UserTransaction");
    return ut;
    }
    catch (javax.naming.NamingException nme)
    {
    nme.printStackTrace();
    logger.error("Exception in Getting a Transaction Object: " + nme.getMessage());
    }

  • RELEVANCY SCORE 3.23

    DB:3.23:Closing Http Connection 73


    Hi,

    I was wondering if following code guarantees that HTTP connection will be closed no matter what.

    Considering any type of exception that might be thrown, following code should close the connection. Would you please confirm this?

    HttpConnection connection = null;
    InputStream is = null;
    OutputStream os = null;

    try{

    connection = (HttpConnection)Connector.open(url, Connector.READ);
    // some settings:

    os = connection.openOutputStream();

    // some processing

    is = connection.openDataInputStream();

    // some more processing

    } finally {

    if(is!= null) {
    try{
    is.close();
    }catch(IOException e){/ do nothing }
    }
    if(os != null) {
    try{
    os.close();
    }catch(IOException e){/ do nothing }
    }
    if(connection != null) {
    try{
    connection.close();
    }catch(IOException e){/ do nothing }
    }

    }

    Thanks,
    S.

    DB:3.23:Closing Http Connection 73

    If OutputStream or InputStream close() method throws an exception (in circumstances), what would be the case with the stream? will it remain open? or will be closed by the system?

    Thanks,
    Sasan

  • RELEVANCY SCORE 3.22

    DB:3.22:Destroying Connection That Could Not Be Successfully Matched jc



    Hi!Using JBoss 4.0.5.GA-ejb3, Hibernate 3.2Can someone explain what this means?Is the connection closed and removed from the pool when matchManagedConnections returns null?

    2007-01-19 15:16:15,045 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Destroying connection that could not be successfully matched:
    org.jboss.resource.connectionmanager.NoTxConnectionManager$NoTxConnectionEventListener@47ee47ee[state=NORMAL mc=fi.logiasoftware.jca.adapter.GenericManagedC
    onnection@645e645e handles=0 lastUse=1169212574965 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@7
    6ba76ba context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@59d859d8]

    DB:3.22:Destroying Connection That Could Not Be Successfully Matched jc


    Hi guys,I am getting the below exception as well. Whats the work around for this? I am not sure how to resolve this issue.Thanks.--Narasimha

  • RELEVANCY SCORE 3.22

    DB:3.22:Jsp Jdbc Connection fc


    One single Jsp page is requested and at begining only i made Databse Connection and end of Page this connection is closed. Is it fesibile to do like this or keep connection as long as session is mentained.If yes then can we hold connection object in a session.

    DB:3.22:Jsp Jdbc Connection fc

    It is very bad to close the connection when the user is finished with it.

    It takes from 500 - 6000 ms to open a connection, and much the same on closing.

    2 x 500-6000ms = Performance nightmare.

    You should use a connection pool.

    [In which case of course you will close the connection at the end - but not really]

  • RELEVANCY SCORE 3.21

    DB:3.21:Unexpected Closed Connections d1



    We are running Weblogic 5.1 sp10 on SUN OS 5.8 with JDK 1.3/SYBASE JConnect 5.2.
    After we changed the program to use connection pooling from regular JDBC connection,
    the connection could randomly be closed even within the scope. By inserting some
    println statements, we found that result set, statement and connection are closed
    and null. Can someone shed some light on this?

    Here is the snippet of the code

    try
    {
    db = new Database(poolName);
    con = db.getConnection();

    stmt = con.createStatement();
    stmt.execute(q1);
    rs = stmt.executeQuery(query);
    if (!rs.next()) {

    return null;
    }

    MOSdeal mosDeal = new MOSdeal(rs);
    return (mosDeal);
    } catch (SQLException e) {
    log.write("SQLException in DealEntity - " + e.getMessage() +"\n"
    );
    throw e;
    } catch (MOSException e) {
    throw e;
    } finally {
    try {
    rs.close();
    stmt.close();
    db.close();
    } catch (Exception ignore)
    {
    System.out.println("Deal Entity closing connection error");
    System.out.println("The stack trace is ");
    ignore.printStackTrace();
    }
    }

    DB:3.21:Unexpected Closed Connections d1


    We are running Weblogic 5.1 sp10 on SUN OS 5.8 with JDK 1.3/SYBASE JConnect 5.2.
    After we changed the program to use connection pooling from regular JDBC connection,
    the connection could randomly be closed even within the scope. By inserting some
    println statements, we found that result set, statement and connection are closed
    and null. Can someone shed some light on this?

    Here is the snippet of the code

    try
    {
    db = new Database(poolName);
    con = db.getConnection();

    stmt = con.createStatement();
    stmt.execute(q1);
    rs = stmt.executeQuery(query);
    if (!rs.next()) {

    return null;
    }

    MOSdeal mosDeal = new MOSdeal(rs);
    return (mosDeal);
    } catch (SQLException e) {
    log.write("SQLException in DealEntity - " + e.getMessage() +"\n"
    );
    throw e;
    } catch (MOSException e) {
    throw e;
    } finally {
    try {
    rs.close();
    stmt.close();
    db.close();
    } catch (Exception ignore)
    {
    System.out.println("Deal Entity closing connection error");
    System.out.println("The stack trace is ");
    ignore.printStackTrace();
    }
    }

  • RELEVANCY SCORE 3.21

    DB:3.21:The Underlying Connection Was Closed: The Connection Was Closed Unexpectedly. 8m


    I have aSilverlight-enabled wcf service running in port 3412.
    I created a aspx.vb page and added this service.
    I called the method in service. and i run the application.
    This client application is running in port 3761.
    and it is raising the exception The underlying connection was closed: The connection was closed unexpectedly.
    How to solve this.. Thanks.......

    DB:3.21:The Underlying Connection Was Closed: The Connection Was Closed Unexpectedly. 8m

    let me tell requirement clearly
    I am developing a tool for crreatingWEB applications. what ever the frontend it may be [ASPX or Silverlight or HTML or IPhone etc].
    For this which wcf (normal wcf or Silverlight-Enabled) i have to choose
    I created silverlight-enabled wcf and added toASPX project, then i got above error
    what is the solution for my architecture...

  • RELEVANCY SCORE 3.21

    DB:3.21:Getting Error:Closing A Connection For You. Please Help ks


    Hello All,
    I'm using jboss3.2.6. I used ejb2.1 (session bean and entity bean[BMP]). I did few data base transations in cmp and few in simple data source connection.

    I'm getting below errors occasionally
    'No managed connection exception
    java.lang.OutOfMemoryError: Java heap space
    [CachedConnectionManager] Closing a connection for you. Plea
    se close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@11ed0d
    5

    I've given below my dao connection code here,
    package com.drtrack.util;

    import java.sql.Connection;
    import java.sql.SQLException;

    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.DataSource;

    public class DAOUtil {

    private static DataSource _ds;

    public Connection con;
    public DAOUtil() throws SQLException {

    try {

    if (_ds == null)
    assemble();
    if(_ds != null con == null) {

    con = _ds.getConnection();

    }
    }catch(SQLException ex) {

    ex.printStackTrace();

    }

    }

    private void assemble() {
    Context ic = null;
    try {

    ic = new InitialContext();
    DrTrackUtil drutil = new DrTrackUtil();
    _ds = (DataSource) ic.lookup("java:/" + drutil.getText("SOURCE_DIR"));
    drutil = null;
    }catch (Exception e) {

    e.printStackTrace();

    }finally {
    try {
    ic.close();
    }catch(NamingException ne) {}
    }

    }

    public void closeConnection() throws SQLException {

    if(con != null)
    con.close();

    con = null;
    }

    }below is the code with get connection and doing transaction in it.
    public static AccountMasterValueBean getAccountMasterByAcctId(String acctId) {

    AccountMasterValueBean bean = null;
    DAOUtil dao = null;
    CallableStatement cst = null;
    ResultSet rs = null;
    try {
    dao = new DAOUtil();

    cst = dao.con.prepareCall(DrTrackConstants.MSSQL_USP_ACCOUNTMASTER_BY_ACCTID);
    cst.setObject(1, acctId);

    rs = cst.executeQuery();
    if(rs != null rs.next()) {

    bean = new AccountMasterValueBean(
    Integer.valueOf(rs.getString("accountkeyid")),
    rs.getString("latitude"),
    rs.getString("longitude"));

    }
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    }
    finally {
    if(rs != null){
    try {
    rs.close();
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    }
    finally {
    rs = null;
    }
    }
    if(cst != null) {
    try{
    cst.close();
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    }
    finally {
    cst = null;
    }
    }
    if(dao != null) {
    try {
    dao.closeConnection();
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    }
    finally {
    dao = null;
    }
    }
    }
    return bean;
    }I closed connections, resultsets and statements properly.
    Why I'm getting these errors.? Where I'm doing wrong. ? Please help me. I have to fix them ASAP.

    Thanks.

    DB:3.21:Getting Error:Closing A Connection For You. Please Help ks

    Hello All,
    I'm using jboss3.2.6. I used ejb2.1 (session bean and entity bean[BMP]). I did few data base transations in cmp and few in simple data source connection.

    I'm getting below errors occasionally
    'No managed connection exception
    java.lang.OutOfMemoryError: Java heap space
    [CachedConnectionManager] Closing a connection for you. Plea
    se close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@11ed0d
    5

    I've given below my dao connection code here,
    package com.drtrack.util;

    import java.sql.Connection;
    import java.sql.SQLException;

    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.DataSource;

    public class DAOUtil {

    private static DataSource _ds;

    public Connection con;
    public DAOUtil() throws SQLException {

    try {

    if (_ds == null)
    assemble();
    if(_ds != null con == null) {

    con = _ds.getConnection();

    }
    }catch(SQLException ex) {

    ex.printStackTrace();

    }

    }

    private void assemble() {
    Context ic = null;
    try {

    ic = new InitialContext();
    DrTrackUtil drutil = new DrTrackUtil();
    _ds = (DataSource) ic.lookup("java:/" + drutil.getText("SOURCE_DIR"));
    drutil = null;
    }catch (Exception e) {

    e.printStackTrace();

    }finally {
    try {
    ic.close();
    }catch(NamingException ne) {}
    }

    }

    public void closeConnection() throws SQLException {

    if(con != null)
    con.close();

    con = null;
    }

    }below is the code with get connection and doing transaction in it.
    public static AccountMasterValueBean getAccountMasterByAcctId(String acctId) {

    AccountMasterValueBean bean = null;
    DAOUtil dao = null;
    CallableStatement cst = null;
    ResultSet rs = null;
    try {
    dao = new DAOUtil();

    cst = dao.con.prepareCall(DrTrackConstants.MSSQL_USP_ACCOUNTMASTER_BY_ACCTID);
    cst.setObject(1, acctId);

    rs = cst.executeQuery();
    if(rs != null rs.next()) {

    bean = new AccountMasterValueBean(
    Integer.valueOf(rs.getString("accountkeyid")),
    rs.getString("latitude"),
    rs.getString("longitude"));

    }
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    }
    finally {
    if(rs != null){
    try {
    rs.close();
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    }
    finally {
    rs = null;
    }
    }
    if(cst != null) {
    try{
    cst.close();
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    }
    finally {
    cst = null;
    }
    }
    if(dao != null) {
    try {
    dao.closeConnection();
    }catch(SQLException se) {
    logger.info("SQL Error: " + se);
    }
    finally {
    dao = null;
    }
    }
    }
    return bean;
    }I closed connections, resultsets and statements properly.
    Why I'm getting these errors.? Where I'm doing wrong. ? Please help me. I have to fix them ASAP.

    Thanks.

  • RELEVANCY SCORE 3.20

    DB:3.20:External Data Source-Connection Pool 7x


    In BAM for External Data Source, is there any way to setup a connection pool and its properties? Occasional we run into connection issues, e.g. too many connections open or connection closed or connection unavailable.View image: ScreenshotThank you

    DB:3.20:External Data Source-Connection Pool 7x

    HelloCreate data-source in weblogic server and use the same in BAM.RegardsShankar

  • RELEVANCY SCORE 3.20

    DB:3.20:Tftp Connection Forcibly Closed cx



    I tried setting up a tftp server using tftpd32m with ip504g phone.

    The server does not seem to communicate with phone host

    and error rcvd is

    "Error in Recv

    Error code is 10054 (an existing connection was forcibly closed by the remote host)"

    Any clues on how to get this fixed?

    Thanks

    DB:3.20:Tftp Connection Forcibly Closed cx


    I tried setting up a tftp server using tftpd32m with ip504g phone.

    The server does not seem to communicate with phone host

    and error rcvd is

    "Error in Recv

    Error code is 10054 (an existing connection was forcibly closed by the remote host)"

    Any clues on how to get this fixed?

    Thanks

  • RELEVANCY SCORE 3.20

    DB:3.20:Connection Closed Exception 9z



    Hi All!

    I have a problem with trying download file (3 Mb) via http connection (direct TCP)

    It throws "Connection Closed" exception.

    Connection parameters : ";deviceside=true";

    Simulator : 8900 (4.6.1)

    Code : byte[] downloadFile( String url )

    public static HttpConnection makeConnection( String url, HttpHeaders requestHeaders, byte[] postData ) throws IOException { HttpConnection conn = null; OutputStream out = null; conn = ( HttpConnection )Connector.open( url ); if( requestHeaders != null ) { // From // http://www.w3.org/Protocols/rfc2616/rfc2616-sec15.​html#sec15.1.3 // // Clients SHOULD NOT include a Referer header field in a // (non-secure) HTTP // request if the referring page was transferred with a secure // protocol. String referer = requestHeaders.getPropertyValue( "referer" ); boolean sendReferrer = true; if( referer != null StringUtilities.startsWithIgnoreCase( referer, "https:" ) !StringUtilities.startsWithIgnoreCase( url, "https:" ) ) { sendReferrer = false; } int size = requestHeaders.size(); for( int i = 0; i size; ) { String header = requestHeaders.getPropertyKey( i ); // Remove referer header if needed. if( !sendReferrer header.equals( "referer" ) ) { requestHeaders.removeProperty( i ); --size; continue; } String value = requestHeaders.getPropertyValue( i++ ); if( value != null ) { conn.setRequestProperty( header, value ); } } } if( postData == null ) { conn.setRequestMethod( HttpConnection.GET ); } else { conn.setRequestMethod( HttpConnection.POST ); conn.setRequestProperty( HttpProtocolConstants.HEADER_CONTENT_LENGTH, String .valueOf( postData.length ) ); out = conn.openOutputStream(); out.write( postData ); out.close(); } return conn; } public static byte[] getResponse( HttpConnection connection, Event e ) throws IOException { byte[] bytes = null; InputStream is = null; try { is = connection.openInputStream(); // ByteVector bv = new ByteVector(); // int i = din.read(); // while( -1 != i ) // { // bv.addElement( ( byte )i ); // i = din.read(); // } // // bytes = bv.getArray(); int len = ( int )connection.getLength(); if( len 0 ) { int actual = 0; int bytesread = 0; bytes = new byte[ len ]; while( ( bytesread != len ) ( actual != -1 ) ) { actual = is.read( bytes, bytesread, len - bytesread ); bytesread += actual; } } else { ByteVector bv = new ByteVector(); int ch; while( ( ch = is.read() ) != -1 ) { bv.addElement( ( byte )ch ); } bytes = bv.getArray(); } } finally { if( is != null ) { is.close(); } } return bytes; }public static byte[] downloadFile( String url ) throws IOException, ConnectionNotFoundException { byte[] content = null; HttpConnection connection = WebUtils.makeConnection( url, null, null ); if( connection != null ) { int rc = connection.getResponseCode(); if( rc != HttpConnection.HTTP_OK ) { throw new IOException( "HTTP response code: " + rc ); } content = WebUtils.getResponse( connection, null ); connection.close(); } else { throw new ConnectionNotFoundException( "Failed establish connection!" ); } return content; }

    DB:3.20:Connection Closed Exception 9z


    Hi Eugen.

    I solved the problem by split large file to more smaller and perform bytes reading via IOUtilities.streamToBytes( is );

  • RELEVANCY SCORE 3.20

    DB:3.20:Rfc Connection Not Closing On The R/3 Side ak



    Hi,

    I have some iview that close the connection properly and other that keep the connection open on the R/3 side. Should i be adding something else to this code?

    // Close the Connection if one exists

    if (connection != null) {

    try {

    interaction.close();//close IInteration

    connection.close();//close IConnection

    cgService.destroy();//destroy IConnectorGatewayService

    if(logger.isActive()) {

    logger.log("Connection is closed", Level.INFO);

    }

    }

    catch (Exception e) {

    }

    connection = null;

    }

    Thanks

    Jean Seguin

    DB:3.20:Rfc Connection Not Closing On The R/3 Side ak


    or try this one..

    Go to the bottom of the tutorial, you will find the configuration...

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/bc9baf90-0201-0010-479a-b49b25598ebf

  • RELEVANCY SCORE 3.20

    DB:3.20:E71 And Data Connection Closed 1f


    Hello,
    I've a nokia E71 and I use always on UMTS HSDPA connection. I've noticed that every time I receive or I make a call phone inform me that data connection is closed and after call data connection is resumed automatically.

    Can I prevent this problem? There's a way? Connection is always 3G or 3,5G

    Thanks
    Stefano



    http://www.stefanocislaghi.it/

    DB:3.20:E71 And Data Connection Closed 1f

    Hello,
    I've a nokia E71 and I use always on UMTS HSDPA connection. I've noticed that every time I receive or I make a call phone inform me that data connection is closed and after call data connection is resumed automatically.

    Can I prevent this problem? There's a way? Connection is always 3G or 3,5G

    Thanks
    Stefano



    http://www.stefanocislaghi.it/

  • RELEVANCY SCORE 3.19

    DB:3.19:Re: Java.Sql.Sqlexception: Jz0c0: Connection Is Already Closed. fk


    DB:3.19:Re: Java.Sql.Sqlexception: Jz0c0: Connection Is Already Closed. fk

    Bart Simpson wrote:

    Tried the lastest version of the driver but that didn't help because there was
    a table missing in the database Doh!!! When we restored the table, everything
    is working now.Good. As expected. It was a driver bug.

    It would still be great if you can confirm the following questions...
    Thank you so much, -Bart SimpsonSure. See below.

    "Bart Simpson" bart@yahoo.com wrote:
    Hi Joe, How are you doing?
    Let me just confirm (and repeat:):
    o WLS 701 comes with an older version?Yes.

    o You recommend that we download a newer version from Sybase?Yes.

    Can you please recommend the exact version? The version is found is:
    jConnect
    4.5 and 5.5 for JDBC available here: http://www.sybase.com/detail/1,6904,1009796,00.htmlIt depends on the date ;-) Perhaps because jdbc drivers are not a profit center for DBMS
    vendors, they are not subject to the rigor of testing that for-money products get. As such,
    DBMS vendor's drivers tend to be volatile, changing frequently to patch customer-discovered
    bugs. The prudent course is always to use their latest, and monitor their site for new releases.
    Joe

    Thanks for the quick response...
    -Bart SimpsonWell, sure. They pay me so regularly that I almost feel compelled to do something almost
    every day. ;-)

    Joseph Weinstein joe@bea.com.remove.this wrote:
    Bart Simpson wrote:

    I am getting the same error on WLS701 with Sybase. Can you pleasehelp?
    Thank you so much,
    -Bart Simpson

    Steve stephen.patrick@drkw.com wrote:
    Did anyone ever get to the bottom of this, I'm receiving same errormessage

    Please download Sybase's latest driver and make sure it's at the front
    of the
    server classpath. Let me know if this clears the problem.
    Joe

  • RELEVANCY SCORE 3.19

    DB:3.19:'Connection Has Already Been Closed'. Random Error Connecting With A Pool. 7x


    Hi all,
    I've got a problem I cannot solve, and really hope in someone's help...
    The fact is: I'm working on a webapp which doesn't made use of frameworks or patterns or similars. I introduced the DAO pattern in order to organize and speed up the work. At the core of the new classes there is the DBDAO, and this is the way it obtains the connection:

    protected Connection conn = null;

    ...

    protected Connection getConnection()
    {
    try
    {
    if (conn == null || conn.isClosed())
    {

    Context ctx = new InitialContext();
    javax.sql.DataSource ds=null;

    ds =(javax.sql.DataSource) ctx.lookup( "agespPool" );

    conn = ds.getConnection();
    conn.setAutoCommit(false);
    }
    }
    catch (Exception ne)
    ...

    Every new class that needs to access the db extends DBDAO and retrieves the conn with this method. In order to make things work without changing all the code, I modified the old class named 'Connessione' and made it extend DBDAO. Here is its method:

    public class Connessione extends DBDAO{
    ...

    public static synchronized Connection getConnessione() throws Exception {
    return new Connessione().getConnection();
    }

    That's all. Finished with the code.
    Now, if someone uses the new classes extending DBDAO, all goes well. But for some old function that still work with Connessione.getConnessione(), connection closes suddenly with no reason.
    For example, calling a page with some combo box populated with a db connection, you catch a:

    java.sql.SQLException: Connection has already been closed.
    at weblogic.jdbc.wrapper.PoolConnection.checkConnection(PoolConnection.java:63)
    at weblogic.jdbc.wrapper.ResultSetMetaData.preInvocationHandler(ResultSetMetaData.java:37)
    at weblogic.jdbc.wrapper.ResultSetMetaData_oracle_jdbc_driver_OracleResultSetMetaData.getColumnType(Unknown Source)
    at it.praxis.tim.agesp.pub.sql.PagingList.populate(PagingList.java:98)
    at it.praxis.tim.agesp.pub.sql.PagingList.executeSQL(PagingList.java:53)
    at jsp_servlet._jsp._todolist_new._richiesta.__listarichieste._jspService(__listarichieste.java:353)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)

    or sometimes:

    - 20080417141147: E HtmlSelect.createHtmlSelect(4) - Errore!
    java.sql.SQLException: Result set already closed
    - 20080417141147: E HtmlSelect.createHtmlSelect(7) - Errore!
    java.sql.SQLException: Connection has already been closed.
    - 20080417141147: E ERRORE: ricercaRichieste :
    java.sql.SQLException: Statement has already been closed

    That is, the conn is closed while used to populate the combo box. I don't understand who closes it.
    Moreover, that happens randomly: 1 or 2 times over 4 hits on the page. The other times, all goes well. Most of the other pages, all goes well. So I don't think I have to search for a bug in the code.
    Now, I'm working with BEA WL 8.1 sp 5 and Oracle 9.2.0.1.0 .
    The error turns out even if I work locally (with Tomcat 5.5.23).
    The webapp made use of a custom driver beforehand, and I replaced it with oracle's driver.
    I tried to set the Connection Pool with oracle.jdbc.driver.OracleDriver and oracle.jdbc.OracleDriver .
    I left the default for the connection pool, and then tried to set (BEA):
    Connection Reserve Timeout: -1
    Test Created Connections: On
    with no changes.

    The connection suddenly and randomly closes.

    Any help would be appreciated...

    Many thanks

    DB:3.19:'Connection Has Already Been Closed'. Random Error Connecting With A Pool. 7x

    Fabio Eusebi wrote:

    Seems a good code, many thanks.
    Now, the fact is that I'm using the DBDAO class as an abstract class in the new architecture, and every table in the db has the corrisponding DAO that extends it with many methods for the CRUD. The methods get the conn calling getConnection(). They don't close the connection as they may need to continue the transaction.
    So, in the new DAO classes the conn is treated like this.

    But the problem happens in the old code, that doesn't make use of these methods, it only retrieves the conn from the Connessione class. It's used in a method for the items in a combo box, and that method finds it closed. I don't understand who can close it.What version of WLS are you using? Who is managing the transaction?
    You can close the connection all you want if WLS is managing the tx.
    WLS will manage connections and the tx. Show me your full exception
    again too and I may be able to make a debug patch for you.

  • RELEVANCY SCORE 3.19

    DB:3.19:Excecuteupdate Multiple Times With Same Connection 7p


    JDBC Oracle's thin driver:
    Using connection pooling, where connections are not closed, and issuing executeUpdate multiple times is hanging. Connections are auto-commit enabled.

    If I were to obtain a connection outside of the connection pool, and close it when done, thereby guaranteeing a unique connection, it works.

    Example:
    String q = UPDATE TICKET SET STATUS_ID =
    (select (case when HOLD_TYPE_ID is null then 1 else 3 end) from TICKET where ID = 674) WHERE ID = 674;

    statement = conn.createStatement();
    int rowCount = statement.executeUpdate(q);
    statement.close();
    null

    DB:3.19:Excecuteupdate Multiple Times With Same Connection 7p

    JDBC Oracle's thin driver:
    Using connection pooling, where connections are not closed, and issuing executeUpdate multiple times is hanging. Connections are auto-commit enabled.

    If I were to obtain a connection outside of the connection pool, and close it when done, thereby guaranteeing a unique connection, it works.

    Example:
    String q = UPDATE TICKET SET STATUS_ID =
    (select (case when HOLD_TYPE_ID is null then 1 else 3 end) from TICKET where ID = 674) WHERE ID = 674;

    statement = conn.createStatement();
    int rowCount = statement.executeUpdate(q);
    statement.close();
    null

  • RELEVANCY SCORE 3.18

    DB:3.18:Connection Object In Pool Won't Close...Can You Help? dd


    Hello everyone,
    Here's is a snipeet of my basic servlet ---

    //..
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");

    try {

    PrintWriter out = response.getWriter();
    Context ctx = new InitialContext();
    if(ctx == null )
    throw new Exception("Boom - No Context");

    DataSource ds =
    (DataSource)ctx.lookup(
    "java:comp/env/jdbc/carsDB");
    Connection conn = ds.getConnection();
    if(conn != null)
    out.println("connection is good" + conn.toString());

    ResultSet rs = null;
    Statement stmt = conn.createStatement();

    // ..
    // put resultset code here

    stmt.close();
    rs.close();
    ds.close();
    conn.close();

    //here I test to make sure the connection has
    //closed
    if(conn != null) {
    out.println("connection is open");
    } else { out.println("connection is closed"); }
    out.close();

    }//try

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

    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    doGet(request, response);
    }
    // ... Problem I find is that even though I have called the close() methods on the resultSet, Statement and Connection objects, that when I check to see if the Connection object (conn) is null, it isn't.
    I used the example of setting up a JNDI Datasource for Connection Pooling given on the Jakarta Tomcat Apache site, located here: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

    I am using Tomcat Version 4.1.29, Mysql version 4.0, JSP 2.0, and Java SDK 1.4.

    Can someone please advise me on what it is I'm doing wrong?

    I know how important it is for the connection to close when the program is done using it, so the connections can be reused, which is the purpose of connection pooling. I'm concerned that when my application runs, that the connections will not close.

    Any input is greatly appreciated:)
    Thank You,
    Love2Java

    DB:3.18:Connection Object In Pool Won't Close...Can You Help? dd

    Hello everyone,
    Here's is a snipeet of my basic servlet
    ic servlet ---

    //..
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");

    try {

    PrintWriter out = response.getWriter();
    Context ctx = new InitialContext();
    if(ctx == null )
    throw new Exception("Boom - No Context");

    DataSource ds =
    (DataSource)ctx.lookup(
    "java:comp/env/jdbc/carsDB");
    Connection conn = ds.getConnection();
    if(conn != null)
    out.println("connection is good" +
    s good" + conn.toString());

    ResultSet rs = null;
    Statement stmt = conn.createStatement();

    // ..
    // put resultset code here

    stmt.close();
    rs.close();
    ds.close();
    conn.close();

    //here I test to make sure the connection
    nnection has
    //closed
    if(conn != null) {
    out.println("connection is open");
    } else { out.println("connection is closed"); }
    "); }
    out.close();

    }//try

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

    public void doPost(HttpServletRequest request,
    est, HttpServletResponse response)
    throws ServletException, IOException {
    doGet(request, response);
    }
    // ... Problem I find is that even though I have called the
    close() methods on the resultSet, Statement and
    Connection objects, that when I check to see if the
    Connection object (conn) is null, it isn't.
    I used the example of setting up a JNDI Datasource
    for Connection Pooling given on the Jakarta Tomcat
    Apache site, located here:
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-d
    atasource-examples-howto.html

    I am using Tomcat Version 4.1.29, Mysql version 4.0,
    JSP 2.0, and Java SDK 1.4.

    Can someone please advise me on what it is I'm
    doing wrong?

    I know how important it is for the connection to
    close when the program is done using it, so the
    connections can be reused, which is the purpose of
    connection pooling. I'm concerned that when my
    application runs, that the connections will not
    close.

    Any input is greatly appreciated:)
    Thank You,
    Love2JavaI'm having a very similar problem where my connection won't close. I'm already certain it isnt closing, I've tried that "isClosed" already. Did you figure out why it wasnt closing?

  • RELEVANCY SCORE 3.18

    DB:3.18:Session Name Null From Binding Listner Event cm



    The following code displays a null session ID in JBoss 3.0.5, but works in 3.0.4. Did something change in Jetty?package com.fcci.servlet.velocity;import java.sql.Connection;import java.sql.PreparedStatement;import java.util.HashMap;import java.util.Map;import javax.servlet.ServletContext;import javax.servlet.http.HttpSessionBindingEvent;import javax.servlet.http.HttpSessionBindingListener;/** * HttpSessionBindingListener is used to clean up resources from Servlet * session. * * @author Steven P. Goldsmith * @version 1.0 */public class ServletSessionBindingListener implements HttpSessionBindingListener { /** Save a ServletContext to be used for its log() method */ private ServletContext context; /** Map to store persistant database connections, etc */ private Map profile; /** * Constructor saves Servlet context and creates profile HashMap. Use * profile to store session specific objects. * * @param context Velocity context */ public ServletSessionBindingListener(ServletContext context) { this.context = context; profile = new HashMap(); } /** * Return profile HashMap created in constructor. * * @return Map */ public Map getProfile() { return profile; } /** * Echos session ID to the log to prove session is bound. Remove logging * code for real app. * * @see javax.servlet.http.HttpSessionBindingListener#valueBound( * HttpSessionBindingEvent) */ public void valueBound(HttpSessionBindingEvent event) { context.log( "BOUND as " + event.getName() + " to " + event.getSession().getId()); } /** * Echos session ID to the log to prove session is unbound. Remove logging * code for real app. Connection and prepared statement are closed if * present in profile. * * @see javax.servlet.http.HttpSessionBindingListener#valueUnbound( * HttpSessionBindingEvent) */ public void valueUnbound(HttpSessionBindingEvent event) { context.log( "UNBOUND as " + event.getName() + " from " + event.getSession().getId()); // Clean up connection, this assumes that if a connection exists an // opened PreparedStatement also exists. try { Connection connection = (Connection) profile.get("connection"); // If there is a connection, close the statement and connection. if (connection != null) { ((PreparedStatement) profile.get("preparedStatement")).close(); connection.close(); } } catch (Exception e) { context.log(e.getMessage()); } }}

  • RELEVANCY SCORE 3.18

    DB:3.18:Problem Using Jsf Connection Db 7m


    i have this problem:

    I have defined a connection as a variable in a jsfbean with scope session scope.
    Clicking very quicly on a field on the form I get the message: sql result set closed and my connection variable is null.
    It seems a thread problem ; only one browser is open and I click inside the only form that I have.

    How may I resolve the problem ?

    I use Myfaces 1.1.5 and Tomahawk 1.1.5

    DB:3.18:Problem Using Jsf Connection Db 7m

    i have this problem:

    I have defined a connection as a variable in a jsfbean with scope session scope.
    Clicking very quicly on a field on the form I get the message: sql result set closed and my connection variable is null.
    It seems a thread problem ; only one browser is open and I click inside the only form that I have.

    How may I resolve the problem ?

    I use Myfaces 1.1.5 and Tomahawk 1.1.5

  • RELEVANCY SCORE 3.18

    DB:3.18:Error "Thread-12: Ip - (Error) Java.Sql.Sqlexception: Closed Connection" 1p


    Hi,
    We are on Integration B2B release 10.1.2, and running into intermittent errors with the SQL connection (exact error from b2b.log pasted below). This happens only every 2 to 3 weeks, and subsequent outbound documents creation fails as a result with error
    "Machine Info: (falken1.falkentire.internal)
    null"

    2010.10.26 at 09:30:40:216: Thread-12: BusinessLogicLayer - (ERROR) caught error: Closed Connection
    2010.10.26 at 09:30:40:219: Thread-12: IP - (ERROR) java.sql.SQLException: Closed Connection
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:174)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:239)
    at oracle.jdbc.driver.PhysicalConnection.rollback(PhysicalConnection.java:1259)
    at oracle.jdbc.OracleConnectionWrapper.rollback(OracleConnectionWrapper.java:90)
    at oracle.tip.repos.core.driver.CatalogDriver.disconnect(CatalogDriver.java:1662)
    at oracle.tip.repos.core.persistency.PersistencyService.disconnect(PersistencyService.java:578)
    at oracle.tip.buslogic.common.ExecutionContextImpl.disconnectService(ExecutionContextImpl.java:602)
    at oracle.tip.buslogic.common.ExecutionContextManager.closeLongRunningContext(ExecutionContextManager.java:511)
    at oracle.tip.adapter.b2b.data.B2BExecutionContext.close(B2BExecutionContext.java:208)
    at oracle.tip.adapter.b2b.data.DBContext.shutdown(DBContext.java:141)
    at oracle.tip.adapter.b2b.data.MsgListener.run(MsgListener.java:428)
    at java.lang.Thread.run(Thread.java:534)

    Does anyone have any idea what the cause of the issue is and how to prevent it?

    Thanks
    Venkat

    DB:3.18:Error "Thread-12: Ip - (Error) Java.Sql.Sqlexception: Closed Connection" 1p

    Hello Venkat,

    doesn't B2B try to process this message when the server comes up?Yes, it would try. If it is not happening then there are chances that you have hit a bug.

    I also see that the message was sent but delayed which resulted in charge backs by the partner, also in the B2B reports I don't see the file name except an error that I pasted earlier.It is abnormal. Messages are sent immediately (except batching cases) to the partners after being received by back-end applications. The delay must be at TP side. Cross check the server logs again and raise a case with support if it is happening.

    Regards,
    Anuj

  • RELEVANCY SCORE 3.18

    DB:3.18:Connection Handle Has Been Closed And Is Unusable za



    I have a many entity and session bean deployed in my application, when i deployed the application in jboss its is quite perfect in deployement, and even it runs, but after sometime it throws the Exception "Connection handle has been closed and is unusable" and "null", could any body please help me in resolving this problem i am bugged up with this problem cannot able to find any solution, i tried in many changes in jca configuration but nothing worked outthanking uregardsnasir

    DB:3.18:Connection Handle Has Been Closed And Is Unusable za


    "nnbkhan" wrote:I have a many entity and session bean deployed in my application, when i deployed the application in jboss its is quite perfect in deployement, and even it runs, but after sometime it throws the Exception "Connection handle has been closed and is unusable" and "null", could any body please help me in resolving this problem i am bugged up with this problem cannot able to find any solution, i tried in many changes in jca configuration but nothing worked outthanking uregardskhan

  • RELEVANCY SCORE 3.18

    DB:3.18:Proxy Plugin Does Not Release The Conneciton With Wls Even The Connection Has Been Closed By Browser/Client Application d3



    An unexpected behaviour from proxy plugin is found. A big file is being sent from
    web container on Weblogic to our application through HTTP and a proxy plugin
    is used. The proxy plugin seems holding the connection with the web container
    even HTTP connection has been closed by client side application. Normally,
    proxy should close the connection with web container as soon as the external http
    connection is closed.

    The http header "Connection: close" is used......

    Are there any people having an idea to solve this problem?

    DB:3.18:Proxy Plugin Does Not Release The Conneciton With Wls Even The Connection Has Been Closed By Browser/Client Application d3


    An unexpected behaviour from proxy plugin is found. A big file is being sent from
    web container on Weblogic to our application through HTTP and a proxy plugin
    is used. The proxy plugin seems holding the connection with the web container
    even HTTP connection has been closed by client side application. Normally,
    proxy should close the connection with web container as soon as the external http
    connection is closed.

    The http header "Connection: close" is used......

    Are there any people having an idea to solve this problem?

  • RELEVANCY SCORE 3.18

    DB:3.18:Problems Putting A Database Connection In A Session? f3


    Are there any problem putting a database Connection in a session to use it in all jsp pages?

    In all jsp pages I have inclued a page called connection.jsp that has:
    code
    %
    if(session.getAttribute("conn") == null){
    Context context = new InitialContext();
    OracleConnectionPoolDataSource jdbcURL = (OracleConnectionPoolDataSource) context.lookup("jdbc/MyDBCoreDS");
    PooledConnection pc = jdbcURL.getPooledConnection();
    Connection c = pc.getConnection();
    c.setAutoCommit(false);
    session.setAttribute("conn",c);
    session.setAttribute("SessionConnBinding", new br.com.teclogica.portal.SessionConnBinding(c));
    }
    Connection conn = (Connection) session.getAttribute("conn");
    %
    /code

    How could be seen, there is an implementation of HttpSessionBindingListener that has the following method:
    code
    public void valueUnbound(HttpSessionBindingEvent event) {
    try {
    conn.close();
    } catch (SQLException e) {
    e.printStackTrace();
    }
    }
    /code

    So, when the session is new and the page is called, a connection is created and when the session is invalidated, the connection is closed.

    I think it works well, doesn't it? But Oracle said that it's not a good pratice put an Connection in a Session. They didn't say why.

    Any comments?

    DB:3.18:Problems Putting A Database Connection In A Session? f3

    Sorry about the "code", I'll put it again.

    Are there any problem putting a database Connection in a session to use it in all jsp pages?

    In all jsp pages I have inclued a page called connection.jsp that has:
    %
    if(session.getAttribute("conn") == null){
    Context context = new InitialContext();
    OracleConnectionPoolDataSource jdbcURL = (OracleConnectionPoolDataSource) context.lookup("jdbc/MyDBCoreDS");
    PooledConnection pc = jdbcURL.getPooledConnection();
    Connection c = pc.getConnection();
    c.setAutoCommit(false);
    session.setAttribute("conn",c);
    session.setAttribute("SessionConnBinding", new br.com.teclogica.portal.SessionConnBinding(c));
    }
    Connection conn = (Connection) session.getAttribute("conn");
    %How could be seen, there is an implementation of HttpSessionBindingListener that has the following method:
    public void valueUnbound(HttpSessionBindingEvent event) {
    try {
    conn.close();
    } catch (SQLException e) {
    e.printStackTrace();
    }
    }So, when the session is new and the page is called, a connection is created and when the session is invalidated, the connection is closed.

    I think it works well, doesn't it? But Oracle said that it's not a good pratice put n Connection in a Session. They didn't say why.

    Any comments?

  • RELEVANCY SCORE 3.18

    DB:3.18:Connection Handle Has Been Closed And Is Unusable jp



    "wil@jboss" wrote:"Connection handle has been closed and is unusable".Using JBoss3.0.4. Is it possible that jboss closes an 'Idle timed-out' connection while it's actually still in use ?

    DB:3.18:Connection Handle Has Been Closed And Is Unusable jp


    If we do not use 'synchronized' then what is the other possible option to avoid "Connection has been closed" ?

  • RELEVANCY SCORE 3.18

    DB:3.18:Sap .Net Rfc Error Message aj



    Hi

    I encountered an error message while using customize RFC created for SAP .NET Connector + C# program.

    Below is the error message

    connection closed without message (CM_NO_DATA_RECEIVED)

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: SAP.Connector.RfcSystemException: connection closed without message (CM_NO_DATA_RECEIVED)

    Source Error:

    Line 78: {

    Line 79: object[]results = null;

    Line 80: results = this.SAPInvoke("Zcs_Acknowledge_Activity",new object[] {

    Line 81: In_Empno,In_Qmnum });

    Line 82: Out_Result_Flag = (string) results[0];

    How to resolved this problem. Urgent !

    DB:3.18:Sap .Net Rfc Error Message aj


    It seems to me that there some kind of exception not being caught by your FM Zcs_Acknowledge_Activity; then the connection is closed. Have you look at SM21 or ST22 to see if there's any additional error message or ABAP dump?

    Regards,

    Federico G. Babelis

    www.gazum.com

  • RELEVANCY SCORE 3.17

    DB:3.17:Session Clossing 99


    Hello! My webapp connects to Oracle and stores connection in Session object (Session.putValue...)
    My problem is that when user close browser the connection to oracle is still alive.
    I hoped that when user closed the browser the session was closed too and connection to oracle would die. (cookie is enabled)
    But something is wrong.
    Help please.

    DB:3.17:Session Clossing 99

    Why would you put the connection into a session? If you are using a connection pool just return it to the pool after the user has done their database operation. Then go back and grab from the pool again later. There really isnt overhead in doing this and your webapp will use connections much more efficiently.

  • RELEVANCY SCORE 3.17

    DB:3.17:Connection Closed And Slqstate 08003 But The Connection Is Opened. jm


    I've a very bad problem.
    I've a Prepared statement I try to execute but I get a Vendor code 17009 and a SqlState 08003.
    The Vendor code is translated to "Connection closed" (I see it in italian) but translation may be wrong.
    Anyway just before the execution I test :
    . the statement and is not closed
    . the connection and is not closed
    . the connection is valid
    then I execute and I get the SqlRecoveableException I discussed before.
    In the catch part I test again the statement and the connection and they are still opened.
    What's can be wrong ?
    Tks
    Tullio

    DB:3.17:Connection Closed And Slqstate 08003 But The Connection Is Opened. jm

    In the catch part I test again the statement and the connection and they are still opened.
    What's can be wrong ?However you are testing it you are doing it wrong.

  • RELEVANCY SCORE 3.17

    DB:3.17:Jconnect Close Connection 7d


    I'm using jconnect 5.2 from tomcat served jsp

    for some reason I will get connection closed exceptions
    java.sql.SQLException: JZ0C0: Connection is already closed.
    at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:436)

    what is that?

    I open a connection for each jsp and close it before redirecting to a new page.

    DB:3.17:Jconnect Close Connection 7d

    just in case for others with the same problem!

    for sybase jconnect, from their document

    you don't close the connection

    instead you make the connection null

  • RELEVANCY SCORE 3.16

    DB:3.16:Connection Closed 3j



    I get the follwoing error when trying to access session EJB from jsp" Connection handle has been closed and is unusable "My EJB would look likepublic class userReport implements SessionBean{ private Connection con = null; public void makeConnection() throws RemoteException,NamingException,SQLException { try { InitialContext ic =null; DataSource ds = null; con = null; ic = new InitialContext(); ds = (DataSource) ic.lookup("java:jdbc/SybaseDB"); con = ds.getConnection(); } catch(Exception e) { con.close(); System.out.println(e); } finally { con.close(); } } ......... ..........public int insertAccounts(String[] reportParams) throws RemoteException,NamingException,SQLException { Vector accVector = new Vector(); try { PreparedStatement ls_stmt = null; int result = 0; ls_stmt = con.prepareStatement("exec prc_mis_report_accs_ins ?"); for(int j=0;j reportParams.length;j++) { ls_stmt.setString(1,reportParams[j]); result = ls_stmt.executeUpdate(); } } catch(SQLException e) { con.close(); System.out.println(e); return 0; } catch(Exception e) { con.close(); System.out.println(e); return 0; } return 1; } ............. ...............}and jsp would beobjRemote.makeConnection();String[] reportParams = request.getParameterValues("income_acc");ret_value = objRemote.insertAccounts(reportParams);but after makeConnection() I get the error as above.Please Help........ThanxVenki

    DB:3.16:Connection Closed 3j


    dear all, I found a solution for the same by changingfalsein jbossjca-service.xml totrueif there is any side effect to it , please do replythanxVenki

  • RELEVANCY SCORE 3.16

    DB:3.16:Jdbc Connection Getting Invalid 1k


    Hello All,

    I have problem in using connections that are already established to Oracle DB. Here is the scenario.

    1) Created a Connection
    2) Used it for DB Updates (Worked fine)
    3) Stored this connection in Hash Table.
    4) Used this connection later (may be one min, one hour or one day....) for data base updates.

    This is my application architecture in brief. There is a module that chceks this connection in regulary intervals for its exisistance.
    This check is done in a separate thread... This thread have to complete its execution in 3 minutes else connection is treated as in valid.
    Here it is that runs in the thread....
    void run()
    {
    .
    .
    .
    Connection con= (Connection) ht.get("DB_CONNECTION"); //ht is the hash table which i specified earlier here
    if(con == null || con.isClosed() == true)
    {
    System.out.println("Null Connection detected");
    }
    else
    {
    Statement stmt = con.createStatement();
    ResultSet rs_1 = stmt.executeQuery("SELECT 1 FROM DUAL");
    if(rs_1 != null rs_1.next())
    {
    rs_1.close();
    }
    }Now the problem is that execution of thread is not being completed in 3 minutes and Connection is treated as invalid.

    Hope i am clear till here....

    When and why Will JDBC Connection go invalid? (i.e. Connection not being closed but getting stuck at query execution)

    Will JDBC Connections also have states like ACTIVE, INACTIVE, CLOSED like Oracle Sessions...?

    Did any one face this scenario?

    Any help is appreciated...

    Thanks
    Satish K

    DB:3.16:Jdbc Connection Getting Invalid 1k

    It appears you have access to the code from your example. I personally do not view switching from DriverManager to a connection pool to be a complete change of architecture. You are using a Map to fetch a Connection. Use the pool to do the same. It does not seem an invasive change to me. And you will have the opportunity to write additional unit tests that can be used later.

    Anyhow, if you do really want to find out why they are going invalid, my guess is that they are timing out. Either set the timeout higher (may or may not be a good idea) or evict connections from the map when they are stale and replace it with a new one.

    - Saish

  • RELEVANCY SCORE 3.15

    DB:3.15:Resolving Refs Stored In Customdatum And Connection Pooling sf


    --
    I am using Custom Java Classes for Oracle Objects
    and I have logical problems with using Refs with connection
    pooling.
    Typical scenario two-tier single connection setup:
    1. Open Connection
    2. Instantiate Custom class from ResultSet
    3. Traverse references
    4. Close Connection

    Typical Scenario multi-tier pooled connection
    1. Open Pooled Connection |
    2. Instantiate Custom class from ResultSet | First Remote Call
    3. Close Pooled Connection |
    ---- REF points to closed connection at this point -----
    4. Traverse references | Second Remote Call

    The problem is that I need to open and close pooled connection
    in first remote call which Instantiate Custom Class from
    CustomDatum and then Traverse References in subsequent calls.
    Oracle REF class saves reference to Connection object which was
    used to load REF itself in the first call and uses it to resolve
    reference into Value in getValue() but at this point the
    connection opened in First Call is closed and can not be used to
    resolve references. REF object should use new connection object
    opened in Second Remote Call to resolve refs but REF object and
    classes generated by JPub do not provide any mechanism (except
    recreating REF object using constructor with connection, name
    and byte array) to change connection object after custom class
    was instantiated.

    So in my oppinion it should be something like this:
    1. Open Pooled Connection |
    2. Instantiate Custom class from ResultSet | First Remote Call
    3. Close Pooled Connection |
    ---- REF points to closed connection at this point -----

    4. Open Pooled Connection |
    5. Traverse refs using opened connection | Second Remote Call
    6. Close Pooled Connection |

    Thank you very much in advance
    null

    DB:3.15:Resolving Refs Stored In Customdatum And Connection Pooling sf

    --
    I am using Custom Java Classes for Oracle Objects
    and I have logical problems with using Refs with connection
    pooling.
    Typical scenario two-tier single connection setup:
    1. Open Connection
    2. Instantiate Custom class from ResultSet
    3. Traverse references
    4. Close Connection

    Typical Scenario multi-tier pooled connection
    1. Open Pooled Connection |
    2. Instantiate Custom class from ResultSet | First Remote Call
    3. Close Pooled Connection |
    ---- REF points to closed connection at this point -----
    4. Traverse references | Second Remote Call

    The problem is that I need to open and close pooled connection
    in first remote call which Instantiate Custom Class from
    CustomDatum and then Traverse References in subsequent calls.
    Oracle REF class saves reference to Connection object which was
    used to load REF itself in the first call and uses it to resolve
    reference into Value in getValue() but at this point the
    connection opened in First Call is closed and can not be used to
    resolve references. REF object should use new connection object
    opened in Second Remote Call to resolve refs but REF object and
    classes generated by JPub do not provide any mechanism (except
    recreating REF object using constructor with connection, name
    and byte array) to change connection object after custom class
    was instantiated.

    So in my oppinion it should be something like this:
    1. Open Pooled Connection |
    2. Instantiate Custom class from ResultSet | First Remote Call
    3. Close Pooled Connection |
    ---- REF points to closed connection at this point -----

    4. Open Pooled Connection |
    5. Traverse refs using opened connection | Second Remote Call
    6. Close Pooled Connection |

    Thank you very much in advance
    null

  • RELEVANCY SCORE 3.15

    DB:3.15:Re: Get Jdbc Connection Location a8


    I normally use connection per thread with a connection pool. And connection is released with every commit and rollback. And never call connection.commit()/rollback/close directly I use a separate database manager class for it.

    public class ConnectionMgr{
    ThreadLocal connecition = new ThreadLocal();

    public static Connection getConnection(){
    Connection c = (Connection)connecition.get();
    if(c == null){
    c = DriverManager.getConnection(....);
    connection.set(c);
    }
    return c;
    }

    public static void commit(){
    Connection c = (Connection)connecition.get();
    if(c != null){
    c.commit();
    close();
    }
    }

    public static void rollback(){
    Connection c = (Connection)connecition.get();
    if(c != null){
    c.rollback();
    close();
    }
    }

    public static void close(){
    Connection c = (Connection)connecition.get();
    if(c != null){
    c.close();
    connection.set(null);
    }
    }

    }Code in a data access method looks like

    public void someMethod(){
    Statement s = ConnectionMgr.getConnection().createStatement();
    s.executeUpdate(".....");
    ConnectionMgr.commit();
    }

    DB:3.15:Re: Get Jdbc Connection Location a8

    What is the best way to connect to a database in Java Class? I have used 3 different ways and would like to know what is the most efficient one. 1- Put the connection as a data member:public class DatabaseHelperClass { private Connection connection = new DbConnectionManager().getConnection(); public void insertDb(DbBean db) throws SQLException { PreparedStatement stmt = connection.prepareStatement("insert .."); ... } public void updateDb(DbBean db) throws SQLException { PreparedStatement stmt = connection.prepareStatement("update .."); ... }2 - Put connection in Constructor:public class DatabaseHelperClass { public DatabaseHelperClass() { Connection connection = new DbConnectionManager().getConnection(); } public void insertDb(DbBean db) throws SQLException { PreparedStatement stmt = connection.prepareStatement("insert .."); ... } public void updateDb(DbBean db) throws SQLException { PreparedStatement stmt = connection.prepareStatement("update .."); ... }3- Put connection in every method that needs a connection:public class DatabaseHelperClass { public void insertDb(DbBean db) throws SQLException { Connection connection = new DbConnectionManager().getConnection(); PreparedStatement stmt = connection.prepareStatement("insert .."); ... } public void updateDb(DbBean db) throws SQLException { Connection connection = new DbConnectionManager().getConnection(); PreparedStatement stmt = connection.prepareStatement("update .."); ... }

  • RELEVANCY SCORE 3.15

    DB:3.15:If Connection Is Closed?Resultset Will Be Closed Or Not. j7


    hi all,
    i am just closing the sql connection and i am not closing the resultset.So is it must that we should close resultset?
    if i close the connection resultset wont be closed automatically.?
    here is my code.

    s_user = conn.createStatement();
    sql_user="select statment ";
    rs_user=s_user.executeQuery(sql_user);

    if (rs_user.next())
    {

    if (rs_user.getInt("found") !=0)
    {
    flag = rs_user.getInt("found");
    out.print("flag="+ flag);

    }
    }

    // if connection is not closed close the connection

    if (!conn.isClosed())
    {
    conn.close();
    }

    if i use the above code any problem with db performance?

  • RELEVANCY SCORE 3.15

    DB:3.15:Ora-01000: Maximum Open Cursors Exceeded 87


    Hi,

    I am getting the error "ORA-01000: maximum open cursors exceeded". I have the following structure of programme defined in my application.
    The scenario is defined below :-

    //Main Class
    Class A
    {
    // Its a direct JDBC connection
    // The driver which is used is oracle.jdbc.driver.OracleDriver

    ConnectionFactory cf = ConnectionFactory.getInstance();
    connection = cf.getJDBCConnection( JDBC_CONNECTION );

    // Instantiates class B,C,D E
    B b = new B(connection);
    C c = new C(connection);
    D d = new D(connection);
    E e = new E(connection);

    ArrayList oldOutboundFlights; //It is having 2000 records

    //Start a for loop
    for (int f = 0; f oldOutboundFlights.size(); ++f)
    {
    b.deleteCouriers(flightId);
    c.deleteBagTagsOut(flightId);
    d.deleteOutboundUlds(flightId);
    e.deleteDownlineTransfersByFlight(flightId);
    }

    ArrayList oldInboundFlights; //It is having 1000 records

    for (int f = 0; f oldInboundFlights.size(); ++f)
    {
    b.deleteInboundUlds(flightId);
    c.delete(flightId);
    d.deleteBagTagsIn(flightId);
    e.deleteLink(flightId);
    }

    // Code for closing the connection in finally block
    }// Class A ends

    Classes B,C,D,E extends same class "DataAccess" and each of the extended class constructor have the following code written :-

    Class B (C.D.E) extends DataAccess
    {
    B(Connection con) // same for classes (C.D.E)
    {
    super(con);
    }
    // Rest of the code
    }
    Class DataAccess
    {
    private Cinnection connection;
    DataAccess(Connection connection)
    {
    if( connection != null )
    {
    this.connection = connection;
    }
    }
    public synchronized Connection getConnection()
    {
    return connection;
    }
    // Rest of code
    }

    Each of the delete methods of classes B,C,D,E calls getConnection() method of DataAccess class to get the connection. Each delete method has finally block in which corresponding statement objects is getting closed only. However they are not set to null.

    What i wanted to ask is :- Will there be 1 connection present or more than 1 connection i.e. for each of class B,C,D,E etc. Since i am closing each statement object, then why I am getting the above error. Is this because of the for loop which i am using, or the connection object is open for such a long time. Please advise on this.

    The maximum open cursors value at database level is set at 200 right now.

    DB:3.15:Ora-01000: Maximum Open Cursors Exceeded 87

    The link given by dvohra09 above is very good, check it out. It has a couple of SQL statement that'll help.

    Anyway, since a function you have (deleteDownlineTransfersByFlight()) fails creating a statement, the very last statement must have just been created and left unclosed. Take a good look at the previous place that creates statements, deleteOutboundUlds(), and see if it closes all statements and result sets. E.g. is it creating statements in a loop and only closing one of them.

  • RELEVANCY SCORE 3.15

    DB:3.15:Jdbc 9c


    what is the difference ?

    Connection con;

    con.close(); and Connection con = null ;

    Explain it elaberately...

    DB:3.15:Jdbc 9c

    Con.close()

    This closes the Jdbc connection with wout deregestring the Jdbc driver

    con =null;

    This initates the con Object with null value inspite of registering the Jdbc driver

    Hope this helps [All i know]

  • RELEVANCY SCORE 3.15

    DB:3.15:Closed Connection - Reasons d1


    Hi,

    In our web application we're using OracleDataSource with properties min/max connection cache, ValidateConnection, TimeToliveTimeout etc..
    In some cases after connection validation before select/insert operations is connection closed from server side (SQLException: Closed Connection).

    How to solve this problem / in which cases is connection closed by server?

    thanks in advance..

    DB:3.15:Closed Connection - Reasons d1

    Depending on the DBMS OS type, the oracle connection protocol uses the
    one named port to connect to the DBMS listener process, the one that
    handles connection requests, which then establishes a private socket on
    a different port for the actual connection to use, and sends that back
    to the driver, which then opens that port for the JDBC work.
    Search through the Oracle JDBC docs to see if there are hints or recommendations
    about firewalls.

    A few options that may work in your case:

    1. Open up all ports between the 2 hosts.

    2. Contact the firewall vendor and see if they support Oracle connectivity with OS port redirection, SQL*Net proxy content filtering.

    3. Use appropriately licensed Oracle Connection Manager (CMAN) as described in the Oracle Network Admin Guide.

    4. Use Shared server architecture with specific dispatcher ports which also must be opened by the firewall.

    answered by joe and friscoki refer the thread for more information:
    SQLException: Closed Connection, SQL state [null]; error code [17002]
    Re: SQLException: Closed Connection, SQL state [null]; error code [17002]

  • RELEVANCY SCORE 3.15

    DB:3.15:Odbc Get Connection Status Via Sqlgetconnectattr Crash For Closed Connection xk


    Hello Everybody,
    I'm not a odbc specialist at all, but i notice a strange problem. Icreate an odbc connection, and after some work on this connection, I close it. After that the connection is closed Iwant to check the connection's status (this is a test for
    a more complex scenario...I'm not crazy :) ), with this piece of code:

    bool IsConnectionValid(void* hConn)

    {

    SQLINTEGER isConnected = 0, length = 0;

    void* hdbc_ = NULL;

    short retcode_ = SQLGetConnectAttr( hConn,

    SQL_ATTR_CONNECTION_DEAD,

    isConnected,

    sizeof(SQLINTEGER),

    length);

    if(retcode_ == SQL_SUCCESS || retcode_ == SQL_SUCCESS_WITH_INFO)

    {

    return (isConnected != 0); //It always is 0. anothere strange stuff.... br/ }

    else

    {

    return false;

    }

    }

    DB:3.15:Odbc Get Connection Status Via Sqlgetconnectattr Crash For Closed Connection xk

    Hi Anton,
    thanks for your reply! I hope for a sort of invald handle error code! :)
    Bye

  • RELEVANCY SCORE 3.14

    DB:3.14:Reset Database Connection. Bad Database Connection Detected mj


    Hi,

    I am using the Oracle 10G Enterprise Edition 10.2.0.3.0 64 Bit Production and the JDBC Driver 9.2.0.8.0. The reason why we use JDBC 9.2.0.8.0 is because the Application that we use is deployed in weblogic 7.0 SP2 with JDK 1.3.1.

    We get the below series of SQL error in the App Server. When we get the error the Application is not accessible. Kindly advice how to fix this issue.

    Mon May 17 23:29:28 MST 2010 (*:*:*:jscl42:Node2) (jdbc:error:201): SQLState: null
    Message: Closed Connection
    Vendor: 17008

    Mon May 17 23:29:28 MST 2010 (*:*:*:jscl42:Node2) (sqlio:warning:1328): SQLException setAutoCommit() on java.sql.SQLException: Closed Connection

    Tue May 18 04:29:48 MST 2010 (pcsv11:test35trs1:AMX_PasswordAdapter1:ozifrs:Node1) (jdbc:error:201): SQLState: null
    Message: Io exception: Connection timed out: Connection timed out

    Tue May 18 03:25:59 MST 2010 (*:*:*:ubz2dw:Node1) (jdbc:warning:4612): Reset Database Connection. Bad Database Connection Detected.
    Tue May 18 03:25:59 MST 2010 (*:*:*:ubz2dw:Node1) (jdbc:error:201): SQLState: null
    Message: Io exception: Connection timed out: Connection timed out
    Vendor: 17002

    Regards
    Siva

    DB:3.14:Reset Database Connection. Bad Database Connection Detected mj

    Do not see any Oracle errors in there - these will usually be ORA-nnnn for database errors and TNS-nnnn for network related errors.

    There can be a number of reasons why network sessions from the client (app server pool) to the server (Oracle instance) can be closed down. These can range from misbehaving Java app connection pools and network issues, to configuration settings and fatal Oracle errors.

    My knee jerk reaction to seeing a Java app server being used against Oracle is that the setup and config were done with little thought to Oracle concepts and minimum experience with Oracle itself. Unfortunately that seems to be the case in my experience - and kind of reinforced seeing the "+SQLException setAutoCommit()+" exception listed in your posting.. There is absolutely no reason why autocommit needs to be used in Oracle (it does not have monolithic lock manager and there is no lock escalation ever).

    Of course, my discriminatory view of Java app servers is of little help to you. :-)

    If you want to troubleshoot this specifically from the Oracle side, have a look at the profile settings used for the client sessions created. Profiles are used to limit resource utilisation. From the SQL Reference Guide, +"If a user exceeds the CONNECT_TIME or IDLE_TIME session resource limit, then the database rolls back the current transaction and ends the session. When the user process next issues a call, the database returns an error"+.

    Also enable tracing for the Oracle Listener (file listener.ora in +$ORACLE_HOME/network/admin+ ) - this enables you to see exactly what is happening at network level when a client requests a server connection to the database instance.

    Another factor is the type of connections. Default is dedicated - and if the process ceiling is reached on the server, no more dedicated processes can be created to serve clients. I prefer using a shared server processing pool instead for Java app servers as this scales better on the Oracle side and is also easier managed (ito number of server processes allocated to service the Java app layer).

    But this could very well be the wrong track to investigate if the problem is for example network related (routing issues, split network, etc), or related to the Java app server's db connection pool.

  • RELEVANCY SCORE 3.14

    DB:3.14:Bc4j - Closing Jdbc Connection 7x


    Hi,

    In BC4J , how can I ensure that my connection is being closed successfully before I close my application?

    I tried sessioninfo.revokeSession()
    and sessioninfo.close()
    Which one of these 2 are required to ensure that my connection is closing properly?

    Any help would be appreciated.
    TIA

    null

    DB:3.14:Bc4j - Closing Jdbc Connection 7x

    yourApplicationModule.getTransaction().disconnect();

  • RELEVANCY SCORE 3.14

    DB:3.14:Connection Closed By Remote Host. fd





    Hello,

    For me this is a new error, today I was trying to conect using ftp to my site and I got this message:

    Connection closed by remote host

    This is hapening with all of my accounts, any ideas to solve this problem ?

    Thanks for your time,
    DeLeTeBR

    DB:3.14:Connection Closed By Remote Host. fd




    Fixed !

    Fixed my /etc/hosts file with my real hostname, the strange thing is that I never have changed him and it was working fine all this months

  • RELEVANCY SCORE 3.14

    DB:3.14:Re: Resultset Is Closed? a1


    puckstopper31 wrote:
    finally
    {
    try
    {
    if(null != resultSet)
    {
    resultSet.close() ;
    }

    if(null != preparedStatement)
    {
    preparedStatement.close() ;
    }

    if(null != connection)
    {
    connection.close() ;
    }
    }
    finally
    {
    resultSet = null ;
    preparedStatement = null ;
    connection = null ;
    }
    }
    }Devil's advocate: if resultSet.close() throws an exception, you won't close the others.

    DB:3.14:Re: Resultset Is Closed? a1

    puckstopper31 wrote:

    Devil's rebuttal: True, but they are all set to be garbage collected, and the exception is thrown to a level where something can actually be done about it hopefully something more tangible than printing the error out to the console.

    PS.Yes, but, what do you want to do about it? There's not really much you can. And, set to be garbage collected, and having the resources properly released, are not necessarily the same thing. ;-)

  • RELEVANCY SCORE 3.14

    DB:3.14:Re: Trouble With Connection Pooling fx


    paulchwd wrote:
    Each time the code needs to hold a conversation with the DB, I check if the connection is null or closed in either circumstance I call getConnection() on the DataSource object and store the connection in a connection object, then set auto commit.Your statement and your problem would suggest that you are holding on to a connection between invocations of the code. That is the wrong way to do it.

    The only correct implementation
    1. Every single time you get a new connection.
    2. Use it
    3. Close it.

    There is no checking for null or if closed because there is nothing that can be checked.

    DB:3.14:Re: Trouble With Connection Pooling fx

    Hello, I'm using connection pooling with a MySql database on hosting it all on Tomcat (Netbeans 6.5 embedded one) ... at random times my DataSource object is null and cant establish a connection. I think I have set it up correctly, here is how I have it set up: On servlet init I create the DataSource object from a JNDI lookup... it creates fine Each time the code needs to hold a conversation with the DB, I check if the connection is null or closed in either circumstance I call getConnection() on the DataSource object and store the connection in a connection object, then set auto commit. When the transaction is complete, I commit and close the connection object, and close the resultset and statement objects. The problem: The first query I run always works fine and proper results are returned. Some times, when I execute a second query (connection is now closed as I closed it before) I call getConnection() on the DataSource object which throws an exception as DataSource object is null... Here is my context.xml file:?xml version="1.0" encoding="UTF-8"? Context path="/invoicer" docBase="invoicer" debug="5" reloadable="true" crossContext="true" Resource name="jdbc/invoices" auth="Container" type="javax.sql.DataSource" description="MySQL database for Invoicer" maxActive="20" maxIdle="30" maxWait="10000" username="root" password="Password1" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/invoices" / /ContextHere is the resource definition in my web.xml:resource-ref descriptionData Base Connection/description res-ref-namejdbc/invoices/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-refEdited by: paulchwd on May 2, 2009 3:23 PM