Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Will Oracle 9i let me connect using jdbc right "out of the box"

Re: Will Oracle 9i let me connect using jdbc right "out of the box"

From: AV <avek_nospam_at_videotron.ca>
Date: Sun, 18 Aug 2002 00:01:59 -0400
Message-ID: <R_E79.13058$B5.123128@weber.videotron.net>

"James" <lawless_at_maths.tcd.ie> wrote in message news:1648709d.0208130847.46f70ce1_at_posting.google.com...
> Hi,
>
> I have sympathy for you having often been in that situation myself not
> so long ago (recent graduate :-)
>
> Should I be able to get my java program to connect
> > without
> > > installing anyting else?
>
> Well obviously you'll have to write some code but, no that should be
> it. I'm not sure about Oracle Personal server or whatever it's called,
> I'm more used to the enterprise versions but generally you have a
> server running on one machine and a client running on another machine.
> You generally have to have the client installed on the machine you're
> running Java on before it will connect. (Correct me if I'm wrong
> anyone?)
>
> I imagine the personal version has all that taken care of with client
> and server on one machine. If Toad will run then you can make a
> connection so you should be OK. You will also need to have a JDBC
> driver. See below.

The words "client" and "Oracle client" has various meaning: minimum: sql-plus + c-libraries + tnsnames setup maximum: jdbc drivers, OEM and several tons of utilities

Java has several ways to connect to Oracle:

Java -- jdbc-odbc bridge -- odbc -- Oracle (or MS-Oracle) odbc driver -- client-c-libraries -- Oracle (need minimum "Oracle client" installed)

Java -- OCI driver -- client-c-libraries -- Oracle (need classes12.zip and minimum "Oracle client" installed)

Java -- THIN driver -- Oracle
(need only classes12.zip, no "Oracle client")

AlexV.

> > > know how to connect to a database is by (I'm using windows) going to
the
> > > control panel, starting the odbc DSN utility and making a new DSN. I
can
> > see
> > > that there is definately a driver and I can set up a dsn from there.
But
> > it
> > > doesnt work.
>
> That's one way of doing it. What you're doing there is registering
> Oracle as a Windows (ODBC) data source whereby Windows makes the
> datasource available through a central location for whatever wants to
> use it. To talk to this in Java you will need to get Java talking to
> the Windows ODBC source and for this you need to make a JDBC-ODBC
> bridge. You can use the JdbcOdbcDriver class which comes standard with
> the JDK (Java). e.g.
>
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> conn =

DriverManager.getConnection("jdbc:odbc:datasourcename",username,password);
>
> Each database also supplies its own JDBC drivers (including Oracle)
> and you can simply talk to the database through Java using those.
>
> There's a whole load of stuff you have to to then, load your driver,
> use DriverManager, get an instance, etc. but you probably know that.
> Otherwise the Oracle docs might be a bit much but try the JDBC short
> tutorial on Sun. Or just search Google for JDBC tutorial and that'll
> fill in the rest.
>
> Any more problems, post your code here and we'll have a look.
>
> Good luck,
>
> James
Received on Sat Aug 17 2002 - 23:01:59 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US