[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-java
Subject:    =?iso-8859-1?B?u9i4tDogSmF2YSAmIFNRTCBjb25uZWN0aW9uIHByb2JsZW0=?=
From:       "=?iso-8859-1?B?sswg0+4=?=" <caiy () glnpu ! com>
Date:       2000-05-22 4:28:06
[Download RAW message or body]


-----Original Message-----
·¢¼þÈË: Alfie Lee <alfielee@acay.com.au>
ÊÕ¼þÈË: Java & MySQL <java@lists.mysql.com>
ÈÕÆÚ: 2000Äê5Ô 22ÈÕ 11:37
Ö÷Ìâ: Java & SQL connection problem


I am running MySQL on a Linux machine that is Samba'd to a Windows 98
notebook. My problem is that I am getting an error:
SQLException: Invalid authorization specification: Access denied for
user: 'alfie@' (Using password: NO)
SQLState: 28000
VendorError: 1045

The program is fairly basic, it's just a trial connection and uses the
basic program structure created on the link from MySQL for Java.


import java.sql.*;

// Notice, do not import org.gjt.mm.mysql.*

// or you will have problems!

public class LoadDriver {

public static void main(String[] Args) {

try {

// The newInstance() call is a work around for some

// broken Java implementations

Class.forName("org.gjt.mm.mysql.Driver").newInstance();

System.out.println("MySQL driver loaded.");

}

catch (Exception E) {

System.err.println("Unable to load driver.");

E.printStackTrace();

}

try {

Connection Conn = DriverManager.getConnection(


"jdbc:mysql://192.168.1.2:3306/odle?user=alfie=password");

// Do something with the Connection

System.out.print("Got here");

Statement Stmt = Conn.createStatement();

ResultSet RS = Stmt.executeQuery("SELECT * FROM
people");



while (RS.next()) {

System.out.println(RS.getString(1));

}



// Clean up after ourselves

RS.close();

Stmt.close();

Conn.close();

} catch (SQLException E) {

System.out.println("SQLException: " +
E.getMessage());

System.out.println("SQLState: " +
E.getSQLState());

System.out.println("VendorError: " +
E.getErrorCode());

}

}

}

The database exists and I'm fairly sure the privieges granted are okay
as they are wilded to the domain.
Any ideas?


Regards Alfie



--
BMR


"jdbc:mysql://192.168.1.2:3306/odle?user=alfie=password"

had been pointed that is not correct;
you can use:
"jdbc:mysql://192.168.1.2:3306/odle?user=alfie&password=********"

or

String url="jdbc:mysql://192.168.1.2:3306/odle";
.....................
.....................

Connection Conn = DriverManager.getConnection(url,user,password);

try it !

caiyu



---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail java-thread1156@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail java-unsubscribe@lists.mysql.com instead.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic