These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: oracle listener refuses connection after successful queries
PostPosted: Fri Feb 24, 2006 5:28 pm 
Beginner
Beginner

Joined: Sat Jan 29, 2005 8:49 pm
Posts: 20
My problem is that the query works fine for about 10 to 20 concurrent requests than the connection to the database is no longer available. Then the context has to be reloaded to make it work again.

I have tried using c3p0 and the hibernate connection pooling with about the same results. Playing with the max_size and min_size arguments of c3p0 changes the number of concurrent requests but eventually leads to the same error.

I am using the newest oracle jdbc driver (ojdbc14_g.jar)




Hibernate version:
3.0.5

Mapping documents:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.c3p0.max_size">20</property>
        <property name="hibernate.c3p0.max_statements">50</property>
        <property name="hibernate.c3p0.min_size">5</property>
        <property name="hibernate.c3p0.timeout">1800</property>
        <property name="hibernate.cglib.use_reflection_optimizer">true</property>

        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="hibernate.connection.password">********</property>
        <property name="hibernate.connection.url">jdbc:oracle:thin:@ora1host:1561:ora1</property>
        <property name="hibernate.connection.username">seminardb</property>
        <property name="hibernate.default_schema">SEMINARDB</property>
        <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
    </session-factory>
</hibernate-configuration>


Code between sessionFactory.openSession() and session.close():
Code:
            List list = session.createQuery(
                  "select s.id as id, s.seminartyp.name as name, min(t.datum) as beginn, max(t.datum) as ende\n" +
               "from Seminar s join s.seminartage t\n" +
               "where year(t.datum) = 2006\n" +
               "group by s.id, s.seminartyp.name\n" +
               "having (month(min(t.datum)) = 3\n" +
               "or month(max(t.datum)) = 3)\n" +
               "order by min(t.datum)"
                  ).list();


Full stack trace of any exception that occurs:
Code:
INFO: Server startup in 1432 ms
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@65b738
  [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@1d840cd
    [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false,
      automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0,
      connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null,
      forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 0, initialPoolSize -> 5,
      maxIdleTime -> 1800, maxPoolSize -> 10, maxStatements -> 0, maxStatementsPerConnection -> 0,
      minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@1a7f9dc
      [ description -> null, driverClass -> null, factoryClassLocation -> null,
        jdbcUrl -> jdbc:oracle:thin:@ora1host:1561:ora1, properties -> {user=******, password=******}
      ] , preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false,
      testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false
    ] , factoryClassLocation -> null, numHelperThreads -> 3, poolOwnerIdentityToken -> 65b738
  ]
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@a2a38 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@13c2d7f ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@b2fb1e ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@b8d09d ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@bdb375 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@6b51d8 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1352447 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@f77511 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@f5b2e4 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@162f030 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@ce796 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@15738e0 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@12022b7 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@17aa2a8 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1ad6c98 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1bb205a ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1cb374f ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1f4cf6f ...
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12500, TNS:listener failed to start a dedicated server process
The Connection descriptor used by the client was:
ora1host:1561:ora1

   at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:158)
   at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:399)
   at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:342)
   at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:375)
   at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:151)
   at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
   at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:590)
   at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:68)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:87)
   at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3P0PooledConnectionPool.java:83)
   at com.mchange.v2.resourcepool.BasicResourcePool.assimilateResource(BasicResourcePool.java:884)
   at com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResourcePool.java:601)
   at com.mchange.v2.resourcepool.BasicResourcePool.access$400(BasicResourcePool.java:31)
   at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1079)
   at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:354)


Name and version of the database you are using:
ORACLE 10g


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 6:58 pm 
Expert
Expert

Joined: Mon Jan 09, 2006 5:01 pm
Posts: 311
Location: Sacramento, CA
not sure if this will help, but this happened to me as well, and I couldn't figure out why...and I feel that I am rather skilled with Oracle networking. I ended up having to use OCI and connect via bequeath (local connection). I know that OCI works remotely too, but in my case the db and hibernate were on the same machine. With OCI, you'll need to get all the client libs available to the PATH and CLASSPATH, and I believe LD_LIBRARY_PATH...

_________________
-JT

If you find my replies helpful, please rate by clicking 'Y' on them. I appreciate it.


Last edited by jt_1000 on Mon Feb 27, 2006 2:28 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: max connections seems to be ignored
PostPosted: Mon Feb 27, 2006 1:30 pm 
Beginner
Beginner

Joined: Sat Jan 29, 2005 8:49 pm
Posts: 20
when i checked the connections using tcpview i found out that hibernate created with each request 5 new connections.

this is fine for the first request (min connections=5)
it is fine for the second request (max conenctions=10)
but then the c3p0 should really start using the existing connections

instead another 5 connections are created

eventually the limit of about 100 connections to the server is exceeded leading to the observed error message

but why does c3p0 create new connections all the time and does not reuse existing connections (the ultimate purpose for a connection pool)?


Top
 Profile  
 
 Post subject: using jndi it works just fine
PostPosted: Mon Feb 27, 2006 5:06 pm 
Beginner
Beginner

Joined: Sat Jan 29, 2005 8:49 pm
Posts: 20
i configured jndi on tomcat (which isn't without pitfalls) and made it work.
now only 8 connections (default) are open.
the c3p0 pool i removed

come to think that actually i doesn't make much sense using a connection pool in the application if you don't use an application server ;-)

so the only way to use connection pooling with tomcat is to use a jndi configuration in tomcat. right? (you have to use either tomcat + spring or a real application server)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.