Try using the 3306 port.

----------------------------------------------------------------------------------------------------------------------------------------

*Enrique Estellés Arolas <kikeestel...@gmail.com>*
 Universidad CEU-Cardenal Herrera
Departamento de Matemáticas, Ciencias Físicas y de la Computación.
Sistemas de información <http://maphysco.ceuuch.es/%7Eestelles/>, usabilidad
web <http://maphysco.ceuuch.es/%7Eestelles/> y  metodologías
ágiles<http://maphysco.ceuuch.es/%7Eestelles/>

Web personal: 
http://maphysco.ceuuch.es/~estelles/<http://maphysco.ceuuch.es/%7Eestelles/>
Mail: kikeestel...@gmail.com



2009/4/11 <star...@yahoo.com>

>
> 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.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 
java-ee-j2ee-programming-with-passion@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to