mysql+JDBC over LAN
Hi,
Well I am using MySQL 4 and JDBC Driver "mysql-connector-java-3.0.16-ga-bin.jar" and its working fine over standalone pc but whenever I try the client program from another pc over Local Area Networking it throws the Socket Exception. The code what I am using for the connection is given below
import java.io.*;
import java.sql.*;
import java.net.*;
public class DBConnection {
public static void main(String[] args)
{
try{
Class.forName("com.mysql.jdbc.Driver").newInstance ();
}catch (Exception ex){
System.out.println(ex.toString());
}
String xDb_Conn_Str = "jdbc:mysql://192.168.0.153/isranewscorner";
Connection conn = null;
try{
conn = DriverManager.getConnection(xDb_Conn_Str,"admin"," israenter");
System.out.println("Oh!Its working...");
Statement stm = conn.createStatement();
ResultSet rs = stm.executeQuery("show tables");
while(rs.next())
{
System.out.println(rs.getString(1));
}//end while
}catch (SQLException ex){
System.out.println(ex.toString());
}
}//end main
}//end class
As far what I figure out is that may be I need to implement the StandardSocketFactory.class given in the JDBC jar file but the problem is that how can I include this class in the above code. Or if someone have solution of it to run the client program over LAN then please do email me the solution code as soon as possible.
NOTE that I have WindowXP and I am running mysqld-nt on it.
Thankx in Advance and looking forward to your kind reply.
Regards,
M.A.Bamboat
|