Solved

Access denied when trying to access MySql through connector J and Servlet

Posted on 2006-11-18
2
350 Views
Last Modified: 2009-12-16
I am trying to connect to MySQL (most current version) db through a java servlet.
The error message I get is this: Error: java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)

The setup-driver string I am using is this:
com.mysql.jdbc.Driver
jdbc:mysql://localhost:3306/iap_local?user=root&password=belcanto

The servlet runs under Tomcat (5), and the driver file is installed in the Tomcat directory under the shared/lib folder.

These settings work (allow access) when using MySQL from the command line, but also work using Navicat (GUI for M ySQL).  

The intended use is for an expert system (Exsys Corvid) to be able to access the database on my local machine.  We have it working fine on a remote  internet hosting machine, but cannot get it working locally.  
I know just enough about java etc to be dangerous!

Neill Carson
Houston
0
Comment
Question by:nmcas
2 Comments
 
LVL 30

Accepted Solution

by:
todd_farmer earned 500 total points
ID: 17972799
The error you are getting suggests that it is not connecting as the "root" user.  Either your Java code is trying to connect using a different connection string than the one you've posted here, or the user name and password aren't correct.  Given that you can connect using the command line with this user name and password, it seems likely that the former is true.  Perhaps you can provide some of the relevent Java code for us to look at?
0
 

Author Comment

by:nmcas
ID: 17975965
Todd,

Thank you for your answer.  I think I have ascertained that my vendors servlet was incompatible with the newer version of MySQL I loaded to run the app locally.  When I used their "old" driver (the org:gjt.mm etc...) the querry worked OK.  I will now nag them to update their system to run with the new MYSQL!

But your answer (the connection string) was right on track...

Thanks.   Hope you enjoy the points, what ever you can do with them.  
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now