Image

Imagebuddha_222 wrote in Imagejava_dev 😊calm

Hey i'm trying to just test a coonection to a DB via JDBC and I keep catching this error :
Caught a SQL Exception in init: No suitable driver
Details - error code: 0, sql state: 08001


the

import java.sql.*;
import oracle.jdbc.driver.*;

public class JDBCTest {
	
	public JDBCTest() {
		
	}


	public static Connection connect() throws SQLException {
		Connection conn = null;
		try {
			DriverManager.registerDriver(new OracleDriver());
			conn =
				DriverManager.getConnection(
					"jdbc:oci:@jesse:1521:jessedb",
					"jesse",
					"k2kermit");
		} catch (SQLException e) {
			System.out.println(
				"Caught a SQL Exception in init: " + e.getMessage());
			System.out.println(
				"Details - error code: "
					+ e.getErrorCode()
					+ ", sql state: "
					+ e.getSQLState());
		}
		return conn;
	}

	public static void main(String[] args) {
		try {
			connect();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}


is here.



I'm totally clueless when it comes to JDBC Drivers. I'm trying to access an Oracle 10g DB. I've searched around for some documentation about drivers etc, and I'm not sure where to look. Any help is appreciated.