NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Converting Date into Oracle SQL timestamp using Netbeans 6.1

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
Wade Chandler
Posted via mailing list.





PostPosted: Fri Nov 21, 2008 6:32 am    Post subject: Converting Date into Oracle SQL timestamp using Netbeans 6.1 Reply with quote

Check out the JDBC specifications. The easiest way for cross DBMS date time etc and some other functions is using the literal escape syntax if you mean at the DB query level. Oracle's date format is nothing like ISO, at least pre 10g (if it even supports ISO dates yet), so I tend to use { ts 'yyyy-mm-dd hh:mm:ss' } where the place holders are self explanatory. At least it sounds like this is what you are asking...maybe I'm wrong. Anyways, the specifications can be downloaded at:
http://java.sun.com/products/jdbc/download.html

Just get the version you need.

Wade

==================
Wade Chandler, CCE
Software Engineer and Developer, Certified Forensic Computer Examiner, NetBeans Dream Team Member, and NetBeans Board Member
http://www.certified-computer-examiner.com
http://wiki.netbeans.org/wiki/view/NetBeansDreamTeam
http://www.netbeans.org



----- Original Message ----
Quote:
From: HASSAN Kamrul <address-removed>
To: address-removed
Sent: Friday, November 21, 2008 12:00:34 AM
Subject: [nbj2ee] Converting Date into Oracle SQL timestamp using Netbeans 6.1


I have a calendar control to select date, after selected date I need to
send this date to Oracle SQL (as Epoch time) query (dataProvider).
Could you tell me how I can do this in Java code.

Here is excerpt of my code: output window shows Error as
"sourceId=form1:calendar1[severity=(ERROR 2), summary=(form1:calendar1:
'11/03/2008' could not be understood as a date.),
detail=(form1:calendar1: '11/03/2008' could not be understood as a date.
Example: Nov 20, 2008 )]"

import com.sun.rave.faces.converter.SqlTimestampConverter;

private SqlTimestampConverter calendar1Converter = new
SqlTimestampConverter(); public SqlTimestampConverter
getCalendar1Converter() {
return calendar1Converter;
}
public void setCalendar1Converter(SqlTimestampConverter stc) {
this.calendar1Converter = stc;
}
public void prerender() {
}
public String button1_action() {
if (calendar1.getSelectedDate() != null) {
try {
System.out.printf("\nTesting value is " +
calendar1.getSelectedDate().toString() + "\n");
Back to top
HASSAN Kamrul
Posted via mailing list.





PostPosted: Fri Nov 21, 2008 6:34 am    Post subject: Converting Date into Oracle SQL timestamp using Netbeans 6.1 Reply with quote

I have a calendar control to select date, after selected date I need to
send this date to Oracle SQL (as Epoch time) query (dataProvider).
Could you tell me how I can do this in Java code.

Here is excerpt of my code: output window shows Error as
"sourceId=form1:calendar1[severity=(ERROR 2), summary=(form1:calendar1:
'11/03/2008' could not be understood as a date.),
detail=(form1:calendar1: '11/03/2008' could not be understood as a date.
Example: Nov 20, 2008 )]"

import com.sun.rave.faces.converter.SqlTimestampConverter;

private SqlTimestampConverter calendar1Converter = new
SqlTimestampConverter(); public SqlTimestampConverter
getCalendar1Converter() {
return calendar1Converter;
}
public void setCalendar1Converter(SqlTimestampConverter stc) {
this.calendar1Converter = stc;
}
public void prerender() {
}
public String button1_action() {
if (calendar1.getSelectedDate() != null) {
try {
System.out.printf("\nTesting value is " +
calendar1.getSelectedDate().toString() + "\n");
Back to top
HASSAN Kamrul
Posted via mailing list.





PostPosted: Fri Nov 21, 2008 4:31 pm    Post subject: Converting Date into Oracle SQL timestamp using Netbeans 6.1 Reply with quote

Thank you, Wade,

I am using followings in my project.

IDE : Netbeans 6.1 on Java EE 5
Server: Apache Tomcat 6.0.16 (in my PC on Windows XP)
Oracle : 9i
So, user will a date from the calendar Icon (say stored into String
dateSTR),
then I need to use dateSTR as part of query's conditional clause
(to Oracle 9i).
Please tell how can I convert "dateSTR" to Oracle SQLtimestamp so that I
can use it for query.

Sorry! Did not quite follow, what you would want to me to download from
below link, Is there a plug-ins in Netbeans 6.1

Thanks
kam

-----Original Message-----
From: Wade Chandler [mailto:address-removed]
Sent: Friday, November 21, 2008 12:33 AM
To: address-removed
Subject: Re: [nbj2ee] Converting Date into Oracle SQL timestamp using
Netbeans 6.1

Check out the JDBC specifications. The easiest way for cross DBMS date
time etc and some other functions is using the literal escape syntax if
you mean at the DB query level. Oracle's date format is nothing like
ISO, at least pre 10g (if it even supports ISO dates yet), so I tend to
use { ts 'yyyy-mm-dd hh:mm:ss' } where the place holders are self
explanatory. At least it sounds like this is what you are asking...maybe
I'm wrong. Anyways, the specifications can be downloaded at:
http://java.sun.com/products/jdbc/download.html

Just get the version you need.

Wade

==================
Wade Chandler, CCE
Software Engineer and Developer, Certified Forensic Computer Examiner,
NetBeans Dream Team Member, and NetBeans Board Member
http://www.certified-computer-examiner.com
http://wiki.netbeans.org/wiki/view/NetBeansDreamTeam
http://www.netbeans.org



----- Original Message ----
Quote:
From: HASSAN Kamrul <address-removed>
To: address-removed
Sent: Friday, November 21, 2008 12:00:34 AM
Subject: [nbj2ee] Converting Date into Oracle SQL timestamp using
Netbeans 6.1


I have a calendar control to select date, after selected date I need
to send this date to Oracle SQL (as Epoch time) query (dataProvider).
Could you tell me how I can do this in Java code.

Here is excerpt of my code: output window shows Error as
"sourceId=form1:calendar1[severity=(ERROR 2),
summary=(form1:calendar1:
Quote:
'11/03/2008' could not be understood as a date.),
detail=(form1:calendar1: '11/03/2008' could not be understood as a
date.
Quote:
Example: Nov 20, 2008 )]"

import com.sun.rave.faces.converter.SqlTimestampConverter;

private SqlTimestampConverter calendar1Converter = new
SqlTimestampConverter(); public SqlTimestampConverter
getCalendar1Converter() {
return calendar1Converter;
}
public void setCalendar1Converter(SqlTimestampConverter stc) {
this.calendar1Converter = stc; } public void prerender() {
}
public String button1_action() {
if (calendar1.getSelectedDate() != null) {
try {
System.out.printf("\nTesting value is " +
calendar1.getSelectedDate().toString() + "\n");
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo