PDA

View Full Version : ORA-12545: Connect failed because target host or object does not exist


dipsmyname
09-03-02, 09:56
Hi,

When I try to connect Oracle (residing on a NT box) using sqlplus (sqlplus datarx_dev/datarx_dev@datarx) from the client installed on a Linux server I get connected to the Oracle instance.

Now I tried to connect to Oracle using the following code in Java (JDK 1.3.1):
import java.sql.*;

public class OciConnTest
{

public static void main(String[] arg)
{
Connection conn = null;

try{
Class.forName("oracle.jdbc.driver.OracleDriver");

conn = DriverManager.getConnection("jdbc:oracle:oci8:@datarx", "datarx_dev", "datarx_dev");
//conn = DriverManager.getConnection("jdbc:oracle:oci8:@tcgprod", "system", "manager");
System.out.println("Connected");

}catch(Exception e){
System.out.println(e);
}finally{
try{
conn.close();
}catch(Exception ex){
}
}
}
}

I get the following error:
java.sql.SQLException: ORA-12545: Connect failed because target host or object does not exist

Any help is appreciated.

sastry
09-09-02, 00:16
Hi,
Please check whether Oracle is started when u r running this code. This error will be throwed only when oracle instance is not started and that the system is recornising the network. This error ORA-12545 is thrown when IP address is not found. so please check whether your system is connected to network. or what...

cheers
sastry

Originally posted by dipsmyname
Hi,

When I try to connect Oracle (residing on a NT box) using sqlplus (sqlplus datarx_dev/datarx_dev@datarx) from the client installed on a Linux server I get connected to the Oracle instance.

Now I tried to connect to Oracle using the following code in Java (JDK 1.3.1):
import java.sql.*;

public class OciConnTest
{

public static void main(String[] arg)
{
Connection conn = null;

try{
Class.forName("oracle.jdbc.driver.OracleDriver");

conn = DriverManager.getConnection("jdbc:oracle:oci8:@datarx", "datarx_dev", "datarx_dev");
//conn = DriverManager.getConnection("jdbc:oracle:oci8:@tcgprod", "system", "manager");
System.out.println("Connected");

}catch(Exception e){
System.out.println(e);
}finally{
try{
conn.close();
}catch(Exception ex){
}
}
}
}

I get the following error:
java.sql.SQLException: ORA-12545: Connect failed because target host or object does not exist

Any help is appreciated.

dipsmyname
09-09-02, 01:28
Hi Sastry,

Thanks for your reply. The Oracle instance is running, since we were able to connect to the Oracle instance (On NT) using SQL*Plus which was residing on Linux - the same machine where the java code resides. It would connect from SQL*Plus but not from the Java code.

Thanks,
-- Dipendra


Originally posted by sastry
Hi,
Please check whether Oracle is started when u r running this code. This error will be throwed only when oracle instance is not started and that the system is recornising the network. This error ORA-12545 is thrown when IP address is not found. so please check whether your system is connected to network. or what...

cheers
sastry