jdbc

How to check the Database Connection leakage in J2EE application ?

Is there anyway to check the Connection leakage in J2EE application ? The application is running on my local machine. It uses MySQL database. User Enters his details into the Database. In my opinion Connection leakage means not closing the Connection object properly. I am creating too many Database connections in my application. I want...

how to pass NULL to parameter map in iBatis

I am trying to pass null to a parameter map but I keep getting error saying: --- Check the parameter mapping for the 'something' property. How I cam calling code: HashMap myMap = new HashMap () myMap.put("something", null) getSqlMapClientTemplate().queryForList("list_of_sps.getByLastNameExactMatch", myMap ); My Mappings: <proc...

How do I use JDBC's data source?

I've tried researching how to use the DataSource method of connecting to a database but never could find out how. I know that a DataSource is first configured and registered to JNDI in an application that is separate from the user application, and all the user application will do is retrieve it using JNDI. What I don't understand is wher...

What do I need to use SQLite in Java?

I'm using SQLite for a simple attendance tracking application to be implemented in Java. I am using the driver found in http://www.zentus.com/sqlitejdbc and I want to know if i need the dll's still or if i only need the jar i retrieved from the site. ...

msql table name with $ sign

I have tables in Mysql 5 db with names prefixed with a dollar sign '$' ie tablename $MYTABLE I am using Spring 3.0 JdbcTemplate to do my select query but couldn't get it to work. ie String tablename = "$AAPL"; private static final String STOCK_SELECT = "select symbol, open, high, low, close, vol, ev from ?"; jdbcTem...

How can I see the generated SQL from my Spring StoredProcedure?

I have an org.springframework.jdbc.object.StoredProcedure which I am using to call a DB function. I want to be able to see the generated SQL. I am calling org.springframework.jdbc.object.SqlCall.getCallString() on my StoredProcedure object but this returns a String with ? characters in place of the parameters. How can I get the com...

JDBC Connection Pooling: Connection Reuse?

As per my understanding, JDBC Connection Pooling (at a basic level) works this way: create connections during app initialization and put in a cache provide these cached connections on demand to the app a separate thread maintains the Connection Pool, performing activities like: discard connections that have been used (closed) create ...

Spring Framework JDBC DAO with agrgegation/composition

I have an application that is already using the Spring Framework and Spring JDBC with a DAO layer using the SimpleJdbcTemplate and RowMapper classes. This seems to work very well with small class structures being read from the database. However, we have the need to load objects that hold collections of other objects, which hold collectio...

Randomize database row results

I've been finding some unit tests that assume that the results of database queries are in a particular order, yet the query being run doesn't include an order by clause. I would like to find more of these unit tests, so that I can examine whether the test is at fault in its assumptions, or the code is at fault in its lack of specifying ...

Java library for reading database schema

I'm looking for a lightweight, open source, more or less cross-database Java library that would allow me to read off metainformation on columns, tables and integrity constraints given a DataSource. ...

Dynamically create Blob in DB2 Java stored procedure

I would like to return some data as a Blob from a DB2 stored procedure written in Java. This is the code to generate the procedure on the DB2 server: CREATE PROCEDURE CLUB.P_CLUB_GET_BACKUP ( IN CLUBID INTEGER, IN BNR INTEGER, OUT BACKUP BLOB(50000000) ...

What files needed for JDBC connection to MySQL?

I get the following error when attempting to connect to the MySQL database on my employer's local server: Unable to load database driver Details : java.lang.ClassNotFoundException: com.mysql.jdbc.Driver BUILD SUCCESSFUL (total time: 0 seconds) I think it's pretty clear that this is because I don't have my files set up properly....

Multiple row insert in sql server from java

I need to insert multiple row's into sql server database (100 at a time) from my java code. How can i do this..? Currently i am inserting one by one and this does not look efficient... Kaddy ...

Reading Unicode Text from Java ResultSet

how to read unicode text from java resultset? ...

how to check for duplicate entries in database?

I need to apply a check so that a user cannot register using an email id which already exists in the database. ...

How to Configure SSL in the Informix Database in a Web Application?

Hi, I have posted the same question 2 month ago here and lot of nice people helped me. I was able to go through all the instructions mentioned in the link below to set up the ssl connections.Below are the links: Configure connections to the data source to use SSL. (link1) Configure your Java Runtime Environment to use SSL. (link2) I...

java PreparedStatement

How to set value for in clause in a preparedStatement in JDBC while executing a query. Example. mPreparedStatement = connection.prepareStatement("Select * from test where field in (?)"); If this inclause can hold multiple values how can I do it.Sometimes I know the list of parameters beforehand or sometimes I don't know beforehand.Ho...

Spring commits when it should not ? (related to Oracle autocommit)

I have an interface like below public interface FooDAO { public void callA(String x); } and an implementation as below deliberately making readonly true and not supported public class FooDAOImpl implements FooDAO { //for testing @Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED) public void callA(Strin...

Have Oracle automatically roll back abandoned sessions?

Is there any way to guarantee that an application won't fail to release row locks in Oracle? If I make sure to put commit statements in finally blocks, that handles the case of unexpected errors, but what if the app process just suddenly dies before it commits (or someone kicks the power cord / lan cable out). Is there a way to have Ora...

Java JDBC Oracle 9i upgrade to 10g issues...

We have just upgrade from oracle 9i to 10g and a database query I have works with the 9i client but not the 10g. Nothing in the query has changed. I get the following error: java.sql.SQLException: ORA-01036: illegal variable name/number Not really sure what is going on. Why wouldn't it run anymore. It's just a select statement which j...