Guest User

Untitled

a guest
Sep 1st, 2013
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package college;
  6. import java.sql.*;
  7. import java.io.*;
  8.  
  9. public class College {
  10.     public static void main(String[] args) {
  11.         // TODO code application logic here
  12.         Connection con;
  13.         PreparedStatement pstmt;
  14.         try
  15.         {
  16.             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  17.             con=DriverManager.getConnection("Jdbc:Odbc:Aakarshap");
  18.             pstmt=con.prepareStatement("Select eName from Employee where eNum=?");
  19.             pstmt.setString(1,args[0]);
  20.             ResultSet rst=pstmt.executeQuery();
  21.             if(rst.next())
  22.             {
  23.                 System.out.println("eName");
  24.                
  25.             }
  26.                 else
  27.                 System.out.println("No record found");
  28.            
  29.         }
  30.         catch(ClassNotFoundException ce)
  31.         {
  32.             System.out.println("Error"+ce);
  33.         }
  34.     catch(SQLException se)
  35.     {
  36.         System.out.println("Error"+se);
  37.     }
  38.     }
  39.    
  40. }
Advertisement
Add Comment
Please, Sign In to add comment