Skip to content
Advertisement

Tag: jdbc

What is the difference between JDBC and JDBI?

I want to know about the differences between JDBC and JDBI in java. In particular, which one is generally better and why? Answer (I am the primary author of jDBI) jDBI is a convenience library built on top of JDBC. JDBC works very well but generally seems to optimize for the database vendors (driver writers) over the users. jDBI attempts

How to start a transaction in JDBC?

Connection.setTransactionIsolation(int) warns: Note: If this method is called during a transaction, the result is implementation-defined. This bring up the question: how do you begin a transaction in JDBC? It’s clear how to end a transaction, but not how to begin it. If a Connection starts inside in a transaction, how are we supposed to invoke Connection.setTransactionIsolation(int) outside of a transaction

What type of data structure should I use to hold table rows?

I’m new to Java and just getting into querying databases. So far I have my results in a ResultSetMetaData. I’m think that for each row in the dataset I should add it to some form of collection? Can anyone tell me the best practice for this? Thanks, Jonesy Answer Usually we have a class with fields that correspond to a

java.sql.SQLException: Exhausted Resultset

I get the error java.sql.SQLException: Exhausted ResultSet to run a query against an Oracle database. The connection is via a connection pool defined in Websphere. The code executed is as follows: I note that the resultset contains data (rs.next ()) Thanks Answer I’ve seen this error while trying to access a column value after processing the resultset. Hope this will

How to set application name with JPA (EclipseLink)?

hello everybody i am using JPA with EclipseLink and oracle as DB and i need to set the property v$session of jdbc4 it allows to set an identification name to the application for auditing purposes but i had no lucky setting it up….i have been trying through entitiyManager following the example in this page: http://wiki.eclipse.org/Configuring_a_EclipseLink_JPA_Application_(ELUG) it does not show any

Oracle doesn’t remove cursors after closing result set

Note: we reuse single connection. Answer The init.ora parameter open_cursors defines the maximum of opened cursors a session can have at once. It has a default value of 50. If the application exceeds this number the error “ORA-01000: maximum open cursors exceeded” is raised. Therefore it’s mandatory to close the JDBC resources when they are not needed any longer, in

Advertisement