jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes JDBC Connectivity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC Connectivity" Watch "JDBC Connectivity" New topic
Author

JDBC Connectivity

Neha Mohit
Ranch Hand

Joined: Apr 25, 2006
Posts: 87
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

Joined: Jul 08, 2004
Posts: 531

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


Masoud Kalali
Software Engineer - My Weblog - GlassFish Security
Neha Mohit
Ranch Hand

Joined: Apr 25, 2006
Posts: 87
Thanks Masoud
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC Connectivity