Skip to content

Category Archives: Database

Database Surrogate keys Vs Natural keys

Ran into this issue at my client recently and it was hard to convince the db admin why surrogate keys was an advantage for a developer working in an ORM solution Natural key – business requirements changes, then you have to change the natural key – not easy to index an alphanumeric or String value [...]

Debugging MySQL ERROR1025 – Error on rename of

If you ever executed the following command in mysql: alter table table drop column; and got the following error: 1025 – Error on rename of ‘.\\#sql-880_3c’ to ‘.\\ ’ (errno: 150), Don’t panic. It’s probably because you’re trying to drop a column that’s a foreign key. Execute this command: SHOW ENGINE INNODB STATUS to debug more. [...]

Upgrading to Hsqldb 2rc8, part 1, Maven Integration

At my current client engagement, we make full use of hsqldb both in our unit tests and for local development. It’s a great tool, and the changes made since the last release 4 long years ago will make it an even better tool. My project has hundreds of tests making use of hsqldb, and getting [...]

HSQLDB Integration Into Spring Security

Adding a database back end to Spring Security seems deceptively simple. And to be fair, there are several ways to do it. The way I had in mind looked like a shortcut. In my application there is basically one table for all users. It contains the values I need for username, password, role, and the [...]

DBCP vs C3P0

I didn’t know there was a great debate going on between DBCP and C3P0 about 6 months ago going on. My new project is using C3P0 for connection pooling with JNDI-bindable datasources and I find it really annoying to have it configured that way in development. Anyway C3P0 is a project that’s new to me, [...]

Debugging java.sql.BatchUpdateException

If you ever encountered a BatchUpdateException, you probably realized how frustrating it is to debug the same. Unlike a jdbc exception where the stacktrace is fine grained to database errors, Batch exceptions encapsulate all the errors within and throw this rather “useless” message. There is nothing you can do about it unless you want to [...]

HSQLDB Hibernate Improved Logging

This post saved my unit testing today… it’s unfortunate that, after a year, the most current release of HSQLDB does not fix this issue.

Java Integration Testing with HSQLDB

I’m a fairly recent convert to unit testing, but still when I’m under pressure to get something finished, I skip right to integration tests. Despite the guilt I still use the junit framework for these integration tests… I know the unit testing purists will be rolling their eyes at this point, but this is something [...]