Long duration jdbc connection

Am connection through a thin client to a DB. The transaction runs for 3.5 hours, when i call commit and close the connection no exceptions are thrown. But when i look into the DB, no records are inserted, it appears the Tx did not commit. Autocommit is false,
And yes Verified the database, schema and tables name to ensure was looking at the correct place.
Same program when run for 30 minutes on a smaller input set, works fine, all inserts take place.
Has anybody had a very long Tx >4 hour ,and any thing special done for it.
Thanks
Tapan
Edited by: tapan_mokha on Feb 12, 2009 7:37 AM

or you may have ended up with an automatic rollback after some internal database timeout.
That way your commit would have committed exactly nothing, and (having been started in an automatically created new transaction) wouldn't yield an error.
It's a very weird transaction that requires that much time to run and can't have internediate commits (which would refresh the transaction, avoiding such timeouts).

Similar Messages

  • JDBC Connection taking way too long

    Hi,
    I have an odd problem which has just started to happen. I am creating a very simple JDBC connection to the MS SQL Server database using the Microsoft JDBC driver. This has always worked for me in the past and has never caused any problems. Now, however, creating a connection to my database is taking about 20 seconds! This is usually a sub-second operation. I have tried to narrow down the cause, but everything I have tried has failed. Here are all the things I have tried so far:
    1. Using a different JDBC driver (several, including the ODBC bridge)
    2. Create a test app which just has my connection code and run this from different machines on the network under different JDKs
    3. Re-installed by SQL Server database
    4. Connected using IP address rather than machine name (in case it was a DNS issue of some sort)
    5. Connected using different login accounts
    6. Vertified connectivity using telnet (port 1433)
    7. Verified connectivity via ODBC in an ASP page
    If I telnet to the SQL Server service I can connection without any delay. I can also connect immediately using an ODBC connection via an ASP page, so I don't think it's a problem with my database. I just seems that connectivity from Java land of woefully slow. I have never had this problem before, it's only started happening recently. The only thing that has changed recently is that I signed up for a new ADSL provider, but I can't see how this could have any bearing as all the machines are internal and connected by a 100Mbps router!
    Here's the code I am using to test...
    long current = System.currentTimeMillis();
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
    Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://<server-ip>:1433;User=<usr>;Password=<pwd>", null);
    System.out.println(System.currentTimeMillis() - current);
    connection.close();This gives me times of about 20 seconds.
    Help!

    You are right.. but the fact that:
    a) I can telnet and connect instantly
    b) The jdbc-odbc bridge connects immediately
    .. tells me that the network is ok.. at least for native functions. The only consistency I can find is that native (windows) functions connect without any issue, but pure Java functions experience problems. It may well be an issue with my network, but it seems that the issue is isolated to the Java environment (guessing here).
    I tested this theory by simply opening a socket connection from Java, but has not problems (connected immediately).
    I tried switching on the debug messages in the DriverManager (DriverManager.setLogWriter(writer))... this didn't tell me anything.
    ... The ONLY thing I can think of trying is disconnecting from my ADSL router and trying a simple cross-over cable from one machine to the other.
    Thanks for your help though.

  • JDBC connection pool failures when used by JMS stores

              We are using WebLogic 6.1 sp2. We defined a separate connection pool for use by
              a JMS Store.
              <JDBCConnectionPool Name="sybaseJMSPool"
              Targets="cluster00"
              InitialCapacity="2"
              MaxCapacity="10"
              DriverName="com.sybase.jdbc2.jdbc.SybDriver"
              Properties="[email protected]@;[email protected]@;charset=utf8"
              URL="jdbc:sybase:Tds:@jms.db.host@/@jms.db.name@"/>
              (note that the @xxx@ string are replaced by actual values).
              We are using Sybase Jconnect 5.5 to a Sybase ASE 12.5 database.
              We deployed this configuration on a number of environments (testing, staging,
              ..). The actual hardware and network configuration is different for the different
              system, but the WebLogic domain stays the same regarding this issue.
              On the test system we frequently get the following exceptions:
              <Aug 13, 2002 1:56:04 PM CEST> <Alert> <JMS> <www00-test> <node00>
              <ExecuteThread: '6' for queue: 'JMS.TimerClientPool'> <> <> <040048>
              <JMSServer "JMSServer00", store failure while writing message for topic
              OrderChangeTopic, java.io.IOException: JMS JDBC store, connection pool =
              <sybaseJMSPool>, prefix = <JMS00>: write failed
              java.sql.SQLException: JZ006: Caught IOException:
              com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Connection is already
              closed.
              at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead
              (ErrorMessage.java:715)
              at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3124)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1412)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1341)
              at com.sybase.jdbc2.jdbc.SybStatement.doCancel(SybStatement.java:564)
              at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1672)
              at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate
              (SybStatement.java:1625)
              at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate
              (SybPreparedStatement.java:91)
              at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate
              (P6LogPreparedStatement.java:179)
              at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:293)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1246)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              .>
              java.io.IOException: JMS JDBC store, connection pool = <sybaseJMSPool>, prefix
              = <JMS00>: write failed
              java.sql.SQLException: JZ006: Caught IOException:
              com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Connection is already
              closed.
              at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead
              (ErrorMessage.java:715)
              at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3124)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1412)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1341)
              at com.sybase.jdbc2.jdbc.SybStatement.doCancel(SybStatement.java:564)
              at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1672)
              at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate
              (SybStatement.java:1625)
              at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate
              (SybPreparedStatement.java:91)
              at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate
              (P6LogPreparedStatement.java:179)
              at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:293)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1246)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              at weblogic.jms.store.JDBCIOStream.throwIOException
              (JDBCIOStream.java:1213)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1256)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              Before that this message appeared:
              <Aug 13, 2002 11:31:16 AM CEST> <Error> <ConnectionManager> <www00-test>
              <node00> <ExecuteThread: '26' for queue: 'default'> <> <> <000000>
              <Closing: 'weblogic.rjvm.t3.T3JVMConnection@795af6' because of: 'Server
              received a message over an uninitialized connection: 'JVMMessage from: 'null'
              to: '-4555218188801970213S:192.168.13.1:[7001,7001,7002,7002,7001,7002,-
              1]:ADIS:node00' cmd: 'CMD_REQUEST', QOS: '101', responseId: '1',
              invokableId: '287', flags: 'JVMIDs Not Sent, TX Context Not Sent', abbrev
              offset: '34'''>
              This problem did not occur on another system which was used during a 2 day stress
              testing session.
              It seems that the problem occurs after a period in which no user request where
              made. The user requests trigger EJB's that start sending JMS messages.
              When the problem occurs, the JMS messaging systems seems to lock up as no messages
              are received anymore by the different listeners (MDBs).
              Undeploying and redeploying the JBDC connection pool solves the problem. This
              solution is unacceptable in case of a production system.
              A similarly defined connection pool, which is used by the EJBs to make database
              connection, does not manifest this problem.
              <JDBCConnectionPool Name="sybasePool"
              Targets="cluster00"
              InitialCapacity="10"
              CapacityIncrement="5"
              MaxCapacity="50"
              PreparedStatementCacheSize="150"
              DriverName="com.sybase.jdbc2.jdbc.SybDriver"
              Properties="[email protected]@;[email protected]@;JCONNECT_VERSION=6;charset=utf8"
              URL="jdbc:sybase:Tds:@db.host@/@db.name@"/>
              The JDBC connection pool is used as follows by the JDBC store
              <JMSJDBCStore ConnectionPool="sybaseJMSPool" Name="JDBCStore00" PrefixName="JMS00"/>
              <JMSServer Name="JMSServer00" Store="JDBCStore00" Targets="node00">
              <JMSTopic JNDIName="ADIS.JMSError" JNDINameReplicated="false" Name="ErrorTopic"/>
              <JMSTopic JNDIName="ADIS.Status"
              Name="StatusTopic" RedeliveryDelayOverride="300000"/>
              <JMSTopic JNDIName="ADIS.OrderChange" JNDINameReplicated="false"
              Name="OrderChangeTopic" RedeliveryLimit="3"/>
              </JMSServer>
              Turning on the "Test Reserved Connection" with a appropriate test table does not
              help.
              Some sources on the internet tell us that JZ0C0 errors in the Jconnect driver
              can be related to network problems. Nevertheless the connection pool should be
              able to cope with this.
              Can you provide any solution for this ? Or give us hints what can cause the problem
              

    Zhenhao Qi wrote:
    thanks! Joe.
    The SQL statement itself can no longer be simplified, the long excuation time is due to the database size and complicated Select criteria. I can easily reproduce the problem by using this SQL. I tried "BEA's Oracle driver (Type 4): Version 8.1.7,9.0.1,9.2.0". the question can be dissect into 2 pieces:
    1) why the jdbc connection (using oracle.jdbc.OracleDriver) won't return anything if the SQL execution time > 5min, that is probably the Oracle's problem
    2) why the occupied connection pool won't release even I set "Statementtimeout=600", this is Weblogic's problem.
    ZhenhaoHi. Yes, (1) is oracle's problem. (2) may also be. The JDBC spec has very few
    allowances for one thread to interrupt a second thread's JDBC call. If we
    transmit your timeout request by calling setQueryTimeout() on the oracle
    statement, and if you have a weblogic-controlled transaction we call
    Statement.cancel() on any ongoing statement, we end up relying on whether
    the Oracle driver implements and responds to those calls.
    Are you doing weblogic-controlled transactions? Are you/can you
    call Statement.setQueryTimeout() on your statements, or are these
    generated JDBC queries?
    If you can duplicate the problem using the weblogic.jdbc.oracle.OracleDriver
    we have some other debug avenues. This would be good even if you really
    want to use the thin driver, because we will do the same JDBC calls to
    either driver, and the debug would prove (if) we set up a query timeout
    and if we call cancel(). If we do, then we can know that it is the Oracle
    driver failing in these regards.
    Joe

  • How to use JDBC Connection Pools in a standalone application?

    Hi, there,
    I have a question about how to use JDBC Connection Pools in an application. I know well about connection pool itself, but I am not quite sure how to keep the pool management object alive all the time to avoid being destroyed by garbage collection.
    for example, at the website: http://www.developer.com/java/other/article.php/626291, there is a simple connection pool implementation. there are three classes:JDBCConnection, the application's gateway to the database; JDBCConnectionImpl, the real class/object to provide connection; and JDBCPool, the management class to manage connection pool composed by JDBCConnectionImpl. JDBCPool is designed by Singleton pattern to make sure only one instance. supposing there is only one client to use connection for many times, I guess it's ok because this client first needs instantiate JDBCPool and JDBCConnectionImpl and then will hold the reference to JDBCPool all the time. but how about many clients want to use this JDBCPool? supposing client1 finishes using JDBCPool and quits, then JDBCPool will be destroyed by garbage collection since there is no reference to it, also all the connections of JDBCConnectionImpl in this pool will be destroyed too. that means the next client needs recreate pool and connections! so my question is that if there is a way to keep pool management instance alive all the time to provide connection to any client at any time. I guess maybe I can set the pool management class as daemon thread to solve this problem, but I am not quite sure. besides, there is some other problems about daemon thread, for example, how to make sure there is only one daemon instance? how to quit it gracefully? because once the whole application quits, the daemon thread also quits by force. in that case, all the connections in the pool won't get chance to close.
    I know there is another solution by JNDI if we develop servlet application. Tomcat provides an easy way to setup JNDI database pooling source that is available to JSP and Servlet. but how about a standalone application? I mean there is no JNDI service provider. it seems a good solution to combine Commons DBCP with JNID or Apache's Naming (http://jakarta.apache.org/commons/dbcp/index.html). but still, I don't know how to keep pool management instance alive all the time. once we create a JNDI enviroment or naming, if it will save in the memory automatically all the time? or we must implement it as a daemon thread?
    any hint will be great apprieciated!
    Sam

    To my knoledge the pool management instance stays alive as long as the pool is alive. What you have to figure out is how to keep a reference to it if you need to later access it.

  • Error Message: JBO-26061:Error while opening JDBC connection

    JDeveloper 9i was connecting to 9i database (localhost) before and now it is not connecting giving IO Exception.
    Getting JBO-26061:Error while opening JDBC connection, when run from OC4J.
    Should we give any path to jdbc classes12.zip? Does it have anything to do with changing host name; that is the only thing I have done before getting this error.
    Please help!!

    Please check the connection details and make sure the password is deployed. You can verify the connection
    details by looking at Connections | DataBase node in the Navigator pane.
    1. Also, test your BC4J middlet tier using BC4J Tester. To do that select your Application Module in the BC4J project,
    right click | Test..
    2. Check your BC4J Configuration and make sure it has the right connection information. To do that select your Application Module in the BC4J project,
    right click | Configurations....
    Hi
    I'm learning Jdeveloper not long time, i'm still new in Jdeveloper. I have learn to build BC2J JSP Development from oracle9i jdeveloper viewlet demonstration. when I compile, its have an error "warning: ISO-8859-1character set may not match project compiler setting". When I run, its show from browser and have an error :
    "Error Message: JBO-30003: The application pool (mypackage.MypackageModule.MypackageModuleLocal) failed to checkout an application module due to the following exception:
    Error Message: JBO-26061: Error while opening JDBC connection."
    So what can I do, I'm really need your help.
    Thanks in advance

  • Interrupt method + JDBC connections

    Hi all
    <br>
    Obviously I have a problem with the above :)
    Briefly:
    <br><br>
    - I have a thread that does some things (long operations) and writes results into database
    <br>
    - The main thread has an option to cancel (using interrupt method) the thread on user's request
    <br><br>
    but when I invoke that interrupt method it obviously stops the thread, stops the statement running, takes me to the catch block shown below, but when I try to create a new JDBC connection in that block, I get the exception:
    <br>
    Io exception: The Network Adapter could not establish the connection <br>
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)<br>
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)<br>
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:335)<br>
         at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:361)<br>
         at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:442)<br>
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:321)<br>
         at java.sql.DriverManager.getConnection(DriverManager.java:525)<br>
         at java.sql.DriverManager.getConnection(DriverManager.java:171)<br>
    <br>
    <b>In other words I am not able to rollback what has been done so far!</b>
    <br>
    I just have to also say that I am using connection pooling and the "long operation" consists of many smaller ones. They all use database. It is a one tree-like process and I can't use just one connection for the whole thing to make it more simple.
    <br>
    <code>
    run()<br>
    {<br>
    try<br>
    {<br>
    //long operation/transaction here<br>
    ...<br>
    }<br>
    catch (Exception e)<br>
    {<br>
    //do some rollback operations corresponding to <br>
    //the above transaction's progress <br>
    }<br>
    }<br>
    </code>
    <br>
    So, can anyone tell me please, what am I doing wrong or is there any workaround for that?
    <br>
    Regards<br>
    Thomas
    <br>
    Message was edited by: <br>
    hrabiatc
    Message was edited by:
    hrabiatc

    Good descriptions at:
    http://www.java.sun.com/products/jdbc/driverdesc.html

  • JDBC Connection Reset when using many processes on 64 bit system

    Hi,
    we've a annoying JDBC connection problem since we migrated our Java server to a 64 bit operating system. Here our environment.
    Database Machine:
    Oracle 10g
    Linux 32 Bit (but same problem on 64 Bit)
    Application Servers Machine:
    JDBC driver 11.1.0.6
    SUN Java 1.6.0_06 64bit
    Linux 64 bit (SLES 10 SP2)
    We have 6 different Java server processes (but with the same code) which all create some connections to the same database (running on a different Hardware). All 6 Java server processes starting at the same time (via scripts).
    Everything was fine, until we migrated the application server machine from 32 bit Linux to 64 bit Linux. From this day on, the half (or one more or less) of our application server processes can't longer connect to the database. The application server processes which have the problem product the following stack trace:
    java.sql.SQLRecoverableException: I/O Exception: Connection reset
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:281)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:118)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:224)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:296)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:611)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:455)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:494)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:199)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:154)
    at com.aaaa.utils.db.DbConnectionPool.<init>(DbConnectionPool.java:130)
    It looks like a network problem with the system but all other network stuff works without problems, between the two machines.
    - We use the thin JDBC driver (no OCI)
    - No firewalls are active on both systems
    - Both systems are in the same subnet connected to the same switch
    - The DNS configuration on both systems are ok (forward and reverse)
    - We've found the same problem on different application-server/database-server pairs with 64 bit application server hardware - but not all of our 64 bit server systems have this problem.
    - When running application server process and database on the same system (connecting via localhost) the problem does not longer appear.
    - The same database machine connected from a 32 bit application server (with 6 different java processes starting at the same time) works without a problem.
    We've tried a lot of things to isolate the problem - but with no success.
    - Same problem with SUN Java 1.6.0_06 32 bit (on 64 bit Linux)
    - Same problem with SUN Java 1.6.0_15 (32 and 64 bit)
    - Played with some JDBC connection properties (oracle.jdbc.TcpNoDelay, oracle.jdbc.ReadTimeout, oracle.net.CONNECT_TIMEOUT, oracle.net.disableOob, oracle.jdbc.RetainV9LongBindBehavior, oracle.jdbc.StreamChunkSize) without a positive result.
    - We've updated Linux network driver
    - We've changed to an completeky other NIC
    - We've tried an other Linux 64 distribution
    - We've increased the PROCESSES parameter in the init.ora
    - We've tried the JDBC driver 11.1.0.6
    - We've tried the _g version of the JDBC driver, but the debugging output simply tell us "Connection Reset" without a hint why.
    - We've tried a more complex JDBC connect string (
    "jdbc:oracle:thin:@(DESCRIPTION=" +
    "(ADDRESS_LIST=" +
    "(ADDRESS=(PROTOCOL=TCP)" +
    "(HOST=host)" + =
    "(PORT=port)" +
    ")" +
    ")" +
    "(CONNECT_DATA=" +
    "(SERVICE_NAME=sid)" +
    "(SERVER=DEDICATED)" +
    ")" +
    Nothing of this things helped us to isolate the problem.
    When we start our application server processes with a long pause (>1 min) between every process start. The problem does not occure. When we start only one application server with the same number of connections as the 6 different application server processes, everything works fine.
    We have absolute no idea why
    - this only occures on 64 bit Linux
    - independent if it's a 32 bit or 64 bit JVM
    - does not occure on all 64 bit application server machines / database machine pairs
    - never occure on the same 64 bit app server hardware when using a 32 bit Linux
    - using the Oracle JDBC 10g driver (10.xxx) there is no problem (but because of other issues, we need to use the JDBC 11g driver)
    Does anybody has an idea what our problem is?
    Thanks in advance,
    greetings

    I was recently struggling with this exact same problem. I opened a ticket with Oracle and this is what they told me.
    java.security.SecureRandom is a standard API provided by sun. Among various methods offered by this class void
    nextBytes(byte[])
    is one. This method is used for generating random bytes. Oracle 11g JDBC drivers use this API to generate random number during
    login. Users using Linux have been encountering SQLException("Io exception: Connection
    reset").
    The problem is two fold
    1. The JVM tries to list all the files in the /tmp (or alternate tmp directory set by -Djava.io.tmpdir) when
    SecureRandom.nextBytes(byte[]) is invoked. If the number of files is large the
    method takes a long time
    to respond and hence cause the server to timeout
    2. The method void nextBytes(byte[]) uses /dev/random on Linux and on some machines which lack the random
    number generating hardware the operation slows down to the extent of bringing the whole login process to
    a halt. Ultimately the the user encounters SQLException("Io exception:
    Connection reset")
    Users upgrading to 11g can encounter this issue if the underlying OS is Linux which is running on a faulty hardware.
    Cause
    The cause of this has not yet been determined exactly. It could either be a problem in
    your hardware or the fact
    that for some reason the software cannot read from dev/random
    Solution
    Change the setup for your application, so you add the next parameter to the java command:
    -Djava.security.egd=file:/dev/../dev/urandom
    We made this change in our java.security file and it has gotten rid of the error.

  • View # of current Connection of jdbc connection pool

    Do you guy know of ANY METHODS of viewing # of current database Connection of jdbc connection pool in SUNAPP SERVER?
    for example i have jdbc/Dashboard Connection Pool in SUNAPP SERVER and I wanted to view, at any point of time, how many connection database that it is being utilized during that time. The reason I wanted to see the # of currection jdbc connection is because my Max (400connections) ran out or hanging really long period of time.
    Thanks,
    Kelvin

    There is no way currently to do this

  • Errors using weblogic sql driver: "No JDBC connection can be made because the transaction state is marked rollback"

    One of our customers starts to encounter this error message recently.
    We checked our log files. It seems that the error happens when
    to obtain a jdbc connection. Have anyone seen similar problems
    and knows how to fix it? thanks in advance.
    We are using weblogic server 6.1sp2, and weblogic sql type 4 driver.
    The functions that invoke the jdbc calls are stateless session bean
    methods with their transaction attributes marked as Required.
    There is no nested calls of these methods.
    A partial stack trace we obtained is as following:
    java.sql.SQLException: No JDBC connection can be made
    because the transaction state is
    Marked Rollback
         at weblogic.jdbc.jts.Connection.getOrCreateConnection(Connection.java:586)
         at weblogic.jdbc.jts.Connection.prepareStatement(Connection.java:115)
         at weblogic.jdbc.rmi.internal.ConnectionImpl.prepareStatement(ConnectionImpl.java:135)
         at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:76)
    lixin

    Joseph Weinstein <[email protected]> wrote:
    >
    >
    YuanHui Liu wrote:
    Joe,
    We got the exact same error message. The error came after we got theJDBC connection,
    and trying to create statement off it.
    It occurs intermitently when we are running another standalone JAVAapp to do
    some end of day work, which results in the DB Server being very busy(90+%CPU
    usage) for about 5 minutes. We see a surge of requests to the WLSJDBC Connection
    pool. This would sometimes result in all our subsequent DB requeststo fail and
    lead to a crash.
    We are using WLS6.0SP1. I do not think there's a 30 seconds wait leadingto a
    connection timeout that caused this(rather it is the end effect).
    Can you give us a more detailed explanation? Is there a miscommunicationbetween
    our DB(Sybase12) and WLS?Hi. It looks to you like it's after you get the connection, but really
    it's when the server is
    gettng the pool connection. For performance/synchronization reasons we
    do a clever
    delay: When your code asks for a pool connection we quickly give you
    the pool wrapper,
    but we delay actually reserving the real underlying DBMS connection until
    your first
    real need for a connection, at your first JDBC call, such as createStatement()
    etc.
    It is while waiting for a pool connection long enough for the transaction
    coordinator
    to have timed you out before you ever get a chance. It's nothing to do
    with the
    DBMS or even JDBC, I believe. I think the weblogic server either has
    too few execute-threads
    and/or too few CPU cycles to do the work load.
    Okay, so there's a lazy initialization of the connection.
    From reading our log I believe our failur is immediate rather
    than waiting for 30+ seconds(the default setting) from the DB,
    the timeout occurred later as a result. At the time either because the DB Server
    is very busy.
    Since we are running WLS6.0 we have only one connection pool,
    we have defined a max of 150 threads in the pool. While this
    is happening the DB Server is being pinned by an overnight job,
    but the WLS Server is not busy at all. The DB and WLS resides
    on different physical boxes.
    We also have a thread dump from the WLS console when we rebooted the server, it
    showed that we are hanging on to the thread & jdbc
    connections after these exceptions has occurred instead of releasing them, note
    "16083"(~4.5 hours) seconds has passed:
    142 116222 Retry rollback request for tx: 'transaction=(IdHash=2963855,Name =
    [EJB UserManagerBeanImpl.signalICUserServletHeartBeat()],Xid=30643:8f3838f3709bf53d,Status=Rolling
    Back. [Reason = Unknown],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since
    begin=16083,seconds left=10,ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=started,assigned=server),SCInfo[server]=(state=active),properties=({weblogic.jdbc=t3://159.55.158.25:8005,
    weblogic.transaction.name=[EJB UserManagerBeanImpl.signalICUserServletHeartBeat()]}))'
    Scheduled Trigger
    So I would argue this problem actually chewed up resources on the WLS server.
    -Yuanhui Liu
    >>
    >>
    Thanks.
    -YuanHui Liu
    Joseph Weinstein <[email protected]> wrote:
    lixin wrote:
    One of our customers starts to encounter this error message recently.
    We checked our log files. It seems that the error happens when
    to obtain a jdbc connection. Have anyone seen similar problems
    and knows how to fix it? thanks in advance.
    We are using weblogic server 6.1sp2, and weblogic sql type 4 driver.
    The functions that invoke the jdbc calls are stateless session bean
    methods with their transaction attributes marked as Required.
    There is no nested calls of these methods.
    A partial stack trace we obtained is as following:
    java.sql.SQLException: No JDBC connection can be made
    because the transaction state is
    Marked Rollback
    at weblogic.jdbc.jts.Connection.getOrCreateConnection(Connection.java:586)Hi. This sounds like a JVM thread starvation issue, and/or a server
    load
    issue. What is
    happening is that the transaction is started, and times out beforethe
    SSB even gets to
    the first JDBC work. I would first verify that the customer is using
    the very latest JVM
    available for the machine.
    Joe Weinstein
    at weblogic.jdbc.jts.Connection.prepareStatement(Connection.java:115)
    at weblogic.jdbc.rmi.internal.ConnectionImpl.prepareStatement(ConnectionImpl.java:135)
    at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:76)
    lixin

  • Getting Exception in jdbc connection got from DataSource in Oracle AS

    Hi
    i am using data source in my application.
    When my application is invoked it gets the jdbc connection from the data source, performs set of operations and then releases the connection.
    But if the application is invoked after a long time e.g. 10 hours then i get the following exceptions which i have logged:
    Io exception: Connection reset
    and the other exception is given below:
    Closed Connection
    The data-sources.xml is as follows:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE data-sources PUBLIC "Orion data-sources" "http://xmlns.oracle.com/ias/dtds/data-sources.dtd">
    <data-sources>
    <data-source
    name="MYDS"
    class="oracle.jdbc.pool.OracleConnectionCacheImpl"
    location="jdbc/myDSCON"
    connection-driver="oracle.jdbc.driver.OracleDriver"
    username="xxxxxxxx"
    password="xxxxxxxx"
    url="jdbc:oracle:thin:@localhost:1521:orcl"
    inactivity-timeout="30"
    max-connections="100" >
    <property name="cacheScheme" value="1" />
    </data-source>
    </data-sources>
    Please let me know what is wrong with my application or configuration setting or something is wrong with oracle application server.

    Hi,
    I found one solution which is for 10.1.2.x and i am using Oc4j 10.1.3.1 but solution is below
    Solution
    There is a new setting called "ValidateConnections" from 10.1.2.x. This setting will make sure to check the validity of the connections before it is assigned to the application.
    1. Download and apply the patch for unpublished bug 4305639 for your current 10.1.2.x version. If a patch is not already available then please submit a backport request to get the patch to your version.
    2. Set the command line option "-DValidateConnections=true" and restart the container. This can be set via EM AS control or by manually updating opmn.xml file. After the changes the options should look like
    <process-type id="oc4j_test1" module-id="OC4J">
    <module-data>
    <category id="start-parameters">
    <data id="java-options" value="-server -Djava.security.policy=/opt/oracle/jw101202/j2ee/oc4j_test1/config/java2.policy -Djava.awt.headless=true -DValidateConnections=true" />
    <data id="oc4j-options" value="-properties"/>
    Regards,

  • JDBC connection over IPv6

    Hi
    I have an MS SQL Server 2005 Database Server and a Client computer on two different subnets.
    There is also a DNS Server, which contains both an IPv4 (A) and IPv6 (AAAA) DNS record for the Database Server.
    I've disabled IPv4 routing between the two subnets so that the Database Server is only accessible by IPv6 from the Client computer.
    I am then unable to connect to the Database Server from the Client using JDBC.
    I have tried increasing the loginTimeout in the JDBC connection string, but this doesn't appear to make any difference.
    I get a java.net.ConnectException in about 20 seconds.
    If I remove the IPv4 (A) record of the Database Server from the DNS Server, the JDBC connection then succeeds.
    Does JDBC iterate over all the possible addresses of the Database Server?
    Is the loginTimeout the correct parameter to try to increase, to allow it to iterate over the possible addresses?
    There is a similar problem with MS SQL Client - see http://msdn.microsoft.com/en-us/library/ms378428(SQL.90).aspx
    But increasing the connection timeout allows a successful connection.
    Thanks
    Alain

    jschell wrote:
    ahkal01 wrote:
    Alain: A machine may have multiple IPv6 addresses, as well as an IPv4 address.
    You may not be able to get to the machine via all the addresses, depending on the network route.
    If a driver gives up on the first DNS lookup (which probably will be the IPv4 address), it'll never try the IPv6 addresses. However that is NOT what you are testing.
    As described in your first post there is a route. Routing works if the final location is found. After that a refused connection is a refused connection.
    Alain: In my test, IPv4 routing is disabled between the two subnets. So there is no IPv4 routing between the two machines, only IPv6.
    >
    But even so, to me it is still two different IP addresses. Just as if you try to create your own replication by having two database servers on different IPv4 addresses. If the client is supposed to be using one address then the DNS should be set up that way.
    Or use the address. Because the point is not the IP address, the point is the DNS look up.
    Alain: With IPv6, it is common for computers to be assigned more than one address for routing under different hierarchies.
    If you're saying that the DNS lookup should be set up to return only one IP address to client computers trying to connect to the DB Server, DNS will need to be set up differently depending on where the client computer is.
    >
    Again looking at it from the point of someone developing a driver the only option I would allow is that one might be able to specify a configuration value that says to try a IPv6 address first. That would be in the driver, not JDBC. So you can look to your driver for that.
    There is a similar problem with MS SQL Client - see http://msdn.microsoft.com/en-us/library/ms378428(SQL.90).aspx
    But increasing the connection timeout allows a successful connection.
    I do not see anywhere in that link that it claims that the setup you are using would work Alain: apologies. It was the wrong url link.
    I meant, http://blogs.msdn.com/sql_protocols/archive/2005/10/12/480192.aspx.The scenario there is SQL Server is configured to listen only on IPv6 addresses and disable all IPv4 addresses so that only IPv6 connection can be accepted. The workaround is to specify the IPv6 address of the target machine explicitly to force SNI to use IPv6 connection directly or to use longer timeout value. I don't see that in that blog.
    It says that if you have addresses that some different behavior might result. It specifically refers to using an IPv4 address (not DNS) and failing on that and then attempting to use a IPv6 address (again not a DNS) and even in that case it might fail.
    Alain: The blog is talking about a hostname resolving into multiple addresses. I quote from the blog, with bold for emphasis,
    "In most cases, the connection string does not need to be modified if the <servername> is specified using server hostname or FQDN (Full Qualified Domain Name). If the server machine has dual-stack, *its hostname or FQDN will be resolved into multiple IP addresses*, including at lease one IPv4 address and multiple IPv6 addresses. *And SNI will attempt to establish connections using these IP addresses in order and use the first connection that succeeds*. IPv4 addresses are attempted first if both IPv4 and IPv6 addresses are present. This logic is transparent to the users of ODBC, OLEDB or ADO.NET.
    And it doesn't say anything about that some clients already do this but merely that they can.
    Alain: SNI does, from the quote above. A test also shows that it does try all the addresses that DNS returns, with the caveat that the connection timeout has to be increased.
    Unfortunately it looks like the MS JDBC driver doesn't do likewise.
    Myself I don't really consider that a valid option for most use cases for drivers. If I have a data center then I am not normally going to be using both types of addresses. And if I am both will work. And if there are variation in subnets then I would expect that if DNS is in use then it would be set up to correctly represent that.Thanks for your input on this thread. Much appreciated.

  • Error in Progress9.1d - JDBC Connection

    Hi everyone,
    I am trying to make a JDBC connection to Progress 9.1d database through JDeveloper. I think I defined all the classpaths, etc. correctly (jdbc.jar and progress.jar).
    - My driver class name is as shown below:
    com.progress.sql.jdbc.JdbcProgressDriver
    - And my url is as shown below:
    jdbc:jdbcprogress:T:narntsv:23900:rac
    However, I am always getting the same error (I think there is a problem with allocating the connection handle):
    "java.lang.UnsatisfiedLinkError: allocConnect"
    Here are the compiler messages I receive:
    D:\jDeveloper\jdk\bin\javaw.exe -ojvm -classpath D:\jDeveloper\jdev\mywork\denemeRAC\Model\classes;D:\dlc91d\java\progress.jar;D:\dlc91d\java\jdbc.jar JdbcProgressTest
    DriverManager.getConnection("jdbc:JdbcProgress:T:narntsv:23900:rac")
    trying driver[className=com.progress.sql.jdbc.JdbcProgressDriver,com.progress.sql.jdbc.JdbcProgressDriver@3]
    *Driver.connect (jdbc:JdbcProgress:T:narntsv:23900:rac)
    JDBC to Progress: Checking security
    No SecurityManager present, assuming trusted application/applet
    JDBCPROGRESS 1.1000
    Current Date/Time: Mon Jun 07 14:16:27 EEST 2004
    Loading JdbcProgress library
    ******************java.library.path is C:\WINNT\SYSTEM32;C:\WINNT;C:\WINNT\SYSTEM32\WBEM;C:\PROGRAM FILES\BORLAND\CBUILDER\BIN;D:\PROGRESS91B\bin;C:\j2sdkee1.3.1\bin;C:\j2sdk_nb\j2sdk1.4.2\bin;D:\dlc91d\bin;D:\dlc91d\jdk\bin;D:\dlc91d\jre\bin\hotspot;D:\dlc91d\bin\JdbcProgress.dll;C:\Adabas\bin;C:\Adabas\pgm;c:\pavfn\platinum\;D:\progress91b\java
    ******************java.class.path is D:\jDeveloper\jdev\mywork\denemeRAC\Model\classes;D:\dlc91d\java\progress.jar;D:\dlc91d\java\jdbc.jar
    Allocating Environment handle (SQLAllocEnv)
    hEnv=1965669092927392
    Returning from initialize --- JdbcProgressDriver.java
    Completing JdbcProgressConnection construction -- DriverInterface
    Just got a hDbc. Created a connection object. Calling initialize on that.
    Exception in thread main
    Calling JdbcProgress SQLAllocConnect
    Allocating Connection handle (SQLAllocConnect)
    @JdbcProgressTest:finally
    java.lang.UnsatisfiedLinkError: long com.progress.sql.jdbc.JdbcProgress.allocConnect(long, byte[])
    at com.progress.sql.jdbc.JdbcProgress.allocConnect(Native Method)
    at com.progress.sql.jdbc.JdbcProgress.SQLAllocConnect(JdbcProgress.java:187)
    at com.progress.sql.jdbc.JdbcProgressDriver.allocConnection(JdbcProgressDriver.java:823)
    at com.progress.sql.jdbc.JdbcProgressConnection.initialize(JdbcProgressConnection.java:175)
    at com.progress.sql.jdbc.JdbcProgressDriver.connect(JdbcProgressDriver.java:168)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:140)
    at JdbcProgressTest.main(JdbcProgressTest.java:111)
    Process exited with exit code 1.
    Why would that be? Please help me.
    Thank you,
    Meltem

    They probably have some DLL which is part of the jdbc driver, make sure that DLL is locable in your system's PATH environment variable and then restart JDeveloper.
    That's normally the problem of the unsatisfied link error.
    Rob
    Team JDev

  • Unable to create dynamic JDBC Connections in RMI Server

    Hi,
    Goal: Using Swing client to connect to a variety of JDBC databases via RMI dynamically....
    J2SE : 1.4.2
    J2EE: 1.31
    Databases: Oracle 9i(R2), MySQL 4.0, MS Access 2000
    Platform : Windows 2000 SP4 (Professional and Server)
    I have a working client-server application using RMI to connect to a single database. I want the ability
    to create JDBC connections dynmically by invoking a RMI method after it has been bound. Presently
    I am getting null pointers. Anybody offer any solutions or work arounds?

    Goal: Using Swing client to connect to a variety of
    JDBC databases via RMI dynamically....Actually what u want from the client swing is to form a Form using the datamodel from the database, invoke query as the client is allowed and wants and update changes. I hope I got it right, thats what u want.
    Actually as per my knowledge goes thats what any Database 3-tier program should do.
    I have a working client-server application using RMI
    to connect to a single database. I want the ability
    to create JDBC connections dynmically by invoking a
    RMI method after it has been bound. Presently
    I am getting null pointers. Anybody offer any
    solutions or work arounds?Database connections are only needed as long as the query to the database are being processed. So for ur solution if u have a RMI method that, will invoke first, the database connection and then process the query and then disconnect it , would be enough. When multiple clients will call the method there will be multiple connections to the database as they can have threads working or if u want one process at a time u can sycronize the method. This RMI method will only return the result set of the query and that would be enough for ur solution. Now to be able to say why ur getting null pointers I would need the code u r using.

  • JDBC connectivity taking lots of time in throwing exception

    Hi ,
    We are doing JDBC connectivity in java program and its working fine, but
    if the connectivity with the orale server goes down it give exception after a
    long time and somtimes behave abnormally.
    Please help.

    Hi,
    if you are using the OracleDataSource and thin driver to connecto to an oracle database try to set the following property through the setConnectionProperties API
    oracle.jdbc.ReadTimeout
    the value is the numer of milliseconds the socket wait for reads for data from the database server.
    The optimal value is application related so try with different values.
    ciao,
    Giovanni

  • JDBC CONNECTIONS RECURSIVE WAY

    JAVA DEVELOPER COMUNITY
    I request your help in the following topic,
    i am doing a java program that store a
    complete file system in an Oracle Database 11GR2.
    So i use a recursive algorithm to do that
    but i don't know how to handle the JDBC
    connections in order to not overload the total of
    physical connections available to the database.
    Thanks for your help.
    Regards from Colombia - South America
    JOHN JAIRO GOMEZ LAVERDE
    I am using the following code:
    import java.io.* ;
    import java.sql.*;
    import java.lang.String;
    import java.util.Date;
    import java.util.Calendar;
    import java.util.*;
    import java.text.SimpleDateFormat;
    import oracle.jdbc.*;
    import oracle.jdbc.pool.*;
    import javax.naming.*;
    import javax.naming.spi.*;
    public class InsertArcDir
    public void AddFiles( File file )
    try
    Calendar fechamod=Calendar.getInstance();
    String SQL;
    PreparedStatement pstmt = null;
    java.util.Properties prop = new java.util.Properties();
    prop.setProperty("MinLimit", "2");
    prop.setProperty("MaxLimit", "10");
    OracleDataSource ods = new OracleDataSource();
    ods.setURL("jdbc:oracle:thin:@//oracle:1521/xe");
    ods.setUser("hr");
    ods.setPassword("hr");
    ods.setConnectionCachingEnabled(true);
    ods.setConnectionCacheProperties (prop);
    //ods.getConnectionCacheName();
    Connection conn = ods.getConnection ("hr","hr",prop);
    Statement stmt = conn.createStatement();
    fechamod.setTimeInMillis(file.lastModified());
    SQL="INSERT INTO tbarchivos(nombrearc,fechaarc,direcarc) VALUES(?,?,?)";
    pstmt = conn.prepareStatement(SQL);
    java.sql.Timestamp sqlDate = new java.sql.Timestamp(fechamod.getTimeInMillis());
    pstmt.setString(1, file.getName());
    pstmt.setTimestamp(2, sqlDate);
    pstmt.setString(3, file.getParent());
    pstmt.executeUpdate();
    stmt.close();
    conn.close();
    catch(Exception e)
    System.out.println("Exepcion"+e.getMessage());
    System.out.println("OTHER TEST");
    * Works on a single file system entry and
    * calls itself recursively if it turns out
    * to be a directory.
    * @param file A file or a directory to process
    public void traverse( File file )
    // Check if it is a directory
    if( file.isDirectory() )
    // Get a list of all the entries in the directory
    String entries[] = file.list() ;
    // Ensure that the list is not null
    if( entries != null )
    // Loop over all the entries
    for( String entry : entries )
    // Recursive call to traverse
    traverse( new File(file,entry) ) ;
    else
    if(file.isFile())
    InsertArcDir rta = new InsertArcDir() ;
    rta.AddFiles(file);
    else
    System.out.println("*** VALOR INCORRECTO ***");
    //try
    //stmt.close();
    //conn.close();
    //catch(Exception e)
    // System.out.println("Exepcion"+e.getMessage());
    * The program starts here.
    * @param args The arguments from the command line
    public static void main( String args[] )
    try
    java.util.Properties prop = new java.util.Properties();
    prop.setProperty("MinLimit", "2");
    prop.setProperty("MaxLimit", "10");
    OracleDataSource ods = new OracleDataSource();
    ods.setURL("jdbc:oracle:thin:@//oracle:1521/xe");
    ods.setUser("hr");
    ods.setPassword("hr");
    ods.setConnectionCachingEnabled(true);
    ods.setConnectionCacheProperties (prop);
    ods.setConnectionCacheName("ImplicitCache01");
    Connection conn = ods.getConnection ();
    conn.close();
    //Statement stmt = conn.createStatement();
    // Create an object of this class
    InsertArcDir rt = new InsertArcDir() ;
    if( args.length == 0 )
    // If there are no arguments, traverse the current directory
    rt.traverse( new File(".") ) ;
    else
    // Else process every argument sequentially
    for( String arg : args )
    rt.traverse( new File(arg) ) ;
    //stmt.close();
    //conn.close();
    catch(Exception e)
    System.out.println("Exepcion"+e.getMessage());
    *********************

    I will not comment on weather or not to use recursion. However, I suggest:
    This statement and its configuration should occur once in your program and not in a recursive function:
    OracleDataSource ods = new OracleDataSource();
    Assuming your using connection pooling, get a connection, use it, and close it as quickly as possible for each write to the database (not the best solution, but good enough for now until you read up on JDBC). Do not hold onto the connection for the duration of the application.
    Conection pooling is designed to allow you to get and close a connection with minimal performance loss. I suggest reading up on JDBC, or better yet reading a book on JDBC.

Maybe you are looking for