Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

JDBC Connection Problem

瀏覽次數:1 次
跳到第一則未讀訊息

M. Sihra

未讀,
2003年8月17日 上午11:05:452003/8/17
收件者:
Hi,

I am trying to connect MySQL server with JDBC. I am using JVM 1.4. When I
run my programm I am getting following exception:
java.sql.SQLException: Invalid authorization specification: Access denied
for us
er: 'user@host' (Using password: YES)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:659)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1562)
at com.mysql.jdbc.Connection.<init>(Connection.java:491)
at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:346)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at test.main(test.java:14)


I am using a valid user name and password to connect to the server. But I
was able to connect to the database with same programm with JVM 1.3.

What I have to do to connect to the database without above exception?? Any
idea or hint????

Thankx in advance.

Manmohan

Giuseppe Briotti

未讀,
2003年8月17日 中午12:51:132003/8/17
收件者:

M. Sihra <si...@web.de> wrote in message
oPM%a.1355$Ki3....@news20.bellglobal.com...

> Hi,
>
> I am trying to connect MySQL server with JDBC. I am using JVM 1.4. When I
> run my programm I am getting following exception:
(...)

> I am using a valid user name and password to connect to the server. But I
> was able to connect to the database with same programm with JVM 1.3.
>

Assuming that nothing have been changed in your program code, I don't know
if this is the problem, but the bytecode is different from JVM 1.4 and
1.3...

What happens if you compile with -target option?

G

Tobias Sprute

未讀,
2003年8月20日 下午4:39:492003/8/20
收件者:
afaik it can't be the bytecode as old classes run on newer jvm just fine.

my guess is: you've got the wrong driver.
i use the one from mysql.com you can get it at
http://www.mysql.com/downloads/api-jdbc-stable.html
put the jar into your classpath and register it via

DriverManager.registerDriver(new org.gjt.mm.mysql.Driver());

you may then get a connection with

DriverManager.getConnection(url,user,pass);

this works fine here.

just for the case: did you try to login with any different client?
perhaps it's a configuration thing ...


hth,

tobi


K Yang

未讀,
2003年8月26日 下午4:41:272003/8/26
收件者:
I need to connect MySQL4.0 in localhost with JDBC - mysqlconnector3.0.8 in
JDK1.4.2.

The problem is I can only connect to dabase using the root of mysql. None of
the other users will fail.

Any one can help me?

jc

未讀,
2003年8月27日 清晨7:04:382003/8/27
收件者:
Do the other users have the correct permissions to access the database/table?

The GRANT statement can be used to do this.

martino

未讀,
2003年9月15日 下午1:51:452003/9/15
收件者:

Hello,

I have got a similar problem.

First I was using the driver mysql-connector-3.02-beta.

I got a similar authorization failure (password wrong). But the first
three letters of the user had been cut (using 'martin' as the user, the
system notified 'tin'). When I worked with a blank password the system
stopped without any answer.

Now I downloaded the driver mysql-connector-3.08-stable.

Now I got a totally different failure.

The system reponded:

Java.ioException: Unexpected end of input-stream

Is anybody able to help me?

Thanks a lot

Martin


--
Posted via http://dbforums.com

martino

未讀,
2003年9月15日 下午2:28:552003/9/15
收件者:

I have solved the problem now. Just by reading the manual of the
J/Connector (Version 3.0.8).

I loaded the driver by

Class.forName("com.mysql.jdbc.Driver").newInstance();

Before I loaded the driver com.mysql.jdbc.Driver by a property opject.

I built the connection by

Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/-
test?user=monty&password=greatsqldb");

Before I built the connection by

connection conn = DriverManager.getConnection(url,dbuser,dbpwd)

There must be a difference in the driver versions, but I am too tired
now to check the differences. I am just happy my system is working.

Greetings from munich (Octoberfest is coming up now!)

0 則新訊息