Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Query regarding connection string.

 
Chaitanya Vivek
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you been through the Java Tutorial? Does that help?
 
Jan Cumps
Bartender
Posts: 2586
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oracle faq tells you more about: What is the form of a URL.
Regards, Jan
 
Bob Nedwor
hangman
Ranch Hand
Posts: 215
Eclipse IDE Oracle Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Chaitanya Vivek
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is this class: new oracle.jdbc.OracleDriver()

I mean- which jar should we include.

Thanks
Chaitanya
 
Jan Cumps
Bartender
Posts: 2586
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic