If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Data source rejected establishment of connection

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-19-04, 12:36
gifvars gifvars is offline
Registered User
 
Join Date: Mar 2003
Location: Stockholm
Posts: 3
Data source rejected establishment of connection

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 org.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);

}

}
Reply With Quote
  #2 (permalink)  
Old 09-10-04, 22:29
jeichels jeichels is offline
Registered User
 
Join Date: Sep 2004
Posts: 1
Did you ever receive a solution to this?

I have the same problem. Did you ever get an answer to this?
Reply With Quote
  #3 (permalink)  
Old 09-11-04, 04:11
gifvars gifvars is offline
Registered User
 
Join Date: Mar 2003
Location: Stockholm
Posts: 3
Hello Jeichels,

Yes change localhost in the url to the name on your computer. Perhaps it also works with the IP-address.

Good luck,

-JG
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On