Subjects

All subjects Django Java Python React Spring Boot JavaScript PHP
Sign Up Free
Java 10 questions

Java Database Connectivity (JDBC)

Master JDBC APIs. Learn connection setups, prepared statements, transaction commits, batch updates, and result mappings.

More Java
Interview questions 1–10 of 10
1

What is JDBC and what are the steps to connect Java to a database?

JDBC (Java Database Connectivity) is a standard Java API that lets applications interact with relational datab...

Read answer →
2

What is the difference between Statement, PreparedStatement, and CallableStatement?

InterfacePurposeSQL injection safe?PerformanceStatementStatic SQL queries, no parametersNo - vulnerable if con...

Read answer →
3

How does PreparedStatement prevent SQL injection?

PreparedStatement sends the SQL query structure to the database SEPARATELY from the parameter values. The data...

Read answer →
4

How do you manage transactions in JDBC?

Transactions group multiple SQL operations so they either all succeed (commit) or all fail together (rollback)...

Read answer →
5

What is connection pooling and why is it important in JDBC applications?

Connection pooling maintains a reusable pool of database connections instead of opening and closing a new one...

Read answer →
6

What is the difference between execute(), executeQuery(), and executeUpdate() in JDBC?

MethodUsed forReturn typeexecuteQuery()SELECT statements onlyResultSetexecuteUpdate()INSERT, UPDATE, DELETE, D...

Read answer →
7

How do you handle SQLException properly in JDBC applications?

SQLException is a checked exception carrying database-specific error information (SQL state, vendor error code...

Read answer →
8

What is batch processing in JDBC and how does it improve performance?

Batch processing groups multiple SQL statements together and sends them to the database in a SINGLE round trip...

Read answer →
9

What is the difference between JDBC and an ORM like Hibernate?

AspectJDBCHibernate (ORM)Abstraction levelLow-level, direct SQLHigh-level, objects mapped to tablesSQL writing...

Read answer →
10

How do you retrieve auto-generated keys after an INSERT in JDBC?

When inserting a row into a table with an auto-increment primary key, JDBC lets you retrieve that generated ke...

Read answer →