Entrance Exams
Govt. Exams
execute() returns true/false and handles any SQL, while executeUpdate() returns affected rows count for DML statements only.
DatabaseMetaData provides information about the database, tables, columns, and other database properties.
getColumnCount() returns the total number of columns present in the ResultSet.
PreparedStatement offers both pre-compilation for performance and SQL injection prevention through parameterized queries.
executeUpdate() executes DML statements and returns the number of rows affected.
commit() saves all changes made during the current transaction permanently to the database.
executeQuery() returns a ResultSet containing the rows fetched from the database for SELECT queries.
SQLException is thrown when database-related errors occur, including connection failures and SQL execution errors.
The next() method moves the cursor to the next row in the ResultSet and returns true if a row exists.
Class.forName() is the standard way to load JDBC drivers. It dynamically loads the driver class.