import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.sql.*; public class JoinTest { public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { System.out.println("Enter name of emp"); String name=br.readLine(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con= DriverManager.getConnection("Jdbc:Odbc:JoinTest","sa","micro123"); CallableStatement stmt = con.prepareCall("exec getPhone name"); ResultSet rs=stmt.getResultSet(); while (rs.next()){ String name1=rs.getString(1); int phone=rs.getInt(2); System.out.println(name1+" "+phone); }} catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Hi friends...
I am using callable statement first time and not able to run the program.
When I try to run program, I got "Microsoft][ODBC Driver Manager] Function sequence error"..
Please tell me the right procedure to use Callable Statement...
Thanks in advance....