You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mufaddal Khumri <mu...@wmotion.com> on 2003/05/13 07:57:05 UTC

Connection Problem...

I have developed a ConnectionPoolManager. Am using mysql 3.0.6 driver.  
I have a servlet that calls a bean class ConnectionPoolManager that  
creates my connection pool. The ConnectionPoolManager creates  
connection pools to various mysql databases. In order to do this the  
ConnectionPoolManager connects to a system_startup mysql database and  
reads the parameters from the table and accordingly creates  
ConnectionPools for each row.
When the user first comes to my site... i check to see if i have an  
instance of ConnectionPoolManager stored in my application session. If  
yes then i use that instance otherwise i create a new one.
All this works fine. but sometimes i get the following exception. This  
happens approximately every 5 times i reload my servlet using tomcat.  
After i reload my servlet the 5th time and i try logging in .. it gives  
the following error.

java.sql.SQLException: Server configuration denies access to data source
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:392)
	at com.mysql.jdbc.Connection.createNewIO(Connection.java:1511)
	at com.mysql.jdbc.Connection.<init>(Connection.java:485)
	at com.mysql.jdbc.Driver.connect(Driver.java:341)
	at java.sql.DriverManager.getConnection(DriverManager.java:512)
	at java.sql.DriverManager.getConnection(DriverManager.java:193)
	at  
com.wavesinmotion.cw.classes.db.ConnectionPoolManager.<init>(ConnectionP 
oolManager.java:34)

Code from ConnectionPoolManager:

		try
		{
	            Class.forName("com.mysql.jdbc.Driver");
	            con =  
DriverManager.getConnection("jdbc:mysql://localhost/ 
cwdb_system?user=root");
	            recreateConnectionPools(getSystemTable());
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}

This is the line it dies (ConnectionPoolManager.java:34):
		con =  
DriverManager.getConnection("jdbc:mysql://localhost/ 
cwdb_system?user=root");

Do you know why this is happening ?

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Connection Problem...

Posted by Mufaddal Khumri <mu...@wmotion.com>.
I want to understand the problem. I know i can use a connection pool  
that already exists. I want to know why the exception is being thrown.

Does anybody know why ?

On Wednesday, May 14, 2003, at 12:20  AM, Dan Tran wrote:

> Why are you creating your own connection pool?
> I went thru this b4 and it was a pain.
>
> -Dan
>
> ----- Original Message -----
> From: "Mufaddal Khumri" <mu...@wmotion.com>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Monday, May 12, 2003 10:57 PM
> Subject: Connection Problem...
>
>
>> I have developed a ConnectionPoolManager. Am using mysql 3.0.6 driver.
>> I have a servlet that calls a bean class ConnectionPoolManager that
>> creates my connection pool. The ConnectionPoolManager creates
>> connection pools to various mysql databases. In order to do this the
>> ConnectionPoolManager connects to a system_startup mysql database and
>> reads the parameters from the table and accordingly creates
>> ConnectionPools for each row.
>> When the user first comes to my site... i check to see if i have an
>> instance of ConnectionPoolManager stored in my application session. If
>> yes then i use that instance otherwise i create a new one.
>> All this works fine. but sometimes i get the following exception. This
>> happens approximately every 5 times i reload my servlet using tomcat.
>> After i reload my servlet the 5th time and i try logging in .. it  
>> gives
>> the following error.
>>
>> java.sql.SQLException: Server configuration denies access to data  
>> source
>> at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:392)
>> at com.mysql.jdbc.Connection.createNewIO(Connection.java:1511)
>> at com.mysql.jdbc.Connection.<init>(Connection.java:485)
>> at com.mysql.jdbc.Driver.connect(Driver.java:341)
>> at java.sql.DriverManager.getConnection(DriverManager.java:512)
>> at java.sql.DriverManager.getConnection(DriverManager.java:193)
>> at
>> com.wavesinmotion.cw.classes.db.ConnectionPoolManager.<init>(Connectio 
>> nP
>> oolManager.java:34)
>>
>> Code from ConnectionPoolManager:
>>
>> try
>> {
>>             Class.forName("com.mysql.jdbc.Driver");
>>             con =
>> DriverManager.getConnection("jdbc:mysql://localhost/
>> cwdb_system?user=root");
>>             recreateConnectionPools(getSystemTable());
>> }
>> catch(Exception ex)
>> {
>> ex.printStackTrace();
>> }
>>
>> This is the line it dies (ConnectionPoolManager.java:34):
>> con =
>> DriverManager.getConnection("jdbc:mysql://localhost/
>> cwdb_system?user=root");
>>
>> Do you know why this is happening ?
>>
>> Thanks.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Connection Problem...

Posted by Dan Tran <da...@hotmail.com>.
Why are you creating your own connection pool? 
I went thru this b4 and it was a pain. 

-Dan

----- Original Message ----- 
From: "Mufaddal Khumri" <mu...@wmotion.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, May 12, 2003 10:57 PM
Subject: Connection Problem...


> I have developed a ConnectionPoolManager. Am using mysql 3.0.6 driver.  
> I have a servlet that calls a bean class ConnectionPoolManager that  
> creates my connection pool. The ConnectionPoolManager creates  
> connection pools to various mysql databases. In order to do this the  
> ConnectionPoolManager connects to a system_startup mysql database and  
> reads the parameters from the table and accordingly creates  
> ConnectionPools for each row.
> When the user first comes to my site... i check to see if i have an  
> instance of ConnectionPoolManager stored in my application session. If  
> yes then i use that instance otherwise i create a new one.
> All this works fine. but sometimes i get the following exception. This  
> happens approximately every 5 times i reload my servlet using tomcat.  
> After i reload my servlet the 5th time and i try logging in .. it gives  
> the following error.
> 
> java.sql.SQLException: Server configuration denies access to data source
> at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:392)
> at com.mysql.jdbc.Connection.createNewIO(Connection.java:1511)
> at com.mysql.jdbc.Connection.<init>(Connection.java:485)
> at com.mysql.jdbc.Driver.connect(Driver.java:341)
> at java.sql.DriverManager.getConnection(DriverManager.java:512)
> at java.sql.DriverManager.getConnection(DriverManager.java:193)
> at  
> com.wavesinmotion.cw.classes.db.ConnectionPoolManager.<init>(ConnectionP 
> oolManager.java:34)
> 
> Code from ConnectionPoolManager:
> 
> try
> {
>             Class.forName("com.mysql.jdbc.Driver");
>             con =  
> DriverManager.getConnection("jdbc:mysql://localhost/ 
> cwdb_system?user=root");
>             recreateConnectionPools(getSystemTable());
> }
> catch(Exception ex)
> {
> ex.printStackTrace();
> }
> 
> This is the line it dies (ConnectionPoolManager.java:34):
> con =  
> DriverManager.getConnection("jdbc:mysql://localhost/ 
> cwdb_system?user=root");
> 
> Do you know why this is happening ?
> 
> Thanks.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Connection Problem...

Posted by mike jackson <mj...@cdi-hq.com>.
It's check the jdbc url and if that's 100% correct then it's probably
something on the MySQL database side. 

However that said, I'd not re-invent the wheel here, there already
connection pooling systems out there.  Haven't rolled my own I can
safely
say that it's a whole lot less headache to use one that's already
developed and tested.  Just make sure it has the features you need and
that people 
who use it are happy with it.

--mikej
-=------
mike jackson
mjackson@cdi-hq.com

> -----Original Message-----
> From: Mufaddal Khumri [mailto:mufaddal@wmotion.com]
> Sent: Monday, May 12, 2003 9:57 PM
> To: Tomcat Users List
> Subject: Connection Problem...
> 
> I have developed a ConnectionPoolManager. Am using mysql 3.0.6 driver.
> I have a servlet that calls a bean class ConnectionPoolManager that
> creates my connection pool. The ConnectionPoolManager creates
> connection pools to various mysql databases. In order to do this the
> ConnectionPoolManager connects to a system_startup mysql database and
> reads the parameters from the table and accordingly creates
> ConnectionPools for each row.
> When the user first comes to my site... i check to see if i have an
> instance of ConnectionPoolManager stored in my application session. If
> yes then i use that instance otherwise i create a new one.
> All this works fine. but sometimes i get the following exception. This
> happens approximately every 5 times i reload my servlet using tomcat.
> After i reload my servlet the 5th time and i try logging in .. it
gives
> the following error.
> 
> java.sql.SQLException: Server configuration denies access to data
source
> 	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:392)
> 	at com.mysql.jdbc.Connection.createNewIO(Connection.java:1511)
> 	at com.mysql.jdbc.Connection.<init>(Connection.java:485)
> 	at com.mysql.jdbc.Driver.connect(Driver.java:341)
> 	at java.sql.DriverManager.getConnection(DriverManager.java:512)
> 	at java.sql.DriverManager.getConnection(DriverManager.java:193)
> 	at
>
com.wavesinmotion.cw.classes.db.ConnectionPoolManager.<init>(ConnectionP
> oolManager.java:34)
> 
> Code from ConnectionPoolManager:
> 
> 		try
> 		{
> 	            Class.forName("com.mysql.jdbc.Driver");
> 	            con =
> DriverManager.getConnection("jdbc:mysql://localhost/
> cwdb_system?user=root");
> 	            recreateConnectionPools(getSystemTable());
> 		}
> 		catch(Exception ex)
> 		{
> 			ex.printStackTrace();
> 		}
> 
> This is the line it dies (ConnectionPoolManager.java:34):
> 		con =
> DriverManager.getConnection("jdbc:mysql://localhost/
> cwdb_system?user=root");
> 
> Do you know why this is happening ?
> 
> Thanks.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org