Blog Archive for September 10, 2010

Database Name on Oracle

September 10, 2010

To find out the name of the current database on Oracle:

SQL> SELECT name FROM v$database;

Tags: oracle name

Enum in Java

September 10, 2010

I've never used an enum in Java before, I've always relied on normal static final ints for constants. There are several disadvantages of this, as spelt out on http://download.oracle.com/javase/1.5.0/docs/guide/language/enums.html:

  • The static final int is not typesafe - you can pass in any old integer constant, or a different int …

Tags: java enum

Uploading Files in a Java Servlet

September 10, 2010

I have a need to upload a file via a Java servlet. I've managed to do that using Apache Commons FileUpload, available at http://commons.apache.org/fileupload/.

To upload a file, you need to declare a form field of type file. This must be within a form which is of type …