PDA

View Full Version : DB2 <-> JdbcTeamplete queryForObject Performance



xlancer
08-17-2007, 02:12 AM
Hi, Currently i facing a perfomance problem,
i did a login access which access to db2 to retrive the user data according to chapter 11 of spring tutorial, but the Return is kind of slow, i dun know wat happen, any 1 can help me?

Belowis the log File:


2007-08-17 09:58:33,926 INFO [login.LoginDaoJdbc] - Before
2007-08-17 09:58:33,942 DEBUG [org.springframework.jdbc.core.JdbcTemplate] - Executing SQL query [select WUSER_ID, USER_LOGIN, USER_NAME, NRIC, WACCESS_GROUP, CREATED_BY, DATE_CREATED, PASSWORD, IS_LOGIN, LAST_LOGIN, ALLOW_DEL, IS_PASSWORD_CHANGE,STATUS_ID, ALLOW_DEL, IS_LOCK from PTB.TBL_WUSER where USER_LOGIN=? and PASSWORD=?]
2007-08-17 09:58:33,942 DEBUG [org.springframework.jdbc.datasource.DataSourceUtil s] - Fetching JDBC Connection from DataSource
2007-08-17 09:58:33,942 DEBUG [org.springframework.jdbc.datasource.DriverManagerD ataSource] - Creating new JDBC Connection to [jdbc:odbc:FNAIMS]
2007-08-17 10:00:08,842 DEBUG [org.springframework.jdbc.core.StatementCreatorUtil s] - Setting SQL statement parameter value: column index 1, parameter value [admin], value class [java.lang.String], SQL type unknown
2007-08-17 10:00:09,358 DEBUG [org.springframework.jdbc.core.StatementCreatorUtil s] - Setting SQL statement parameter value: column index 2, parameter value [admin], value class [java.lang.String], SQL type unknown
2007-08-17 10:00:23,853 DEBUG [org.springframework.jdbc.datasource.DataSourceUtil s] - Returning JDBC Connection to DataSource
2007-08-17 10:00:43,353 INFO [login.LoginDaoJdbc] - After


As You Can see, there is around 2min to get the result Set.

My Query Code:



public Object getUser(String user_login, String password) {
log.info(user_login + " " + password);
JdbcTemplate jt = new JdbcTemplate(ds);

log.info("Before");
User user= (User) jt.queryForObject(
"select * from User where LOGIN=? and PASSWORD=?",
new Object[] {user_login, password}, new RowMapper(){

public Object mapRow(ResultSet rs, int rowNum) throws SQLException{

/* setter method here */

}

});
log.info("After");
return user;
}

My Machinse is penium4 2.8 ghz with 1 g of ram.
I am using netBeans and run db2 locally.

Mark Pollack
08-17-2007, 03:16 AM
Hi,

You should post your question to the Spring Java forums (http://forum.springframework.org/), this is forum is for the .NET version. Maybe it takes a long time because you are retrieving a great amount of data? Just a quick guess.

Cheers,
Mark

xlancer
08-17-2007, 09:19 AM
oops!!

i tot this is for wat ever spring....

thanks man.

i solve the problem by changing to remote server environment.

i only have 1 dummy record in db but still consume a lot memory :???:

db2 really :(