Reshma Rangarajan

Greenhorn
+ Follow
since Nov 02, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Reshma Rangarajan

Hi,

I am supposed to generate the current date in the below format and then set it onto an XML before consuming a web service.
2011-04-26T16:52:57-05:00

By Using this code snippet below am able to generate the date without the 'T' and offset information.

SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss-05.00");
Date now = new Date();
String strDate = sdfDate.format(now);

I was able to get an output as 2011-08-25 02:22:10-05.00

Can someone please let me know how to get the 'T' between the Date and Timestamp.

Thanks in Advance,
Reshma
12 years ago
that was spot on. Initializing the second prepareStatement solved my issue.

iStatement = conn.prepareStatement(insertString);

I have used two different prepared statements now for query and insert.

PS: billNumbers was an array of 'Long' values.

Thanks a lot to all of you for the help.
Hi,

I am trying to do an insert into table using PreparedStatement. I get a java.lang.ArrayIndexOutOfBoundsException: 1 exception at pStatement.setString(2, id);. Here's the code and stack trace. Can someone please let me know whats the bug in this code. Thanks in advance

[/code][/code]



java.lang.ArrayIndexOutOfBoundsException: 1
at oracle.jdbc.dbaccess.DBDataSetImpl._getDBItem(DBDataSetImpl.java:378)

at oracle.jdbc.dbaccess.DBDataSetImpl._createOrGetDBItem(DBDataSetImpl.j
ava:781)
at oracle.jdbc.dbaccess.DBDataSetImpl.setBytesBindItem(DBDataSetImpl.jav
a:2449)
at oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStat
ement.java:1190)
at oracle.jdbc.driver.OraclePreparedStatement.setString(OraclePreparedSt
atement.java:1610)
at com.comp.sample.datalayer.SampleInsert.testInsert(Unknown Sourc
e)
Naren, Thanks for replying.

I cannot use xsd:string for a date element. Its against the standards that my company follows

Second, I tried to do it using SimpleDateFormat. However, once the value is set into the XML calendar it was appending either the offset time (like -05:00) or the character 'Z'.

I modfied my code to set xmlDate into the response XML instead of java calendar. Now it is displaying as expected without the trailig 'Z' or the offset.

Thanks,
Reshma

13 years ago
Hi,

Scenario: I am trying to get a date value from database and set it into a VO and then finally set it into an XMLschema field.

The first out stmt prints: 2009-01-06 which is fine.
The second out stmt prints: 2009-01-06Z which may be expected but i dont want the trailing Z to be there. Basically, this system will be called by an external system. so i dont want the xml date to have this trailing Z in place.

Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
Date date = resultSet.getDate("billDate", Calendar.getInstance());
cal.setTime(date);
billDetailVO.setLatestBillDate(cal);
System.out.println("Recent Bill Date is - " + billDetailVO.getLatestBillDate().toString());

billDetailT.setLatestBillDate(billDetailVO.getLatestBillDate());
System.out.println("Recent Bill Date is - " + billDetailT.getLatestBillDate().toString());


Can someone help me here please. I am new to this area. Let me know if i have missed some information.
Also, Please let me know if this question does not belong in this section.

Thanks,
Reshma
13 years ago
Hi,

Scenario: I am trying to get a date value from database and set it into a VO and then finally set it into an XMLschema field.

The first out stmt prints: 2009-01-06 which is fine.
The second out stmt prints: 2009-01-06Z which may be expected but i dont want the trailing Z to be there. Basically, this system will be called by an external system. so i dont want the xml date to have this trailing Z in place.

Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
Date date = resultSet.getDate("billDate", Calendar.getInstance());
cal.setTime(date);
billDetailVO.setLatestBillDate(cal);
System.out.println("Recent Bill Date is - " + billDetailVO.getLatestBillDate().toString());

billDetailT.setLatestBillDate(billDetailVO.getLatestBillDate());
System.out.println("Recent Bill Date is - " + billDetailT.getLatestBillDate().toString());


Can someone help me here please. I am new to this area. Let me know if i have missed some information.
Also, Please let me know if this question does not belong in this section.

Thanks,
Reshma

My eclipse version is 3.6 and i cannot find the Dynamic web project option in 'Other'. However, i did see that option when i installed eclipse 3.6.1 . Now the problem is that i have to use weblogic 8.1 which works with java 1.4 but eclipse 3.6.1 requires java 1.5 or higher. So i tried to install the WTP plugin into my eclipse 3.6. But it stops with errors saying that some prerequisites are not met.
I am not very familiar with this area, so appreciate any help on this.

Installed eclipse 3.6.1, JDK1.4 and Weblogic 8.1. Then found out that eclipse 3.6.1 is only for JDk1.5 and weblogic 8.1
is for JDK1.4. So I reinstalled eclipse 3.6 which is compatible with JDK1.4. Now when i try to click on the eclipse exe icon to fireup
eclipse it was giving the error like 'No JRE or JDK found ....'. So i went back and made sure that my PATH and JAVA_Home variables are pointing to the right dir. Now it fires up. I want to test a simple jsp, but i cannot see a web project option under the File -> New -> Other menu. Any idea?

- Thanks, Reshma