consider the following snippet:

import java.sql.*;
public class test
{
  public static void main(String args[])
  {
     try
      {
          Class.forNameI"sun.jdbc.odbc.JdbcOdbcDriverManager");
          Connection cn;
            cn=DriverManager.getConnection("jdbc:odbc","username","password");
        Statement st=cn.createStatement();
        st.executeQuery("select * from emp");
        System.out.println("Succeed");
      }
      catch(Exception e)
      {
          System.out.println("Faild");
      }
      finall()
      {
          system.out.println("Always");
      }
    }
}

what will be the result

Edited 3 Years Ago by Reverend Jim: Fixed formatting

Comments
32nd post and you miss code tag.

Error while compiling, as there is nothing like Class.forNameI"sun.jdbc.odbc.JdbcOdbcDriverManager");, finall(); system.out.println("Always");

Error while compiling, as there is nothing like Class.forNameI"sun.jdbc.odbc.JdbcOdbcDriverManager");, finall(); system.out.println("Always");

It's .........
Class.forName("sun.jdbc.odbc.JdbcOdbcDriverManager");

& other is......
finally
{
System.out.println("Always");
}

Actualy i am about :
JDBC-ODBC bridge driver
OR JDBC-Net pure java driver

Wrap up source code with bb code tags.
>what will be the result
Have you compiled this code?

Result can be anything Succeed and Always if there been no issue, it can be Faild if table doesn't exist, or it can be number of errors because of various reasons.
So you better post what errors you getting.

PS: Gravely mistake in your code, you never closed Connection after you finished with DB

This article has been dead for over six months. Start a new discussion instead.