Posted by: ahmedashfaque | January 6, 2015

Database connection issues

In good old days (they are still good if you work on tight technologies) working with an Oracle or SQL server database was never was a problem. You always have one connection string and a single database driver. So whatever software product you are developing, you never have to worry about database connection from you application.

Enter some lightweight databases like Apache Derby and you are immediately in for a lot of problems. The Derby database comes in different versions: the embedded one, the network one or the client version. For each version, the driver gets changed. For example you have org.apache.derby.jdbc.EmbeddedDriver for embedded version and org.apache.derby.jdbc.ClientDriver driver for client version. Generally as a developer you never too sure which version of Derby you are using. So you end up maintaining the wrong driver string in your source code (it is always the case. Isn’t it?). Now if you test your web application on a web application server, you get null pointer exception and you application throws error. There is no detailed explanation (the application server log just points to many java and jar files in the JRE which is beyond your comprehension to decipher). If you google it you will never find a suitable solution.

If the database driver is not enough of a problem then there is more headache waiting for you. The connection string may be something like jdbc:derby://localhost:1527/MyDB. But if you check in the Derby properly you get a string like jdbc:derby:C:\Users\xyz\MyDB;create=true. Since you are getting error, you check these things but it does not help. You just keeping breaking you head but you never get a solution to your problems.

Since installing SQL server or Oracle database on your local machine is a headache (it takes lot of disk space and slows your PC) people think of using lightweight databases like Derby. But instead of saving your efforts and disk space, you end up wasting your time.

If you have any experiences in this are then please share!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: