Problem Connecting to Oracle DB with JDBC
Date: Fri, 22 May 1998 20:27:25 GMT
Message-ID: <3565dc91.5660222_at_news.iglobal.net>
Help!!
I am attempting to connect to an Oracle V7.3.2.2 database from a Java program running on a Windows 95 workstation. The Java is Sun's JDK 1.1.6. The source code is lifted from the Oracle JDBC 7.3.4.0.0 release notes, with minor mods to match my hostname and Oracle instance:
import java.sql.*;
class JdbcTest {
public static void main (String args[]) throws SQLException {
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver()); Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:orsrv:1521:WG73",
"scott", "tiger");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select ename from emp");
while (rset.next()) {
System.out.println(rset.getString(1));
}
}
}
When I run it, it fails with this message:
java.sql.SQLException: connection refused
What am I doing wrong?
Any help will be greatly appreciated.
Received on Fri May 22 1998 - 22:27:25 CEST