Hello,
All of a sudden mysql refuse my javaprogram to connect. It's a local connection on my tao-lunix-machine.
I have tried;
mysqladmin flush-hosts
and...
GRANT USAGE ON *.* TO 'myUser'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON groopidb.* TO 'myuser'@'localhost' WITH GRANT OPTION;
Any one who knows the cure?
You can se my simple test program below and it's output.
Thanks in advance,
Jan Gifvars,
--------------- error output from my javaprogram -----------
Starting ...
Object o

rg.gjt.mm.mysql.Driver@126b249
Caught SQLException when invoking DriverManager.getConnection()
SQLException: Data source rejected establishment of connection, message from server: "Host 'localhost.localdomain' is
not allowed to connect to this MySQL server"
SQLState: 08004
VendorError: 1130
java.sql.SQLException: Data source rejected establishment of connection, message from server: "Host 'localhost.locald
omain' is not allowed to connect to this MySQL server"
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:58 2)
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:1627)
at com.mysql.jdbc.Connection.<init>(Connection.java:4 27)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:395)
at java.sql.DriverManager.getConnection(DriverManager .java:512)
at java.sql.DriverManager.getConnection(DriverManager .java:193)
at groopi.test.SimpleDBTest.main(SimpleDBTest.java:42 )
Connection con:null
2Caught SQLException when invoking DriverManager.getConnection()
2SQLException: Data source rejected establishment of connection, message from server: "Host 'localhost.localdomain' i
s not allowed to connect to this MySQL server"
2SQLState: 08004
2VendorError: 1130
java.sql.SQLException: Data source rejected establishment of connection, message from server: "Host 'localhost.locald
omain' is not allowed to connect to this MySQL server"
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:58 2)
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:1627)
at com.mysql.jdbc.Connection.<init>(Connection.java:4 27)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:395)
at java.sql.DriverManager.getConnection(DriverManager .java:512)
at java.sql.DriverManager.getConnection(DriverManager .java:140)
at groopi.test.SimpleDBTest.main(SimpleDBTest.java:61 )
2Connection con:null
-------------------- Java program --------------------------------
public class SimpleDBTest {
public static void main (String[] args)
{
String database = "jdbc:mysql://localhost/groopidb";
String tUser = "?user=root&password=mypassword";
System.out.println("Starting ... ");
Object o = null;
Connection con = null;
try
{
o = Class.forName("org.gjt.mm.mysql.Driver").newInstan ce();
//o = Class.forName("com.mysql.Driver").newInstance();
}
catch (Exception e)
{
System.err.println("Unable to load driver.");
e.printStackTrace();
}
System.out.println("Object o:" + o);
try
{
con = DriverManager.getConnection(database + tUser);
}
catch (SQLException sqle)
{
System.out.println("Caught SQLException when invoking DriverManager.getConnection()");
System.out.println("SQLException: " + sqle.getMessage());
System.out.println("SQLState: " + sqle.getSQLState());
System.out.println("VendorError: " + sqle.getErrorCode());
sqle.printStackTrace();
}
System.out.println("Connection con:" + con);
try
{
Properties tProps;
tProps = new Properties();
tProps.put("user", "root");
tProps.put("password","p93fzKkr");
con = DriverManager.getConnection(database, tProps);
//con = DriverManager.getConnection(database );
}
catch (SQLException sqle)
{
System.out.println("2Caught SQLException when invoking DriverManager.getConnection()");
System.out.println("2SQLException: " + sqle.getMessage());
System.out.println("2SQLState: " + sqle.getSQLState());
System.out.println("2VendorError: " + sqle.getErrorCode());
sqle.printStackTrace();
}
System.out.println("2Connection con:" + con);
}
}