hello everybody,
iam using like this
import java.sql.*;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.net.*;
public class Jdbc1 {
public static void main(String args[]) {
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://remoteip/test","root ", "secret");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from sample");
while(rs.next())
{
System.out.println("Name " + rs.getString(1));
System.out.println("Id " + rs.getString(2));
}
} catch(Exception e) {
e.printStackTrace();
System.out.println("Exception: " + e.getMessage());
} finally {
try {
if(con != null)
con.close();
} catch(SQLException e) {}
}
}
}
here iam getting this type of exception
java.sql.SQLException: Data source rejected establishment of connection, messag
e from server: "Host 'RAMESH' is not allowed to connect to this MySQL server"
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:639)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1774)
at com.mysql.jdbc.Connection.<init>(Connection.java:440)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:400)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at Jdbc1.main(Jdbc1.java:17)
Exception: Data source rejected establishment of connection, message from serve
r: "Host 'RAMESH' is not allowed to connect to this MySQL server"
please help me
regards
Ramesh