jdbc - How it works; "executeUpdate()"? -
i new jdbc , testing purpose passed select queries in executeupdate() instead of dml queries; , result got, made me confused.
i tested on scott user's tables of oracle 11g.
for dept , salgrade table returns integer no. 4 , 5 no. of records in these tables think. , emp table should return 14, returned 10; why ?
my code is:
import java.sql.*; public class jdbctest2 { public static void main(string args[])throws exception { class.forname("oracle.jdbc.oracledriver"); connection con = drivermanager.getconnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","tiger"); statement st=con.createstatement(); system.out.println(st.executeupdate("select * dept")); system.out.println(st.executeupdate("select * salgrade")); system.out.println(st.executeupdate("select * emp")); st.close(); con.close(); } }
i know executeupdate() not meant select queries; happening here please explain me , let me come out confusion.thank you
Comments
Post a Comment