Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Creating Oracle Connection(Issues using Thin Client)
Creating Oracle Connection [message #1832695] Wed, 23 September 2020 11:57
Jim Irvine is currently offline Jim IrvineFriend
Messages: 1
Registered: September 2020
Junior Member
Using Eclipse:
Eclipse IDE for Java Developers (includes Incubating components)
Version: 2020-09 (4.17.0)
Build id: 20200910-1200

I'm a complete novice when it comes to Java and eclipse. My main knowledge is in Oracle SQL & PL/SQL.
What I'm trying, unsuccessfully, to do is create a connection to an Oracle database (ORCL) on my local machine.

Here's the start of the code I'm using (I snipped as the code doesn't get any further before erroring, so I figured I wouldn't muddy the waters with other potential issues in my code):
public static void main(String[] args) {
	Connection conn = null;
	Statement stmt = null;
		conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","hr","hr");

		System.out.println("Creating statement...");
		stmt = conn.createStatement();
		String sql;
		sql = "SELECT employee_id, first_name, last_name, salary FROM Employees";
		ResultSet rs = stmt.executeQuery(sql);

And when I run it, I get:
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@localhost:1521:orcl

Now, I had assumed intially that the issue was the connection string, however, I built a connection using the Database Development perspective which used this exact string wih no issues.
I'm assuming that it can't see the ojdbc14.jar, although I did THINK that I registered it correctly:
(RClick the (default package)-->Build Path--> Configure Build Path
Click on Libraries
Select ClassPath
Add External JARs
Navigate to and Select the ojdbc14.jar which I had stored in an Oracle directory.
Apply and close.

To no avail. Obviously I'm missing something important (and probably blatantly obvious).
I still get the error above.
Any insights would be most appreciated.
Previous Topic:backup/restore an Eclipse application environment
Next Topic:Eclipse IDE for Java Developers Installer Error
Goto Forum:

Current Time: Mon Jun 27 19:18:55 GMT 2022

Powered by FUDForum. Page generated in 0.02101 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top