I have a JAVA application using a MySQL database. It worked as long as it was local.
When I try to use it on the network, I got errors.
(I have read the MySQL documentation several times but it just doesn't say anything useful.
Also, it seems oriented to a DB Administrator and not to programmers who have to use the db.
I have also looked at several forums but no match.)
Any help would be appreciated.
============
I installed MySQL and set it up with WinSQLAdmin for a Win 2000 Professional server.
I installed the MySQL Connection/J on the same server.
The JAVA application works fine with "localhost" usage on the server.
However, I have to implement the application on 6 or so PC's located on the network
and the Win2000 server will indeed be just a server.
So I installed MySQL and Connection/J on one of those PC's. Then I went into the
WinMySQLAdmin controls on that PC and changed the data folder from /mysql/data to
//Ihaserver/mysql/data. I changed the calling program to use the server data name.
The program appears to be trying to connect to the server across the network (it hesitated
for a few seconds where it was instantaneous connect before.
Then I get the error message: java.sql.SQLException: General error, message from server:
"Access denied for user: '@%' to database 'rescforsrs' "
I have set no passwords or users to the DB (that I know of).
I have tried some of the security things the documentation suggests, such as SHOW GRANTS.
I get an error message that there is no such command, even though I signed on as "root".
Help?
=============
//
// Define strings
//
private String SQLDBName;
private String SQLDBClass;
//
// Set data for connection
//
SQLDBClass = "org.gjt.mm.mysql.Driver";
SQLDBName = "jdbc:mysql://Ihaserver/RescForSrs";
NOTE - if "jdbc:mysql://localhost/rescforsrs" is used,
the program works OK.
//
// Perform connections
//
try {
Class.forName(SQLDBClass).newInstance();
}
catch (Exception e)
{
error display
}
try {
UserConn = DriverManager.getConnection(SQLDBName); <<<<<< This line causes the error
UserRead = UserConn.createStatement();
}
catch (Exception e)
{
error display
}