Solved

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

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Trigger usage 2 75
update joined tables 2 55
configure dependency in POM for new database 3 34
Formating field inside mysql query 2 15
This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
Creating and Managing Databases with phpMyAdmin in cPanel.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 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