JDBC connection to Oracle problem
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: JDBC connection to Oracle problem

  1. #1
    Join Date
    Nov 2000
    Posts
    57
    Here is my short test programm.
    import java.sql.*;
    import java.math.*;
    import java.io.*;
    import java.awt.*;

    class JDBCVersion
    {
    public static void main (String args[])
    throws SQLException
    {
    // Load the Oracle JDBC driver
    DriverManager.registerDriver
    (new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection
    ("jdbcracleci8:@10.2.1.31:1521:SIMTEST","VRSC","DANAHER");

    // Create Oracle DatabaseMetaData object
    DatabaseMetaData meta = conn.getMetaData();

    // gets driver info:
    System.out.println("JDBC driver version is " + meta.getDriverVersion());
    }
    }

    I am getting following error:

    Test.java [13:1] package oracle.jdbc.driver does not exist
    (new oracle.jdbc.driver.OracleDriver());

    Does anybody can point me in right directions?

    Thanks!

  2. #2
    Join Date
    May 2000
    Location
    fremont ca
    Posts
    182
    you should import this and make sure path is set
    import oracle.jdbc.driver.*;


  3. #3
    Join Date
    Mar 2002
    Posts
    10
    public class blackjack_sql implements Serializable
    {
    public static Connection connect()
    {

    String url = "jdbcracle:thin:@127.0.0.1:1521EVELOP";
    Connection blackjack_connect = null;

    try
    {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    } /* End try */

    catch(java.lang.ClassNotFoundException e)
    {
    System.err.print("ClassNotFoundException: ");
    System.err.println(e.getMessage());
    return null;
    } /* End catch */

    try
    {
    blackjack_connect = DriverManager.getConnection(url,"blackjack", "mobliss");
    return(blackjack_connect);
    } /* End try */

    catch(SQLException sqlerr)
    {
    System.err.println("SQLException: " + sqlerr.getMessage());
    return null;
    }

    } /* End connect */


    public static void disconnect(Connection blackjack_connect)
    {
    if(blackjack_connect != null)
    {
    try
    {
    blackjack_connect.close();
    blackjack_connect=null;
    }
    catch(SQLException sqlerr)
    {
    System.err.println("SQLException: " + sqlerr.getMessage());
    }
    } /* End if */
    } /* End disconnect */

Posting Permissions

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



Click Here to Expand Forum to Full Width