Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-11-18
2
Medium Priority
?
369 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 2000 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

963 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