Difference: OracleBasics (6 vs. 7)

Revision 703 Dec 2002 - TobyCabot

Line: 1 to 1
 
META TOPICPARENT name="DatabaseTips"
The Oracle graphical console is called oemapp. You'll most likely want to run oemapp dbastudio, make sure that X is working first.
Line: 42 to 42
 execute dbms_transaction.purge_lost_db_entry( ' local id from previous query ');
commit; (don't forget this!)
Added:
>
>

Java and Oracle Dates

Kind of a mess. Try to use bind variables, but if you're building SQL strings then you'll have to format things explicitly on both the Java side and the Oracle side in order to be sure that the formats agree.
 
Changed:
<
<
-- TobyCabot - 23 May 2002 - 08 Nov 2002
>
>
	 static final String DB_DATE_FORMAT = "yyyy-MM-dd H:mm:ss";
	 SimpleDateFormat dateFormat = new SimpleDateFormat(DB_DATE_FORMAT);
	 Date now = new Date();
	 String nowString = dateFormat.format(now);

Now in the query itself you need to format the date (again):

"to_date(" + nowString + ", 'YYYY-MM-DD HH24:MI:SS')"

Here's the javadoc on SimpleDate: http://java.sun.com/j2se/1.4.1/docs/api/java/text/SimpleDateFormat.html

Here's the Oracle doc on Date Element Conversion Strings: http://download-west.oracle.com/docs/cd/A97630_01/server.920/a96540/sql_elements4a.htm#34950

-- TobyCabot - 23 May 2002 - 03 Dec 2002

View topic | History: r8 < r7 < r6 < r5 | More topic actions...
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding The Caboteria? Send feedback