Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

JDBC, MySQL connection

Thread view: 
bb - 26 Oct 2005 03:12 GMT
Excuse me if I'm in the wrong users group for this question, but this
forum is the best around so I'm giving it a shot. I have a connection
statement to make a connection with a MySQL 3.1 database via JDBC that
follows:

con =
DriverManager.getConnection("jdbc:mysql://localhost/billblac_?user=billblac_bill&password=wgb");

The database name is billblac_ .
There is an existing connection named billblac_bill, host = localhost,
port = 3306, username = root, password = wgb1454. This connection
connects to the database correctly.

The error message I get when I try to connect via Java and the above
statement is:
java.sql.SQLException: Invalid authorization specification: Access
denied for user 'billblac_bill'@'localhost' <using password: YES>

I know there is a discrepancy between the Java connection string
statement and the existing connection named billblac_bill, but I can't
seem to get the exact settings correct.

Any help would be GREATLY appreciated!
sankar_battula@yahoo.co.in - 26 Oct 2005 06:09 GMT
Hi!
One thing you have to check is ,check the username and password of the
database from which you want to access the data.
put the same uname and pwd in the url of the connection statement.
or it will be easy ,if you use connection pooling .....if know it....

sivasankar.
regards...
Roedy Green - 26 Oct 2005 06:42 GMT
>Any help would be GREATLY appreciated!

Usually database will come with some sample code you can run with a
toy database.  
What does the DriverManager.getConnection
for that look like.

1. Usually there is some sort of utility for getting database
information without writing code..  See if you can get it to show you
any of the strings you fed it in the test DriverManager.getConnection.
Note how they are warped/mapped.

2. Call me superstitious. Don't use _ or space or any punctuation at
all in names, especially lead/trail ones.

3. make sure you have a localhost entry in your hosts file.
See http://mindprod.com/jgloss/hosts.html

4. google for DriverManager.getConnection MySQL and see if you can
fine examples of ssuccessful connection strings. That may give you a
hint.
For example, doing that, I found this peculiar looking thing:
//MYSQL4.1
     conn = java.sql.DriverManager.getConnection(
         "[url]jdbc:mysql://localhost:3333/test[/url]");
     test("MySQL4", conn);
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

TechBookReport - 26 Oct 2005 10:03 GMT
> Excuse me if I'm in the wrong users group for this question, but this
> forum is the best around so I'm giving it a shot. I have a connection
[quoted text clipped - 19 lines]
>
> Any help would be GREATLY appreciated!

Have you tried breaking out the username and password as separate
arguments? Take a look at the MySQL example in the Java Developers
Almanac (http://javaalmanac.com/egs/java.sql/ConnectMySql.html).

Pan
Signature

TechBookReport Java book reviews:
http://www.techbookreport.com/JavaIndex.html

jonck - 26 Oct 2005 11:34 GMT
> con =
> DriverManager.getConnection("jdbc:mysql://localhost/billblac_?user=billblac _bill&password=wgb");

Here you are using password=wgb

> The database name is billblac_ .
> There is an existing connection named billblac_bill, host = localhost,
> port = 3306, username = root, password = wgb1454.

And here you say the password is wgb1454. Naturally MySQL is going to
give you a security error, you are giving the wrong password in your
connection string.

Kind regards, Jonck


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.