• typeof “text”  —->   string
  • typeof 123   ——      number
  • typeof Nan  ——>  number
  • typeof “123”——>  string
  • typeof []——>  object
  • typeof {}——>  object
  • typeof null——>  object
  • typeof false——>  boolean
  • typeof true——>  boolean

Exact meaning of Class.forName(); in JDBC

Before going to discuss, need to discuss about Drivers.

Inorder to connect a  java Application  with database ,  we need to follow the below important steps

  1. Use any JDBC  Driver class.
  2. This JDBC Driver class has to be instantiated.
  3. And Instantiated Driver class should be Registered with DriverManager class

For Example:

Let’s take Type1-Driver(sun.jdbc.odbc.JdbcOdbcDriver) which comes with JDK by Default

So Inorder to connect  a java application with  database with this driver we have to write following statements.

sun.jdbc.odbc.JdbcOdbcDriver driver=new sun.jdbc.odbc.JdbcOdbcDriver();


Ok.Then what is Class.forName(“com.Anyclass”) ?

Basically Class.forName("com.Anyclass");   used to load a class.

while loading a class, if that class contains static blocks, and any code which is in that static blocks,  will be executed.

So if write a statement  for Ex:      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 

code in static block of this driver will be executed while class is loading.

All most all JDBC drivers contains static blocks and these static block contains the code to

1) Instantiate the driver class

2) Register the driver with DriverManager.

Following  is the  static block in JdbcOdbcDriver


JdbcOdbcTracer jdbcOdbcTracer= new JdbcOdbcTracer();


<pre>jdbcOdbcTracer.trace("JdbcOdbcDriver class loaded");</pre>

sun.jdbc.odbc.JdbcOdbcDriver driver=new sun.jdbc.odbc.JdbcOdbcDriver();