Mapping a JDBC ResultSet to an object

If you don’t want to use any JPA provider such as OpenJPA or Hibernate, you can just give Apache DbUtils a try. http://commons.apache.org/proper/commons-dbutils/examples.html Then your code will look like this: QueryRunner run = new QueryRunner(dataSource); // Use the BeanListHandler implementation to convert all // ResultSet rows into a List of Person JavaBeans. ResultSetHandler<List<Person>> h = … Read more

ResultSet: Retrieving column values by index versus retrieving by label

Warning: I’m going to get bombastic here, because this drives me crazy. 99%* of the time, it’s a ridiculous micro-optimization that people have some vague idea makes things ‘better’. This completely ignores the fact that, unless you’re in an extremely tight and busy loop over millions of SQL results all the time, which is hopefully … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)