Solved

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

Posted on 2006-11-18
2
345 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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 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

10 Experts available now in Live!

Get 1:1 Help Now