• Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC Connectivity

 
Neha Mohit
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers ,

can anybody tell me which is a better approach to get connection to oracle databse using JDBC .

a) Class.forName( -- parameter here - )
b) DriverManager.getConnetion(--parameter here )


I tried google , but that too vain ,all i could get from google till now is, we cannot use Class.forName() for Microsoft Java Virtual machine , as a matter of fact not sure what actually is Microsoft Java Virtual machine .

Can anybody expalin me

regards
 
Masoud Kalali
Author
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
indeed you need both
class.forName and DriverManager.getConnection in older java versions , but in jdbc version 4.0 is it much easier that older versions.
so :

you need to do both of those lines that you write to create a database connection as you can see in :

http://java.sun.com/docs/books/tutorial/jdbc/basics/connecting.html

Ms JVM is a java virtual machine that Microsoft implemented for its OS long ago , no one ,AFAIK, uses msJVM anymore.


hth
 
Neha Mohit
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Masoud
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!