Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Location
    Chicago, IL
    Posts
    5

    Unhappy Unanswered: No suitable driver SQLException

    Hello,

    I am trying to connect to Oracle 8i (the software's on my own machine - I'm NOT connecting to a Unix box).

    Here's what I have so far: (see note at end of code as well)

    import java.sql.*;
    import java.io.*;

    class studentGrades {
    public static void main (String args [])throws SQLException, IOException {
    try {
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    } catch (ClassNotFoundException e) {
    System.out.println ("Could not load the driver");
    }

    String user, pass, update;
    user = readEntry("userid : ");
    pass = readEntry("password: ");
    update = "CREATE TABLE Student2" +
    "(student_id varchar(25)," +
    "std_name varchar(25)," +
    "home_phone char(12)," +
    "total_credits integer," +
    "gpa number(3,2)," +
    "advisor_id varchar(25)," +
    "primary key(student_id));";

    Connection conn = DriverManager.getConnection (
    "jdbc:oracle" +user+"/"+pass);
    Statement stmt = conn.createStatement();
    try {
    stmt.executeUpdate(update);
    } catch (SQLException e) {
    System.out.println("Could not create table");
    while (e != null) {
    System.out.println("Message: " + e.getMessage());
    e = e.getNextException();
    }
    return;
    }
    System.out.println("Table Student2 created.");
    stmt.close();

    NOTE: I have also attempted to use the driver "sun.jdbc.odbc.JdbcOdbcDriver" and had no luck either.

    Can anyone please help me out?

    Thanks,
    Cindy

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

    Re: No suitable driver SQLException

    Originally posted by ckb76
    Hello,

    I am trying to connect to Oracle 8i (the software's on my own machine - I'm NOT connecting to a Unix box).

    Here's what I have so far: (see note at end of code as well)

    import java.sql.*;
    import java.io.*;

    class studentGrades {
    public static void main (String args [])throws SQLException, IOException {
    try {
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    } catch (ClassNotFoundException e) {
    System.out.println ("Could not load the driver");
    }

    String user, pass, update;
    user = readEntry("userid : ");
    pass = readEntry("password: ");
    update = "CREATE TABLE Student2" +
    "(student_id varchar(25)," +
    "std_name varchar(25)," +
    "home_phone char(12)," +
    "total_credits integer," +
    "gpa number(3,2)," +
    "advisor_id varchar(25)," +
    "primary key(student_id));";

    Connection conn = DriverManager.getConnection (
    "jdbcracle" +user+"/"+pass);
    Statement stmt = conn.createStatement();
    try {
    stmt.executeUpdate(update);
    } catch (SQLException e) {
    System.out.println("Could not create table");
    while (e != null) {
    System.out.println("Message: " + e.getMessage());
    e = e.getNextException();
    }
    return;
    }
    System.out.println("Table Student2 created.");
    stmt.close();

    NOTE: I have also attempted to use the driver "sun.jdbc.odbc.JdbcOdbcDriver" and had no luck either.

    Can anyone please help me out?

    Thanks,
    Cindy
    It looks like you are incorrectly composing the connection url. I think in your case it should look like:

    jdbcracleci8:@oracle_sid

    and you're trying

    jdbcracleusername/password
    ---
    "It does not work" is not a valid problem statement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •