1 Reply Latest reply on Nov 25, 2002 4:52 AM by Jurgen Lust

    Oracle JDBC query hangs for 60 seconds

    Jurgen Lust Newbie

      Hi,

      After having strange performance problems with Jboss 3.0.4 and Oracle 8.1.7, I wrote a little test app that performs a series of very simple queries on an Oracle 8.1.7 database with jdk1.4 and ojdbc14 drivers. Every now and then, a query just hangs for exactly 60 seconds before continuing, without throwing any kind of exception. This sometimes happens after a couple of hundred queries, but it can also be after 4 or five. I thought maybe the database runs out of cursors, but then I would get an exception right? After every query, I close the ResultSet and Statement, so it should work just fine. When I tested the same app on PostgreSQL 7.2, it worked perfectly. Is this a problem with the Oracle JDBC drivers, or am I doing something wrong here?

      Here's the code of my simple test app:

      import java.sql.*;
      import java.io.*;

      class JdbcTest {
      public static void main (String args []) throws Exception {
      DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
      Connection conn = DriverManager.getConnection
      ("jdbc:oracle:thin:@foo.bar.com:1521:BLABLA","test", "test");

      for (int i=0;i<500;i++) {
      Statement stmt = conn.createStatement ();
      ResultSet rset = stmt.executeQuery ("SELECT sitenr,omschrijving FROM site");
      while (rset.next ())
      System.out.println (rset.getString (1) + ": " + rset.getString(2));
      rset.close();
      stmt.close();
      }
      conn.close();
      }
      }

        • 1. Re: Oracle JDBC query hangs for 60 seconds
          Jurgen Lust Newbie

          By the way, here's the thread dump:

          "Signal Dispatcher" daemon prio=10 tid=0x009E8118 nid=0xdc4 waiting on condition
          [0..0]

          "Finalizer" daemon prio=9 tid=0x0003E6F0 nid=0xdd4 in Object.wait() [ab1f000..ab
          1fd88]
          at java.lang.Object.wait(Native Method)
          - waiting on <02F81698> (a java.lang.ref.ReferenceQueue$Lock)
          at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
          - locked <02F81698> (a java.lang.ref.ReferenceQueue$Lock)
          at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
          at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

          "Reference Handler" daemon prio=10 tid=0x0003D2C0 nid=0xdd8 in Object.wait() [aa
          df000..aadfd88]
          at java.lang.Object.wait(Native Method)
          - waiting on <02F81700> (a java.lang.ref.Reference$Lock)
          at java.lang.Object.wait(Object.java:426)
          at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:113)
          - locked <02F81700> (a java.lang.ref.Reference$Lock)

          "main" prio=5 tid=0x00034AB8 nid=0xdc8 runnable [7f000..7fc3c]
          at java.net.SocketInputStream.socketRead0(Native Method)
          at java.net.SocketInputStream.read(SocketInputStream.java:129)
          at oracle.net.ns.Packet.receive(Unknown Source)
          at oracle.net.ns.NetInputStream.getNextPacket(Unknown Source)
          at oracle.net.ns.NetInputStream.read(Unknown Source)
          at oracle.net.ns.NetInputStream.read(Unknown Source)
          at oracle.net.ns.NetInputStream.read(Unknown Source)
          at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:931)
          at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:893)
          at oracle.jdbc.ttc7.Oopen.receive(Oopen.java:105)
          at oracle.jdbc.ttc7.TTC7Protocol.open(TTC7Protocol.java:586)
          - locked <02FCA940> (a oracle.jdbc.ttc7.TTC7Protocol)
          at oracle.jdbc.driver.OracleStatement.(OracleStatement.java:385)
          at oracle.jdbc.driver.OracleConnection.privateCreateStatement(OracleConn
          ection.java:772)
          at oracle.jdbc.driver.OracleConnection.createStatement(OracleConnection.
          java:712)
          - locked <02FCA890> (a oracle.jdbc.driver.OracleConnection)
          at JdbcTest.main(JdbcTest.java:11)

          "VM Thread" prio=5 tid=0x009E5030 nid=0xde0 runnable

          "VM Periodic Task Thread" prio=10 tid=0x009E6E00 nid=0xdd0 waiting on condition

          "Suspend Checker Thread" prio=10 tid=0x009E7750 nid=0xdcc runnable