728x90 Ad Space

Sign Up To The Free Email Newsletter!

Want to get notified whenever we produce the latest content ? Then subscribe now to start receiving hot updates from today.

Wednesday, 20 November 2013

It's A Demo Post

Hi I am Cool
I Example is JDBC

import java.sql.*;
import java.io.*;

public class jdbc1
{
 public static void main(String args[]) throws Exception
 { 
  ResultSet r;
  
  try
  {
   
   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
   Connection c = DriverManager.getConnection("jdbc:odbc:stud");
   
   Statement st = c.createStatement();
   r=st.executeQuery("select * from stud");
   
   System.out.println("Reg no\tName\tClass");
   System.out.println("*****************************");

   while(r.next())
    System.out.println(r.getInt(1)+"\t"+r.getString(2)+"\t"+r.getString(3));
  }


  catch(SQLException e)
  {
   System.out.println("SQL Error :"+e);
  }
  
  catch(Exception e)
  { 
   System.out.println("Error :"+e);
  } 

 }
}