Forums Register Login

JDBC-ORACLE: Why same code work at local machine but not remote client?

+Pie Number of slices to send: Send
//the code are as following, it works fine on server local machine but not on the client, I have double checked the javapath/jre/ext and I have those zip files for oracle, but the errors still says class not found, any ideas? Thanks
import java.sql.Connection ;
import java.sql.DriverManager ;
import java.sql.ResultSet ;
import java.sql.Statement ;
class JavaOraConn
{
public static void main (String s[])
{
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch (ClassNotFoundException e) {
System.err.println (e) ;
System.exit (-1) ;
}
try {
// open connection to database
Connection connection = DriverManager.getConnection(
"jdbc racle:thin:@ServerIP:1521 ra9i",
"scott", // ## fill in User here
"tiger" // ## fill in Password here
);
// build query
String query = "SELECT * From emp" ;
// execute query
Statement statement = connection.createStatement () ;
ResultSet rs = statement.executeQuery (query) ;
System.out.println ("Test:") ;
while ( rs.next () )
System.out.println (rs.getInt ("empno") + " | " +
rs.getString ("EName") + " | " +
rs.getInt ("MGR")) ;
connection.close () ;
}
catch (java.sql.SQLException e) {
System.err.println (e) ;
System.exit (-1) ;

}
}
}
+Pie Number of slices to send: Send
triple check your classpath on the remote machine. If you still think it is OK, then post your classpath of the remote machine here and post the actual path of the classes12.zip files on the remote machine. Maybe we can see a subtle error that you may have overlooked.
Jamie
+Pie Number of slices to send: Send
 

Originally posted by Jamie Robertson:
triple check your classpath on the remote machine. If you still think it is OK, then post your classpath of the remote machine here and post the actual path of the classes12.zip files on the remote machine. Maybe we can see a subtle error that you may have overlooked.
Jamie


One quick way to check your classpath is to use the javap utility. Try this...
javap oracle.jdbc.driver.OracleDriver
If this works (it prints out a summary of all the methods/fields of the class), then your classpath is correct. If not, contact Houston because you've got a problem! :-)
+Pie Number of slices to send: Send
I try javap oracle.jdbc.driver.OracleDriver and it says class not found. Now I am got confused, since I could compile the class and run, what happen?
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 958 times.
Similar Threads
Tomcat - MySql - Win98 Jdbc connection = BOOM!
Urgent....
JDBC Connection (or "I Am At My Wits End")
Connection Troubles
Invalid Coursor Name...
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:15:37.