Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
| Search | Today's Posts | Mark Forums Read
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 2nd, 2005, 05:56 AM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

 
Old April 1st, 2005, 04:14 AM
Authorized User
 
Join Date: Nov 2004
Location: , , Hong Kong.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

is that your firewall block the request to access db





Similar Threads
Thread Thread Starter Forum Replies Last Post
jdbc:mysql connectivity kvenk111 Pro JSP 2 April 21st, 2006 02:25 AM
jdbc-mysql kvenk111 Java Databases 1 April 13th, 2006 02:20 AM
mysql + JDBC + Linux silver_cuts Java Databases 2 March 23rd, 2006 09:28 AM
Cannot load JDBC driver class with com.mysql.jdbc. dzis Apache Tomcat 0 January 29th, 2004 11:57 AM
Cannot load JDBC driver class with com.mysql.jdbc. dzis MySQL 0 January 29th, 2004 11:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.