File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Connecting To Database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Connecting To Database" Watch "Connecting To Database" New topic

Connecting To Database

Greedy thomas
Ranch Hand

Joined: May 15, 2003
Posts: 37

I am currently using Java 1.4 on Windows 98 and have installed Oracle 9i on my system. What do I need to do to be able to access the database. I understand that I would need to use the ODBC drivers. Do I use the one that was installed when I installed Oracle 9i on my system. How can I test if I can access the tables in the database.

I'm fairly new to Java and learning how to use JDBC now.

Thanks in advance
Barbara Norway
Ranch Hand

Joined: Sep 30, 2003
Posts: 150

Where is the Oracle RDBMS installed? Is it on your windows PC? Or is it on a server that you're trying to connect to from your PC? If both the Oracle server and the application you are using to connect to it are on your PC, did the Oracle installation process give you an opportunity to congfigure and test your Net setup?

There are many, many different scenarios possible but one universal thing you can try is to startup SQL*PLus from your start menu (or there may be an icon for it on the desktop). Then see if it starts up and gives you a SQL> prompt.

I'm afraid I need more details from you before I can give you a more specific answer. One thing, if you are connecting to the "localhost" (your own PC), you wouldn't need ODBC drivers to use SQL*Plus.



Barbara Norway
Ranch Hand

Joined: Sep 30, 2003
Posts: 150

Just reread your post and if you mean how would you connect to the database within Java, you could use JDBC not ODBC, I think. There are other alternatives but I'll have to leave the details of that to the Java experts.

Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Forget ODBC, that's Microsoft stuff. You need two things. One is an Oracle JDBC driver. There's probably one included with your 9i installation. If not you can get one from Oracle's website.

Secondly you need to know how to write JDBC code in Java. One good place to start learning is Sun's JDBC Tutorial.

I agree. Here's the link:
subject: Connecting To Database
It's not a secret anymore!