Wednesday, August 24, 2011

Finding Oracle DB Version

How do you find the Oracle DB version using SQL query?
Connect to the Oracle DB and run following SQL Query:

select * from v$version

Typical output:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
"CORE 10.2.0.4.0 Production"
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production

Friday, August 19, 2011

File Encodings, Character sets and JVM

I wanted to determine the type of file and its encoding (ASCII/Unicode) etc.
Found this link helpful: http://www.cyberciti.biz/faq/linuxunix-determine-file-type/

Further I also wanted to check the default character set supported by the Solaris system and used by the JVM at run-time. The primary reason behind checking this was the unusual behavior of the Java function RandomAccessFile.writeChars.

From the Javadocs, writeChars is always supposed to write characters as a two-byte value. But I observed that on one system it generated an ASCII file while on another it generated a Unicode file. Since I wanted to generate an ASCII file, I switched to using writeBytes.

But the mystery below is unsolved and is for a later date:
On Solaris box A (SunOS 5.10): RandomAccessFile.writeChars was writing ASCII characters
On Solaris box B (SunOS 5.9): RandomAccessFile.writeChars was writing UNICODE characters

I used the program here as a reference for finding the default system character set.
Solaris Box A (using JDK 1.6 Update 11) provided the output:
Default Charset=ISO-8859-1
file.encoding=ISO8859-1
Default Charset=ISO-8859-1
Default Charset in Use=ISO8859_1

Solaris Box B (using JDK 1.6 Update 26) provided the output:
Default Charset=US-ASCII
file.encoding=ISO646-US
Default Charset=US-ASCII
Default Charset in Use=ASCII