I want to connect java and db2. But I am not able to connect please check and reply
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
I face problem in the above line.
import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; class open { public static void main(String args[]) throws Exception{ Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); // establish a connection to DB2 Connection db2Conn=DriverManager.getConnection("jdbc:db2:watch/50000","sukhpal48806","aura"); // use a statement to gather data from the database Statement st = db2Conn.createStatement(); ResultSet rs=st.executeQuery("SELECT * FROM SUKHPAL48806.WATCH"); while(rs.next()==true){ System.out.println(rs.getString("firstname") +" - " + rs.getString("lastname")); } rs.close(); st.close(); db2Conn.close(); } }