Anonymous
Anonymous asked in Computers & InternetProgramming & Design · 1 decade ago

how to connect to oracle database trough java program?

in my system i have loaded Oracle 9i and set the path in environmental variables like path,classpath.

Buit when i run my jdbc program iam getting exception

Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC driver for Or

acle][Oracle]

at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)

at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)

at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)

at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)

at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)

at java.sql.DriverManager.getConnection(Unknown Source)

at java.sql.DriverManager.getConnection(Unknown Source)

at testjdbc.main(testjdbc.java:7)

3 Answers

Relevance
  • Anonymous
    1 decade ago
    Best Answer

    Try to read this tutorial:

    http://www.oracle.com/technology/tech/java/index.h...

    But your error seems to be that the name of the main class of your program and the name of the Java file that you have saved your code are different. Also check if the enviroment variables are correctly.

    Source(s): RBM
  • degnan
    Lv 4
    3 years ago

    you decide on a motive force, yet motive force hence does not propose an working device motive force. It skill a Java application that conforms to the Java DataBase Connectivity specification. you will get carry of the motive force from Oracle's website.

  • 1 decade ago

    Have you tried to use the Oracle database connector as the driver? You should use it in connecting to an Oracle database. Different databases have different drivers for Java.

    Check also www.exampledepot.com for some examples on how to connect you java program to a database (be it oracle, mysql, etc.). I hope this helps and goodluck!

Still have questions? Get your answers by asking now.