Forum Stats

  • 3,827,521 Users
  • 2,260,789 Discussions
  • 7,897,287 Comments

Discussions

cannot connect to oracle from transformation script (driver not found)

Gell�rt-Oracle
Gell�rt-Oracle Member Posts: 18

Given the following code in a transformation script:

importPackage(java.sql);

conn = java.sql.DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:db1", "ueser", "passw");

stmt = conn.createStatement();

rset = stmt.executeQuery("SELECT * FROM DUAL");

rset.close();

stmt.close();

conn.close();

The error message is:

No suitable driver found for jdbc:oracle:thin:@localhost:1521:db1

I even tried to add the below lines to "Third Party JDBC Drivers", but it did not help.

D:\oracle\product\12.1.0\dbhome\jdbc\lib\ojdbc7.jar

D:\oracle\product\12.1.0\dbhome\jlib\orai18n.jar

Tagged:

Answers

  • Philip Stoyanov-Oracle
    Philip Stoyanov-Oracle Member Posts: 3,410 Employee

    if you look at examples you'll see following statement before getConnectionon...

    java.lang.Class.forName ("oracle.jdbc.OracleDriver");

    Philip

    Philip Stoyanov-Oracle
  • Gell�rt-Oracle
    Gell�rt-Oracle Member Posts: 18
    edited Oct 21, 2013 7:22AM

    That line was missing from the second example. However my problem is infrastructure related:

    java.lang.Class.forName ("oracle.jdbc.OracleDriver"); --->Wrapped java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver

    I used Data Modeler 4.0.0.825. This could be related to the custom java home used by my installation.

    The same code works with version "3.3.0.747 jre included"

This discussion has been closed.