follow these steps
1) I comment the bind-address into c:\winnt\my.ini
#bind-address = 127.0.0.1
2) msql> grant all on * to root identified by '12345678';
> Date: Fri, 10 Apr 2009 23:50:48 -0700
> Subject: [java ee programming] Remotely access of MYSQL server
> From: [email protected]
> To: [email protected]
> CC: [email protected]
>
>
> Hi
>
> Dear Sang and All members
>
> I have problem to connect MySQL server from another client computer
> through an IP address of server computer. Example of JDBC is given
> below . it execute only mysql server with localhost
>
>
> *************************************************************************************
> import java.sql.Connection;
> import java.sql.DriverManager;
> import java.sql.SQLException;
> import java.sql.Statement;
> import java.sql.ResultSet;
>
> public class insertmysql
> {
> public static void main(String[] args)
> {
>
> Statement stmt = null;
> ResultSet rs = null;
> String sqlstmt1;
>
> String cname="HONDA";
> String cmodel="CIVIC";
> String ccolor="BLACK";
> String ctype="LUXRY";
> String cweight="200KG";
>
>
> try
> {
>
> Class.forName("com.mysql.jdbc.Driver").newInstance();
>
> //Connection conn = DriverManager.getConnection("jdbc:mysql://
> localhost/payroll?user=root&password=12345678");
>
> Connection conn = DriverManager.getConnection("jdbc:mysql://
> 192.168.0.100/payroll?user=root&password=12345678");
>
>
> stmt = conn.createStatement();
>
> sqlstmt1 = "INSERT INTO testing (fname, lname) VALUES ('"+cname
> +"','"+cmodel+"')";
>
> stmt.executeUpdate(sqlstmt1);
>
> }
> catch (SQLException ex)
> { // handle any errors
>
> System.out.println("SQLException: " + ex.getMessage());
> System.out.println("SQLState: " + ex.getSQLState());
> System.out.println("VendorError: " + ex.getErrorCode());
>
> } catch (Exception ex)
>
> { System.out.println("An error has occured"); }
>
> finally
> { // it is a good idea to release resources in a finally{} block in
> reverse-order of their creation if they are no-longer needed
> if (rs != null)
> { try{ rs.close(); } catch (SQLException sqlEx) { }//ignore
> rs = null;
> }
> if (stmt != null)
> { try{ stmt.close(); } catch (SQLException sqlEx) { }//ignore
> stmt = null;
> }
> }//finally
> }//main
> }
>
> *************************************************************************************
>
> When I execute this file I received the error which is given below
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> SQLException: Communications link failure due to underlying
> exception:
>
> ** BEGIN NESTED EXCEPTION **
>
> java.net.SocketException
> MESSAGE: java.net.ConnectException: Connection refused: connect
>
> STACKTRACE:
>
> java.net.SocketException: java.net.ConnectException: Connection
> refused: connect
> at com.mysql.jdbc.StandardSocketFactory.connect
> (StandardSocketFactory.java:156)
> at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
> at com.mysql.jdbc.Connection.createNewIO(Connection.java:2641)
> at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
> at com.mysql.jdbc.NonRegisteringDriver.connect
> (NonRegisteringDriver.java:266)
> at java.sql.DriverManager.getConnection(DriverManager.java:
> 525)
> at java.sql.DriverManager.getConnection(DriverManager.java:
> 193)
> at insertmysql.main(insertmysql.java:30)
>
>
> ** END NESTED EXCEPTION **
>
>
>
> Last packet sent to the server was 16 ms ago.
> SQLState: 08S01
> VendorError: 0
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>
> I am using
>
> O/S:
> Windows 2000 Advanced server
> IP(inwhich MySQL server installed) 192.168.0.100
> MySQL version MySQL
> 5.0.18-nt-log via TCP/IP
> MySQL connector mysql-
> connector-java-5.0.3-bin.jar
> connector path C:
> \Program Files\Java\jdk1.5.0_07\jre\lib\ext
>
> Please help me to resolve this issue.
>
> >
_________________________________________________________________
Rediscover HotmailĀ®: Get quick friend updates right in your inbox.
http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Updates1_042009
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Java
EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en
-~----------~----~----~----~------~----~------~--~---