Okay so far we learnt the steps to do with JDBC. Now lets see the important interface in JDBC
>>Connection helps in connecting to specific Database.
>>Statement used to create a statement(query) and then execute it.
>>PreparedStatement's purpose is same as statement but it is preferable over statement because it can avoid sql injection and unnecessary object creations.
>>CallableStatement used to execute stored procedures.
>>ResultSet stores the records obtained from Database and we can traverse among records with the help of methods in ResultSet.
It returns no.of rows affected.
>>executeQuery() used to execute select command and returns set of records.
- Connection interface
- Statement interface
- PreparedStatement interface
- CallableStatement interface
- ResultSet interface
>>Connection helps in connecting to specific Database.
>>Statement used to create a statement(query) and then execute it.
>>PreparedStatement's purpose is same as statement but it is preferable over statement because it can avoid sql injection and unnecessary object creations.
>>CallableStatement used to execute stored procedures.
>>ResultSet stores the records obtained from Database and we can traverse among records with the help of methods in ResultSet.
ImportantMethods
>>executeUpdate() used to execute DML commands(insert,update,delete).It returns no.of rows affected.
>>executeQuery() used to execute select command and returns set of records.
>>execute() is used when you dont know which method to be used for executing SQL statements,This will return a boolean. TRUE indicates the result is a ResultSet and FALSE indicates it has the int value which denotes number of rows affected by the query.
No comments :
Post a Comment