Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Q: Connect with JDBC
Using Oracle's own implementation of the JDBC drivers would be better.
These do automatic bridging between JDBC and ODBC.
You can connect to Oracle8 with the oci8 drivers supplied with them.
You can download Oracle's JDBC from their web-site for free.
Although there isn't much documentation supplied with them its enough to get
started with.
Schauder wrote:
> Has anybody done a connect to Oracle8 (or anything else).
> If got some serious problems with it and would appriciate some help on this
> topic.
>
> My application looks like this:
>
> import java.sql.*;
> public class HelloWorld{
> public static void main(String[] args){
> Connection lo_OracleConnection;
> System.out.println("Hello World!");
> try{
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> } catch(java.lang.ClassNotFoundException e) {
> System.err.print("ClassNotFoundException: ");
> System.err.println(e.getMessage());
> }
> System.out.println("Hello Driver!");
> String lsURL = "jdbc:odbc:TEST01";
> String lsUser = "scott";
> String lsPassword = "tiger";
> System.out.println("Hello " + lsURL);
> System.out.println("Hello " + lsUser);
> System.out.println("Hello " + lsPassword);
> try{
> lo_OracleConnection = DriverManager.getConnection(lsURL,"scott","tiger");
> System.out.println("Hello Oracle!");
> } catch(SQLException ex){
> System.err.println("SQLException: " + ex.getMessage());
> }
> System.out.println("Bye Oracle!");
> }
> }
>
> And produces this output:
>
> Hello World!
> Hello Driver!
> Hello jdbc:odbc:TEST01
> Hello scott
> Hello tiger
> SQLException: [Microsoft][ODBC Driver Manager] Data source name not found
> and no
> default driver specified
> Bye Oracle!
>
> I use the ODBC driver from Oracle,
> the JDBC Bridgedriver shipped with jdk1.1.5
>
> Thanks for the help.
>
> Jens.Schauder_at_opal-edv.com
Received on Fri Apr 17 1998 - 16:12:43 CDT
![]() |
![]() |