• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

class.forName

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the need for Class.forName() method to connect to database using java? And what is the meaning of su.jdbc.odbc.Jdbc OdbcDriver that I am giving as a parameter in Class.forName method?
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic