Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mysql connectivity failure

 
trinity jecob
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to develop a small application using struts framework. For data base I am using MySQL-5.1.

Struts-config.xml contents are as follows -



But when I run the Login page & try to access the dabase, it is givig me the following error -



I am not getting y it is happening.

The code in Action class is as follows -



What could be the reason?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64972
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"ttt jjj", you have previously been warned on one or more occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it prior to your next post.

Be aware that accounts with invalid display names are removed.

bear
JavaRanch Sheriff
 
trinity jecob
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all I apologize for the prev. display name. I hope the updated one should not create a problem.

Thanks.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trinity,

Thanks for changing your name, but the JavaRanch naming policy indicates that you need both a first and a last name that are not initials and are not obviously fictitious.

Regarding your question: This error seems to indicate that your Mysql database server is not responding. Can you ping 10.175.100.175 from the system hosting your app server? Does the system with an IP address of 10.175.100.175 have an instance of Mysqld running on the default port of 3306?
 
trinity jecob
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks

The Ip address I have mentioned (10.175.100.175) is the ip of my machine only. I tried to give 'localhost' as well. I have not specifed the port number.

How can I confirm that on which port the MySql Instant is running??

Thanks in advance

 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless you've changed it in your config file (and you probably haven't), the default port number is 3306. Did you Start the MYSQL database listener on your computer by running the command mysqld from the c:/<mysql install dir>/bin directory?
 
trinity jecob
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i did that. Confirmed in the TaskManager a process 'mysqld-nt.exe' is running.

moreover after executing the following commands on command prompt, i got these results -



But still after running the application i am getting the exception as -

 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I no longer believe it's a problem with your Mysql server.

If you're using Tomcat, you may want to try changing your DataSource type to Tomcat's basic DataSource, as described in this article.

Quite frankly, I recommend that you don't use the Struts DataSource utility at all. The best practice is to define your DataSource using whatever method your application server recommends, and then to connect to that DataSource with a JNDI lookup. This way you can find the DataSource from any Java Class, and are not dependent on the Action class to find it.
 
trinity jecob
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not using Tomcat. I am using WSAD 5.1 to create the application and the default websphere server.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is an article explaining how to set up a Mysql data source in WebSphere
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic