Solved

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

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

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…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

786 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