MySQL Access Denied to user???!#%!%#!

From: DeZZaN (dejandj7_at_yahoo.com)
Date: 01/29/04


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());
        }
    }



Relevant Pages

  • RE: MySQL/PHPMyAdmin on FC3 Connection Problem
    ... // You can disable a server config entry by setting host to ''. ... MySQL server ... MySQL control user settings ... table to describe the display fields ...
    (Fedora)
  • SQL Connection Problem
    ... An error has occurred while establishing a connection to the server. ... database location within the applications App_Data directory. ... Boolean& failoverDemandDone, String host, String failoverPartner, String ... user, String password, Boolean trusted, String connectionString) +68 ...
    (microsoft.public.dotnet.framework.aspnet)
  • server-side JavaScript: Prototypes of built-in classes, objects and functins
    ... Session object (disk-based session variables for data persistence ... File class (manipulation of files on server, ie. open, close, read, ... //Methods Cgi.queryCgi.postCgi.anyby default return an empty string if requested var not found ...
    (comp.lang.javascript)
  • Re: App_data - ASPNETDB.MDF
    ... is only because I want my site work, without exception. ... Server Error in '/' Application. ... serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: SSP backup
    ... 2)MOSS_SETUP_FARM is a dbo on the config database. ... Application Server Administration job failed for service instance ... name, ApplicationPoolIdentityType identityType, String userName, SecureString ... password, TimeSpan idleTimeout, TimeSpan periodicRestartTime) at ...
    (microsoft.public.sharepoint.windowsservices)