• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

no connection time out for jdbc on linux machine

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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");
}
}
 
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic