Java Database Connectivity (JDBC) is a technology that allows Java applications working with relational database management systems (RDBMS) such as MySQL, Microsoft SQL Server, Oracle, PostgreSQL, … via Structured Query Language (SQL) statement. The JDBC API is included in JDK, so any Java application can communicate with various database systems without requiring additional installation, as long as a JDBC driver is provided for the targeted database system.
By the end of this article,
Java Database Connectivity JDBC API is considered to be a database’s industry standard. An independent connectivity is provided by it b/w range of databases and Java programming language. Like Tabular data sources e.g. flat files and spreadsheet.SQL databases
To access SQL based database, call level API is provided by JDBC API.
In Java programming language, JDBC technology is used to “write once, Run Anywhere” capabilities. This is done for those applications
Updating a record from Java using executeUpdate() method of Statement object is used commonly by JDBC programmers. Thing to note is that this is a costly activity in terms of time, as a database trip is made. As a programmer/developer, our aim should be to write efficient Java code. In this post, I will write about how you can efficiently make several updates.
Batch update allows us to execute several update statements in a batch. It means only one database trip will be make, thus
JDBC (Java Database Connectivity) is designed to allow user to use SQL(Structured Query Language) to query databases. JDBC makes our tasks easy as it handles all low-level concerns about particular database types. It allows you to query an Access database with exactly the same source code as with an Oracle database.
JDBC is similar to Microsoft's ODBC with the plus point "Platform Independence". To use JDBC, you need to have database driver to communicate with the database.
In Glassfish connection pool has a property called "Wrap JDBC Objects" which can have value true or false. You may define it in domain.xml file.
This property is defined as: "When set to true, application will get wrapped jdbc objects for Statement, PreparedStatement, CallableStatement, ResultSet, DatabaseMetaData".
If you follow JDBC specifications, you will be see that obtaining connection using DataSource.getConnection() or other objects like
Hibernate JDBC/Connection's property hibernate.connection.release_mode is used to specify when Hibernate should release JDBC connections.
A JDBC connection is held until the session is explicitly closed or disconnected by default. For a JTA datasource, one should use after_statement to aggressively release connections after every JDBC call. And for a non-JTA connection, it often makes sense to release the connection at the end of each transaction. after_transaction.auto will
Hibernate logs various events using Apache commons-logging. Hibernate logs are very interesting to read if you want to do some troubleshooting or performance improvement. Hibernate uses commons-logging service for logging. It actually sends the log to either Log4j or to JDK1.4 logging.
If you want hibernate to log using Log4j, then put log4j.jar into class path along with log4j.properties. Since log4j has almost become a standard these days, I would advice using that.