DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Do I need to install jdbc drivers?

  1. #1
    Join Date
    Aug 2006
    Posts
    2

    Do I need to install jdbc drivers?

    Hi,
    I installed Oracle 10gR2 on Linux. When I tried writing a simple
    java program using jdbc I got the following error:

    ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    SQLException: No suitable driver

    I'm using the following variables in my program :

    String m_url = "jdbcracle:thin:@machine_name:1521:tebi";
    String m_driverName = "oracle.jdbc.driver.OracleDriver";

    This program had worked perfectly when connecting to another
    database.

    1) Am I missing the JDBC drivers or are they installed by default
    with Oracle? I did not install any driver explicitly.

    2) I am a little doubtful regarding the url. is 1521 the default port
    and always the same? tebi is the name of the instance. Is that
    correct or did I put it in the wrong place?

    Any help will be greatly appreciated.

    Thanks,
    Steve

  2. #2
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    I am not sure if default 10g installation installs JDBC thin driver. AFIAK in 9i you would have to do custom installation and choose jdbc install.

    Show us the contents of $ORACLE_HOME/jdbc

  3. #3
    Join Date
    Aug 2006
    Posts
    2
    Quote Originally Posted by pando
    I am not sure if default 10g installation installs JDBC thin driver. AFIAK in 9i you would have to do custom installation and choose jdbc install.

    Show us the contents of $ORACLE_HOME/jdbc
    Hi,
    thanks for the reply. $ORACLE_HOME/jdbc contains
    bin
    lib
    Readme.txt

    lib has the following jar files:

    classes12dms.jar
    classes12.zip
    ojdbc14dms_g.jar
    ojdbc14_g.jar
    classes12.jar
    nls_charset12.jar
    ojdbc14dms.jar
    ojdbc14.jar

    So it seems that I do have the drivers however here is a post:
    http://forums.oracle.com/forums/ann.jspa?annID=201
    that says :
    The Oracle JDBC drivers will no longer support the use of the package oracle.jdbc.driver in future releases which was what I was doing in my program since my program was a working program from Oracle8i.

    Does anybody know how should I change the following string :
    String m_url = "jdbcracle:thin:@machine_name:1521:tebi";

    Thanks,
    Steve

  4. #4
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    By checking Oracle 10g R2 documentation it states this:

    Code:
    Opening a Connection to a Database
    First, you must create an OracleDataSource instance. Then, open a connection to the database using OracleDataSource.getConnection. The properties of the retrieved connection are derived from the OracleDataSource instance. If you set the URL connection property, then all other properties, including TNSEntryName, DatabaseName, ServiceName, ServerName, PortNumber, Network Protocol, and driver type are ignored.
    
    Specifying a Database URL, User Name, and Password
    
    OracleDataSource ods = new OracleDataSource();
    String url = "jdbc:oracle:thin:@//myhost:1521/orcl",
    ods.setURL(url);
    ods.setUser("scott");
    ods.setPassword("tiger");
    Connection conn = ods.getConnection();
    
    
    Specifying a Database URL That Includes User Name and Password
    
    String URL = "jdbc:oracle:thin:scott/tiger@//myhost:1521/orcl");
    ods.setURL(URL);
    Connection conn = ods.getConnection();
    According to the link you supplied 10g R2 still supports oracle.jdbc.driver though

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