This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Gonna need to see some code on this one, as there is no need for 'Class.forName()' to connect to any DB. You do need to know the JDBC driver (among other things) to use as a property of the Connection object (so it know what to use) to connect to the DB.
There are two ways register load a driver. If you are new to JDBC .. stick with Class.forNames() for now. Please review the java doc's or review one of the book referenced at the top of this form... Quick Summary: 1 jdbc has a driver manager to manages all data source connections weather they be type 1, 2, 3, or 4. 2 Class.forNames() register and load the driver to connect to you data source. 3 i use data source instead of database because jdbc 2.0 make it very easy to access any tabluar file. db engine is not required. My i recommend you review the tutorials... Pickup one of the book listed at the top of this form... Spend a few days reading... presently I am reading the 'JDBC API Tutorial ...' We are all here to help one another... Till next time... Monty6
Joined: Nov 22, 2008
hi! Hari, Class.forname is used to sepcify to load the JDBC drivers. and the sun.jdbc.odbc.JdbcOdbcDriver specifies that u r using JDBD_ODBC bridge driver to connect to databases.There are 4 types of drivers to connect to database.For details on types of drivers check up any book satya