aspose file tools*
The moose likes JDBC and the fly likes Query regarding connection string. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Query regarding connection string." Watch "Query regarding connection string." New topic
Author

Query regarding connection string.

Chaitanya Vivek
Ranch Hand

Joined: May 17, 2006
Posts: 36
Hi I am new to JDBC. I am trying to connect to oracle database using JDBC.

what should be the first argumen to the following getConnection method?

Connection con = DriverManager.getConnection( "WHAT IS THIS", "username", "password" );


and how should the first argument be determined.

Please let me know.

thanks
chaitanya
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39815
    
  28
Have you been through the Java Tutorial? Does that help?
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2510
    
  10

Oracle faq tells you more about: What is the form of a URL.
Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Bob Nedwor
hangman
Ranch Hand

Joined: Aug 17, 2005
Posts: 215

I use:


where 192.168.0.100 is my db server.
But be careful. I am using ojdbc14.jar.
So if you are using something else like classes12g.zip, your syntax might be different, like "oracle.jdbc.Driver.OracleDriver" or something..

I hope that helps.

JDBC is really fun. If you can learn it, you can do all sorts of cool things between your Java programs and most databases. Plus, so many other important technologies are based on it.

Good Luck.


Bob N
SCJP - 1.4
SCJD - (B&S) Used 1.5 And It Runs On Solaris10
SCWCD - Thanks to HFSJ!!
Chaitanya Vivek
Ranch Hand

Joined: May 17, 2006
Posts: 36
Where is this class: new oracle.jdbc.OracleDriver()

I mean- which jar should we include.

Thanks
Chaitanya
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2510
    
  10

I mean- which jar should we include.


Chaitanya,
I am pointing you again to the Oracle faq:
Where can I get the class files?.

Reading it will get you started.

Regards, Jan
Chaitanya Vivek
Ranch Hand

Joined: May 17, 2006
Posts: 36
Hurrah!

I connected to Oracle and fetched data from EMP table.

Thanks for everyone who replied to my queries.

rgds
chaitanya
Chaitanya Vivek
Ranch Hand

Joined: May 17, 2006
Posts: 36
Also Thanks to Jan.

The link you pointed is very very informative.

Though I haven't used it now for my small example, I bookmarked the link because the content it has is very rich.

Once again, thanks for such a wonderful article.

Regards
Chaitanya
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Query regarding connection string.