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

kvprajapati commented: 32nd post and you miss code tag. +0

Recommended Answers

All 4 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.