-->
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.  [ 6 posts ] 
Author Message
 Post subject: SQLException:Server configuration denies access to data sour
PostPosted: Fri Aug 12, 2005 1:29 am 
Beginner
Beginner

Joined: Mon Jul 25, 2005 12:35 am
Posts: 24
Location: Sri Lanka
Hi,

I have wrote an application which uses Hiernate for database access. That application has functionalities such as adding, deleting, modifying different types of services, users, operators etc... All the functionalities running correctly for some time and suddenly it will throw following exceptions... (This will occur running the application some times and in different situations..)

Data base type: MySQL 4.0.12
Operating System : Linux 9
Database Connection pooler : Tried both

(1) Default connection pooler with pooler size 2 (i.e hibernate.connection.pool_size 2)

(2) C3P0 Connection Pool
hibernate.c3p0.max_size 2
hibernate.c3p0.min_size 2
hibernate.c3p0.timeout 5000
hibernate.c3p0.max_statements 100
hibernate.c3p0.idle_test_period 3000
hibernate.c3p0.acquire_increment 2
hibernate.c3p0.validate false


In the first case (1) I got following exceptions...

org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:301)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:110)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:137)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:49)
at org.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:24)
....................................................
.........................................................

Caused by: java.sql.SQLException: Server configuration denies access to data source
at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java)
at org.gjt.mm.mysql.Connection.connectionInit(Connection.java)
at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89)
at org.gjt.mm.mysql.Driver.connect(Driver.java)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:298)
....................
........................

In the second case (2) I got following exceptions...

java.sql.SQLException: Server configuration denies access to data source
at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java)
at org.gjt.mm.mysql.Connection.connectionInit(Connection.java)
at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89)
at org.gjt.mm.mysql.Driver.connect(Driver.java)
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)

......................
...........................


I tried by changing pooler sizes, but not invain...

Please can somebody tell me how to solve this problem....

I really appreciate your any help.

Thank you.
Thilina.[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 2:18 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
Try to connect to your database with a db tool like dbvisualizer or with a simple program to see if you can access to your database. Maybe your database server is down or something like that

_________________
Seb
(Please don't forget to give credits if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 2:31 am 
Beginner
Beginner

Joined: Mon Jul 25, 2005 12:35 am
Posts: 24
Location: Sri Lanka
HI,
I'm Using the MySQLCC Console manager and Db Visualizer to see the database tables. It shows database tables and data without any problem. Also the database server is up and running successfully. May be any other problem!!!

Any solution for this will be appreciated.

Note: 1) If I call openSession, then what actually happens? Is it create a connectin to database?

2) If I did not close the session at the end of the transaction, then what will happen? Is the connection remains there or is it automatically distroyed?


Thank you.
Thilina.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 2:54 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
Connexion should be obtained by your session when you first try to access the db
You MUST close your session when you have finished with them.

See http://www.hibernate.org/hib_docs/v3/re ... on-logging

to see how to activate valuable logs to see what happens

_________________
Seb
(Please don't forget to give credits if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 11:56 pm 
Beginner
Beginner

Joined: Mon Jul 25, 2005 12:35 am
Posts: 24
Location: Sri Lanka
Hi,
I have check my all the source codes, and closes all the sessions that I Open for database manupulations. Also MySQL database server is up and running without any problem.

When I chaeck the number of mysql processes running , It will show 113 procesess.
(i.e. ps -ef | grep mysql results 113 procesess ) This is because of my applicaion and only my alpplication accessing MySQL database.

I'm really appreciate for any help.

Thank you.
Thilina.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 15, 2005 1:13 am 
Beginner
Beginner

Joined: Mon Jul 25, 2005 12:35 am
Posts: 24
Location: Sri Lanka
Hi
Addition to my previous ques;

After restating the Tomcat server, the number of processes reduced from 113 to 13.

Note: My app running in Tomcat 4.1.24

Thank you.
Thilina.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.