Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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

  #2 (permalink)  
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

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:03 AM.


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