File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes java.sql.SQLException: Server configuration denies access to data source Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.sql.SQLException: Server configuration denies access to data source" Watch "java.sql.SQLException: Server configuration denies access to data source" New topic
Author

java.sql.SQLException: Server configuration denies access to data source

W Sun
Greenhorn

Joined: Apr 24, 2003
Posts: 6
I wrote the following class DBManager to access the mySQL DB server from java programs.

And use it in the following way:

Is there any problem in this approach?
Will the connection created in getQueryResultSet() closed automatically after I call this method?
There seems to be a limit on the number of available connections. As my program query the DB using the above approach continously, I am concerned whether the available connections would be exhausted. I started my program this afternoon and went out for a hour or so, when I came back, I found the following error message:

What could be the reason of this error?
To see whether it's the problem of connections, I wrote the following code to test it,

And it didn't generate any error so far: the count is already 68000!
I am confused. Anybody can help me?
Thanks.
[ January 14, 2004: Message edited by: W Sun ]
[ January 14, 2004: Message edited by: W Sun ]
Jason Steele
Ranch Hand

Joined: Apr 25, 2003
Posts: 100
I would be interested to know what's the deal also.
I haven't had that problem.
What is you system config?
I would pre-pend each of you sql exceptions with specific word to capture where exactly the error occured. The SQLException error messages(some) are a bit vague.
Example System.out.println("SELECT Error: " + sqle);
Example System.out.println("CONNECT Error: " + sqle);
Why are you leaving all those connections open anyway?


An egg is a chicken's house!
W Sun
Greenhorn

Joined: Apr 24, 2003
Posts: 6
Thanks Jason.
I was trying to use a piece of simple code to get query result from the DB, and WISH the connection created by calling
resultSet = new DBManager().statement.executeQuery(querySQL);
is temporary and would be closed automatically when the call is finished. But if I rewrite the method getQueryResultSet like the following, the returned result set is not accessible because the connection is closed.(believe it, I tried it.)

I guess the right way to do this is:
Jason Steele
Ranch Hand

Joined: Apr 25, 2003
Posts: 100
in this piece:

line 5 should have been:
resultSet = dbManager.statement.executeQuery(querySQL);
I haven't tried it, but I think that's why the connection was closed
I would like to share my wrapper with you:
Note: It's not completed, but it works

I call it like this:

This sets up a persistent connection that will last the life of the app.
Further, if you want to switch databases or users, you can do that with the setter methods and then call renewConnection()
You can add/change/delete how you see fit if you want to...It's young is intended that at completion, it will support most DB Servers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.sql.SQLException: Server configuration denies access to data source
 
Similar Threads
Null error
Struts:DB Connection with Oracle
Resource usage
prepareStatement problem with the driver classes12.zip
How to manage the connections in a pool