This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes no connection time out for jdbc on linux machine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "no connection time out for jdbc on linux machine" Watch "no connection time out for jdbc on linux machine" New topic
Author

no connection time out for jdbc on linux machine

yo nara
Ranch Hand

Joined: Apr 03, 2002
Posts: 35
hello here is my program i run it on both windows and linux
on windows if i pull of the network cable it works fine but of linux machine it do not give me errro instead it waits a long even if i set the tcp/ip connection timeout parameters
# Source
import java.io.*;
import java.sql.*;
public class JDBCTest {
public static void main(String[] args) {
Connection connection = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
connection = DriverManager.getConnection
("jdbc racle:thin:@db01:1521:SMS","x","x");
DatabaseMetaData meta = connection.getMetaData();
System.out.println("Driver Version = " +
meta.getDriverVersion());
} catch(Exception e) {
e.printStackTrace();
System.exit(1);
}
System.out.println("Hit Return Key");
//here i pull off network cable
try {
BufferedReader input = new BufferedReader(new
InputStreamReader(System.in));
String line = input.readLine();
System.out.println("Start");
connection.rollback();
System.out.println("Completed");
} catch(SQLException e) {
e.printStackTrace();
System.exit(1);
}catch(IOException e){
e.printStackTrace();
System.exit(1);
}
System.out.println("Finished");
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: no connection time out for jdbc on linux machine
 
Similar Threads
How to connect to Linux using Java code?
Simple program for URL
Could you please help me?
SocketException is not throwing in Windows Vista while network lost.
problem in checking net connection