Hi,
I am using oracle server on linux box.With my code as follows:
import java.sql.*;
import java.awt.*;
import java.applet.*;
import java.lang.*;
public class JDBCOci{
public static void main(String[] sd){
try {
//Set up the Oracle JDBC driver
Class.forName ("oracle.jdbc.driver.OracleDriver");
Connection DB_conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL","scott","tiger");
//Create a JDBC statement object
Statement statement_obj =DB_conn.createStatement();
//Execute a query to get the employee names from the test DB
ResultSet results =statement_obj.executeQuery ("select ENAMEfrom EMP");
while(results.next ()){
System.out.println(results.getString(1)); }
} catch (SQLException e) {
throw new RuntimeException("SQL Exception "+e.getMessage());
}
catch(Exception e){
System.out.println(e);
e.printStackTrace();
}
}
}
With this code I am getting error as :
[root@LSERVER Abhay]# java JDBCOci
java.lang.RuntimeException: SQL Exception The Network Adapter could not establish the connection
at java.lang.Throwable.(Throwable.java:38)
at java.lang.Exception.(Exception.java:24)
at java.lang.RuntimeException.(RuntimeException.java:21)
at JDBCOci.main(JDBCOci.java:26)
Can somebody help me?
Abhay
Sound like a Network issue. Is JBoss and Oracle running on the same machine ?