File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes mysql connectivity failure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "mysql connectivity failure" Watch "mysql connectivity failure" New topic
Author

mysql connectivity failure

trinity jecob
Greenhorn

Joined: Sep 13, 2006
Posts: 14
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

Joined: Jan 10, 2002
Posts: 61764
    
  67

"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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
trinity jecob
Greenhorn

Joined: Sep 13, 2006
Posts: 14
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

Joined: Feb 15, 2005
Posts: 4864
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?


Merrill
Consultant, Sima Solutions
trinity jecob
Greenhorn

Joined: Sep 13, 2006
Posts: 14
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

Joined: Feb 15, 2005
Posts: 4864
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

Joined: Sep 13, 2006
Posts: 14
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

Joined: Feb 15, 2005
Posts: 4864
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

Joined: Sep 13, 2006
Posts: 14
I am not using Tomcat. I am using WSAD 5.1 to create the application and the default websphere server.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Here is an article explaining how to set up a Mysql data source in WebSphere
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: mysql connectivity failure