orcale 9i jdbc connection problem

dear all

i have one problem with jdbc by orcale when i connect to databae which has some error message by db connection? the driver and connect which is correct if i setup code and db in same machine , but if in diff mechine which indicte that

java.sql.SQLException: IO error: The Network Adapter could not establish the conn

ection

[359 byte] By [roger5089a] at [2007-11-27 4:47:01]
# 1

Try this code:

import java.sql.*;

class TestJdbc {

public static void main (String args [ ]) throws SQLException {

DriverManager.registerDriver (new oracle.jdbc.OracleDriver());

Connection conn = DriverManager.getConnection

("jdbc:oracle:thin:@myHost:1521:ORCL","username", "password");

Statement stmt = conn.createStatement ();

ResultSet rset = stmt.executeQuery

("SELECT ename FROM emp");

while (rset.next ())

System.out.println (rset.getString ("ename"));

rset.close();

stmt.close();

conn.close();

}

}

jorgechavez77a at 2007-7-12 9:59:41 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...