MySQL Access Denied to user???!#%!%#!
From: DeZZaN (dejandj7_at_yahoo.com)
Date: 01/29/04
- Next message: David Harper: "Re: MySQL Access Denied to user???!#%!%#!"
- Previous message: kevin: "good advice needed for web db project"
- Next in thread: David Harper: "Re: MySQL Access Denied to user???!#%!%#!"
- Reply: David Harper: "Re: MySQL Access Denied to user???!#%!%#!"
- Reply: nioTo: "Re: MySQL Access Denied to user???!#%!%#!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Jan 2004 10:35:01 -0800
Please help!!!
I have a problem when I try to connect to mysql server located on the
host
named zeus thru the jdbc: mysql-connector-java!!!
(what is even more weird is that I have no problems connecting and
doing
whatever I want thru mysql client using the connection string: mysql
-h zeus -u dgjorgjevik kompanija)??????
It keeps giving me this error message:
Connection string: jdbc:mysql://zeus:3306/kompanija&user=dgjorgjevik&password=
Error: 1044 -> S1000
Message: General error, message from server: "Access denied for user:
'@%' to database 'kompanija&user=dgjorgjevik&password='"
java.lang.NullPointerException
at DBPrebaruvanje.DBConnection.getResultset(DBConnection.java:76)
at DBPrebaruvanje.DBConnection.getResultset(DBConnection.java:84)
at switchboardApp.EmployeeForm.initComponents(EmployeeForm.java:53)
at switchboardApp.EmployeeForm.<init>(EmployeeForm.java:24)
at switchboardApp.SwitchboardApp.<init>(SwitchboardApp.java:42)
at switchboardApp.SwitchboardApp.main(SwitchboardApp.java:235)
And the code to produce this is:
conn = new DBConnection("kompanija", "dgjorgjevik", "",
DBConnection.MYSQL, "zeus");
//constructor for DBConnection class
public DBConnection(String DBN, String user, String pass, int
serverType, String host) {
String strClassName;
String strConnection;
DBName = DBN;
username = user;
password = pass;
if (serverType == ODBC) {
strClassName = "sun.jdbc.odbc.JdbcOdbcDriver";
strConnection = "jdbc:odbc:" + DBName;
} else if (serverType == MYSQL) {
strClassName = "com.mysql.jdbc.Driver";
strConnection = "jdbc:mysql://" + host + ":3306/" + DBName
+ "&user=" + user + "&password=" + pass;
} else {
strClassName = "";
strConnection = "";
}
try {
Class.forName(strClassName);
} catch (ClassNotFoundException e) {
System.out.println("Couldn't find class!");
e.printStackTrace();
}
try {
if (serverType == ODBC) {
conn = DriverManager.getConnection(strConnection,
username, password);
} else if (serverType == MYSQL) {
conn = DriverManager.getConnection(strConnection);
}
} catch (SQLException e) {
System.out.println("Connection string: " + strConnection);
System.out.println("Error: " + e.getErrorCode() + " -> " +
e.getSQLState());
System.out.println("Message: " + e.getMessage());
}
}
- Next message: David Harper: "Re: MySQL Access Denied to user???!#%!%#!"
- Previous message: kevin: "good advice needed for web db project"
- Next in thread: David Harper: "Re: MySQL Access Denied to user???!#%!%#!"
- Reply: David Harper: "Re: MySQL Access Denied to user???!#%!%#!"
- Reply: nioTo: "Re: MySQL Access Denied to user???!#%!%#!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|