aspose file tools*
The moose likes JDBC and the fly likes Oracle 7 and JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Oracle 7 and JDBC" Watch "Oracle 7 and JDBC" New topic
Author

Oracle 7 and JDBC

Chong YK
Greenhorn

Joined: Sep 05, 2001
Posts: 1
Hi all,
I am trying to connect the java program to Oracle 7.It gives the following error message when i tried to run it on my Win98. I am using jdk1.2.2 and the oracle driver is classes111.zip. My host and sid r based on the sid and port number in the TNSNAMES.ora.My testing code is as below:
import java.sql.*;
public class TestConnect {
public static void main (String[] arg) {
String url="jdbcracle:thin:@127.0.0.1:1521:ORCL";
String userId = "scott";
String password ="tiger";
//Load the driver
try {
Class.forName ("oracle.jdbc.driver.OracleDriver");
}
catch (ClassNotFoundException e){
System.out.println("Could not load the driver");
System.exit(0);
}

//Request the connection
Connection con = DriverManager.getConnection(url,userId, password );

con.close();
System.out.println("All okay");
}
catch (Exception e) { e.printStackTrace();}

}
}

Run-time error message:
java.sql.SQLException: Connection refused: no further information
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:230)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:110)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:148)
at java.sql.DriverManager.getConnection(DriverManager.java:457)
at java.sql.DriverManager.getConnection(DriverManager.java:137)
at TestConnect.main(TestConnect.java:25)
I've checked the message boards but cant find any solution...
I am greatly thankful if any of you out there can give some idea or solutions on the problem!...
Thanks...
YK
mibrahim
Greenhorn

Joined: Jul 10, 2001
Posts: 3
I guess you are trying to connect to an oracle instance running on the local machine (127.0.0.1) from where you are trying to connect. Is this oracle instance running?
If you are not running the database on the machine from where you are trying to connect, change the ip to point to the remote machine and try again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Oracle 7 and JDBC
 
Similar Threads
Connecting To Database
Establishing Connection to MS Access Databases
SQL Server 2000 JDBC Driver Error
No suitable Driver in DB2
Oracle Connectivity Error