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:02]
# 1
Check your tnsnames file for oracle. Usually this error means that one of your sids or some other connection variable is off.
kdajania at 2007-7-12 9:59:41 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

Chack this code out:

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:42 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
but so far i got other problem which is http://forum.java.sun.com/thread.jspa?threadID=5176943
roger5089a at 2007-7-12 9:59:42 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...