NetrorkAdapter couldn't estabilish the connection
From: Sanjay Meher <sanjaymeher_at_yahoo.co.in>
Date: 31 Dec 2001 04:49:32 -0800
Message-ID: <7cd8774.0112310449.4c438e9a_at_posting.google.com>
DriverManager.getConnection("jdbc:oracle:thin:_at_cimntws07:1521:CADNIC", "scott", "tiger");
public static void main(String arg[]) {
Date: 31 Dec 2001 04:49:32 -0800
Message-ID: <7cd8774.0112310449.4c438e9a_at_posting.google.com>
Hello
i have loaded oracle8.1.6 on windowNT and from the same machine i want to connect java to oracle through oracle driver , but unfortunately i am getting error Network Adapter couldn't estabilish the connection.
i am sending the code.
public class Test extends JFrame
{
private static final boolean DEBUG = true;
public Test() {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch (ClassNotFoundException e) {
//e.printStackTrace();
System.out.println("Driver class not found : ");
return;
}
if (DEBUG) System.out.println("Creating a DB Connection...");
try {
Connection con =
DriverManager.getConnection("jdbc:oracle:thin:_at_cimntws07:1521:CADNIC", "scott", "tiger");
if (DEBUG) System.out.println("Connection Done...");
Statement st = con.createStatement();
String sql = "SELECT * FROM EMP";
ResultSet rs = st.executeQuery(sql);
ResultSetMetaData rmeta = rs.getMetaData();
int numColumns = rmeta.getColumnCount();
while ( rs.next() ) {
for (int i = 0; i < numColumns; i++) {
System.out.println(rs.getString(i));
}
System.out.println();
}
} catch(SQLException sqe) {
System.out.println("Error in Getting Connection : " +
sqe.getMessage());
sqe.printStackTrace();
return;
}
if (DEBUG) System.out.println("Done!...");
}
public static void main(String arg[]) {
Test a = new Test();
}
}
if any body have any idea how to resolve the situation then please help me
Regards
Sam
Received on Mon Dec 31 2001 - 13:49:32 CET
