My blog has moved! Redirecting...

You should be automatically redirected. If not, visit http://mindsiview.wordpress.com/ and update your bookmarks.

Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Thursday, March 31, 2005

JDatastore: A Small Footprint Java Database

My DBA, Tim Caylor, recently started a blog about his DBA experiences called The Trenches. If you're interested in a small footprint pure Java SQL database take a look at his post on JDatastore.

Tuesday, June 15, 2004

Java Quick Tip of the Day: Selecting Current TimeStamp for DB2

There are times when you may want multiple programs to retrieve a current timestamp from a central location. This can be accomplished by selecting the timestamp from a database server. To return the current timestamp from DB2 execute the following query:

     ResultSet rs;
     rs = stmt.executeQuery("select distinct(current timestamp)
          from sysibm.sysdummy1");
     rs.next();
     java.util.Date today = rs.getTimestamp(1);

Notice that I used a table called "sysibm.sysdummy1". Sysdummy1 is a special purpose table for uses such as this one. Additionally, you can use any db2 table that you have access to.

Friday, June 11, 2004

Java Quick Tip Of the Day: Character Encoding and ResultSets

We recently ran into a problem where a Java program running on our IBM enterprise server was unable to properly display strings returned from a Microsoft SQL Server table. The problem was due to character encoding. Because of the SQL Server table definition, the JDBC driver was not translating the ASCII values in the string returned from a ResultSet.getString() method to EBCDIC. The solution. Explicitly define the encoding by casting the returned value of a ResultSet.getBytes() into a String (see below).
String outStr =  new String(rs.getBytes(1),"ISO-8859-1");
Technorati search