Posts

Showing posts from October, 2011

Oracle database connection by Java - timezone error

Error I got : Error from db_connection.java -->> java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-01882: timezone region  not found ORA-00604: error occurred at recursive SQL level 1ORA-01882: timezone region  not found Prev code:     public Connection getOracle() throws Exception {         Connection conn = null;         Class.forName("oracle.jdbc.driver.OracleDriver");         conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:tap", "username", "pw");         return conn;    } new Code:     public Connection getOracle() throws Exception {         TimeZone timeZone = TimeZone.getTimeZone("Asia/Kolkata");         TimeZone.setDefault(timeZone);         Connection conn = null;         Class.forName("oracle.jdbc.driv...

my tribute to Dennis Ritchie

News: Dennis Ritchie, father of C programming language and Unix, dies at 70 !! ;( :'( Dennis MacAlistair Ritchie. The man who created C with Kevin Thompson. Who helped develop UNIX. One of the greatest computer engineers ever. here i text some words to remind our memories for this great technologist... We need to remember that C and UNIX spawned a revolution in the computer industry. Every subsequent software owes something to these two... his words about them: C++ and Java, say, are presumably growing faster than plain C, but I bet C will still be around. - Dennis Ritchie UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity. Dennis Ritchie For those of us running Mac OS X, iOS, Android and many other non-Windows OS, we have him to thank. Many of those running Windows do too, as many of the applications you're using were written in C..

Escaping special characters in Java replace & > < \

i'm doing part in ETA system, which is a Webservice... So it was needed to replcae some characters form XML data. We have done this before sevaral time inside some methods... But this time as the best practice i write a simple method to do this... hope it might useful to you: Character Reference & &amp; < &lt; > &gt; " &quot; ' &apos; import java.text.CharacterIterator; import java.text.StringCharacterIterator; public class EscapeCharacter {      public static void main(String[] args) {         String str = " sdas\\d\\asa-&-adas-&-das-<-da->-sa ";         System.out.println(str);                         System.out.println(forXML(str));    ...