Link to home
Start Free TrialLog in
Avatar of perfect_tranquility
perfect_tranquilityFlag for United States of America

asked on

JDBC with Oracle:Driver Class?

I have been trying to establish a connection to Oracle database in my company and I can not even load the driver class.  Can someone help plz?

The host string ,port number, user name and passwords are all fine as I used them to log thru SQL Tools.
package package1;
 
import java.sql.*;
 
public class class1 {
 
	private void f()   {
                 try{
	//Class.forName("jdbc:oracle:thin");
	Class.forName("oracle.jdbc.driver.OracleDriver");
					
	}
	catch(ClassNotFoundException e){
	System.out.println("Driver not loaded");
	}
String url = "oracle.jdbc.driver.OracleDriver:@144.226.202.69:1521:CCRP";
try{
				
Connection con=DriverManager.getConnection(url, "COMM_USER","APP0NLY");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from stage2");
System.out.println(rs.getType());
	}
catch(SQLException e){
System.out.println("Connection could not be established");
				}
				
	}
	
 
	public static void main(String[]fdfd){
		
		new class1().f();
	}
	
				}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Venabili
Venabili
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This won't even compile rks_86. :)
Not to mention that it does not add anything to what I posted days ago... So what was the point in posting it?
Avatar of perfect_tranquility

ASKER

no problem, plz give me a day or two. I will check both of them out and come back. I have always been just in giving points, not to worry friends.
Thank you Venabili:. I had not read your links before posting.:-) Sorry :-)
By the way I'm not a expert i just wanted to help him as i also faced exactly same :-)
perfect_tranquility, I DONT want any points  you can award Venabili full points. :-)
rks_86, it's not about the points :) The whole idea is to work as a team so... try to read what is already posted before jumping in a question (and this is in the rules by the way) :) PS: Did you see why your code does not compile? :)

perfect_tranquility, Sure. let me know if you need more assistance
Syntax error right
Please bear with me, I will be doing all this JDBC stuff on weekend, this way, I shall memorize it all for ever!

Thanks