The moose likes JDBC and Relational Databases and the fly likes how to connect java with oracle rdb Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "how to connect java with oracle rdb" Watch "how to connect java with oracle rdb" New topic

how to connect java with oracle rdb


Joined: Feb 05, 2001
Posts: 2
pleaz help me out ...iam not able to connect the driver that comes with ODBC32 icon in the control panel and am not even sure bout the syntax iam giving in the program...its like
Connection con=DriverManager.getConnection("jdbc dbc:mydb","scott","tiger");
pleaze check this out
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
Follow these steps.
1. Create an ODBC DSN - Using the Windows Control Panel, create an ODBC DSN (data source name) for the database.
2. Load the driver - In a JDBC program, one of the first things to do is to load the JDBC driver by calling the forName() static method of the Class class. forName() takes one string parameter: the name of the driver along with its package. For JavaSoft's JDBC-ODBC Bridge, this string is "sun.jdbc.odbc.JdbcOdbcDriver". Therefore, the call would look like:
3. Establish a database connection
Once the JDBC driver loads, you can establish a connection to the database using the DriverManager.getConnection() method. This method's first argument is a string that contains the JDBC URL for the database. The second and third parameters are the user name and password, respectively.
A JDBC URL is formulated using the following pattern:
A connection to the database could be estd. in this manner:
Connection connection_ = DriverManager.getConnection("jdbcdbc:myDSN", "sa", "");
I hope you must have got it.

Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
I agree. Here's the link:
subject: how to connect java with oracle rdb
It's not a secret anymore!