DB2 connection to java using eclipse

Tuesday, July 8, 2014

I am trying to connect the java program to IBM's DB2 database using Eclipse, here is the code



Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance();
Connection db2Conn = DriverManager.getConnection("jdbc:db2://localhost:50000/NTT","Ramveer","krsna");
Statement st=db2Conn.createStatement();
st.executeUpdate("INSERT INTO NTTP VALUES("MANOJ SAINI","iskcon110","Rajasthan","Male","july 2,2014","C:\Users\Ramveer\Documents\res");");


there is syntex error in db2Conn.createStatement(); Type mismatch: cannot convert from java.sql.Statement to java.beans.Statement and on the last line st.executeUpdate(" "), as Multiple markers at this line - The method executeUpdate(String) is undefined for the type Statement - Syntax error, insert ";" to complete Statement - Syntax error, insert "AssignmentOperator Expression" to complete Assignment - MANOJ cannot be resolved to a variable - Syntax error, insert ";" to complete Statement - Syntax error, insert ")" to complete MethodInvocation. i am knew to db2 and can not figure out what is wrong ,any help will be appreciated, Thank in advance







http://ift.tt/1mvKh7L