Sql Timestamp converter problem in Tomcat
Hi all,
I have a table that one of the columns is an Oracle date type. So, I use SQL Timestamp converter in static text that is bound to the column. Here I want to display only the time part of the field, so in the converter properties I changed the pattern to HH:mm (for 24 hours format), and the type property I changed to time only.
Everything is perfect in development using sun app server. Problem is when I deploy that to Tomcat, the column displays 00:00 regardless of the real value. Tried to change the property of the converter, but has no effect.
The differences between sun app and tomcat besides the application server is the jdbc driver. The Tomcat uses Oracle JDBC driver.
Could someone give me some solution about that?
Thanks in advance.
You should try changing java.sql.Timestamp to java.util.Calendar.
java.util.Calendar maps to the dateTime type in XML Schema, and TIMESTAMP as a JDBC type.
Regards,
Mike Wooten
Similar Messages
-
Converting sql timestamp into a usable java format??
hi there.
does anyone know how to convert an sql timestamp into a usable java format? i have retrieved a timestamp from a mysql table in a jsp script and would like to convert it into the following format:
12:42pm | 08.07.02
as i understand it, i'll need to convert the timestamp into seconds since 1970 and then manipulate it as a calendar object? my first line is working, but i don't know what to do after...
java.sql.Timestamp sqlTimestamp = resultSet.getTimestamp("date_and_time");
next...?
any help would be much appreciated!!
thanks.please excuse my java sytnax ignorance, but i've tried a bunch of different syntax arrangements and can't figure out how to use the getTime() method. what comes after my first line there?
java.sql.Timestamp sqlTimestamp = resultSet.getTimestamp("date_and_time");
then something like:
long msec=date.getTime(sqlTimestamp);
but that doesn't seem to work...
thanks for any help! -
Convert java.sql.Timestamp to java.util.Calendar?
What's the best way to convert java.sql.Timestamp to java.util.Calendar?
Use Calendar's setTime(Date date) method.
java.sql.Timestamp extends java.util.Date.
-Roy -
Problem displaying oracle.sql.timestamp columns
When displaying table contents using the editor, column values of type oracle.sql.timestamp show up as "<error>". In the "SQL Results" window, for colunms of this type, the column value shows only "oracle.sql.TIMESTAMP. Does anyone know if there is a fix for this problem. Thanks. -Chuck
I've had the same problem, I would think that there would be support for JDBC time with a timezone. -Derek
-
Problem saving java.sql.timestamp
I am using java.sql.timestamps for all date fields inside the database.
the client program is using a session bean to insert the data into the database. Afterwards when I do a select in sql plus the date is always 2 hours and 30 minutes above the value I supplied to the database.
Are there any timezone settings I have to supply on the server ?
thx in advance
nullPlease shrink your code down to the bare minimum that compiles and demonstrates the problem. Do not include any tests that pass. Just the one that fails, and describe clearly exactly how it fails--what's expected and what is observed instead.
You can probably even get rid of the separate test class and just put it all in main, or at least all in the same class with main and one or a small handful of other methods. -
How do I return a java.sql.Timestamp data type in a Web service?
I'm new to workshop and java. I'm creating a mini application to simulate a real work Web Service (development environment is on an intranet). I was able to completely simulate the Web Services minus all date values.
I'm using a standard weblogic workshop database controls that are feeding the various WebServices and their methods (Web services was generated from DB control). I get a java type not support error when I attempt to return a java.sql.Timestamp. I temporarily got around the problem by omitting all dates from the sql.
However, we are at the point where we need the complete record.
My two questions
1) What java data type do I convert the java.sql.Timestamp to
2) Where and how do I do it in workshop.
Thanks in advance
Derrick
Source view from workshop looks something like this.
public interface MyData extends DatabaseControl, com.bea.control.ControlExtension
static public class dbOverallRec
public String key;
public String field1;
public int field2;
public java.sql.Timestamp create_date
public dbOverallRec () {};
*@jc:sq; rowset-name="OverallRowSet" statement::
*select key, field1, field2 ,create_date from overall where key={KEY}::
dbOverallRec getOverallByKey(String Key);
* I had to omit the create_date to get it to workYou should try changing java.sql.Timestamp to java.util.Calendar.
java.util.Calendar maps to the dateTime type in XML Schema, and TIMESTAMP as a JDBC type.
Regards,
Mike Wooten -
Error while calling data service: ClassCastException: oracle.sql.TIMESTAMP
I created a data service out of an Oracle datastore (table) which has a number of TIMESTAMP columns and deployed it in Axis2
When testing the Web Service in Designer, I get this error and can't find any solution:
com.sunopsis.wsinvocation.SnpsWSInvocationException: oracle.sql.TIMESTAMP cannot be cast to java.util.Date
at com.sunopsis.wsinvocation.client.a.a.d.requestReply(d.java)
at com.sunopsis.graphical.wsclient.f.b(f.java)
at com.sunopsis.graphical.tools.utils.swingworker.v.call(v.java)
at edu.emory.mathcs.backport.java.util.concurrent.FutureTask.run(FutureTask.java:176)
at com.sunopsis.graphical.tools.utils.swingworker.l.run(l.java)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:534)
Caused by: oracle.sql.TIMESTAMP cannot be cast to java.util.Date
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:1792)
at com.sunopsis.wsinvocation.client.a.a.d.a(d.java)
... 8 more
Caused by:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: oracle.sql.TIMESTAMP cannot be cast to java.util.Date
faultActor:
faultNode:
faultDetail:
{}stackTrace:java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.util.Date
at com.sunopsis.data.transform.impl.DataTransformerUtilDate2SqlTimestamp.from(DataTransformerUtilDate2SqlTimestamp.java)
at com.sunopsis.data.transform.impl.generic.DataTransformerReverser.to(DataTransformerReverser.java)
at com.sunopsis.data.transform.impl.generic.DataTransformerIfNullThenExceptionWrapper.to(DataTransformerIfNullThenExceptionWrapper.java)
at com.sunopsis.data.transform.impl.generic.DataTransformerCombiner.to(DataTransformerCombiner.java)
at oracle.odi.dataservices.fwk.axis2.OMSerializer.objectToXsd(OMSerializer.java)
at oracle.odi.dataservices.fwk.axis2.OMSerializer.serializeManagedEntity(OMSerializer.java)
at oracle.odi.dataservices.fwk.axis2.OMSerializer.serializeManagedEntityList(OMSerializer.java)
at oracle.odi.dataservices.fwk.axis2.OMSerializer.serializeOMElement(OMSerializer.java)
at oracle.odi.dataservices.fwk.axis2.DataServicesMessageReceiver.invokeBusinessLogic(DataServicesMessageReceiver.java)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:39)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:144)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:279)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:116)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
at java.lang.Thread.run(Thread.java:619)
oracle.sql.TIMESTAMP cannot be cast to java.util.Date
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:1792)
at com.sunopsis.wsinvocation.client.a.a.d.a(d.java)
at com.sunopsis.wsinvocation.client.a.a.d.requestReply(d.java)
at com.sunopsis.graphical.wsclient.f.b(f.java)
at com.sunopsis.graphical.tools.utils.swingworker.v.call(v.java)
at edu.emory.mathcs.backport.java.util.concurrent.FutureTask.run(FutureTask.java:176)
at com.sunopsis.graphical.tools.utils.swingworker.l.run(l.java)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:534)What database are you doing this with?
B -
Usage of java.sql.Timestamp with classes12.zip and ojdbc14.jar ?
Hi all,
If i'm using java.sql.Timestamp with classes12 it is functioning perfectly,
if i'm using ojdbc14 and java.sql.Timestamp it is functioning in different way and failing to do the action..
Example : update set xxx=yy where time = my Timestamp object set in Prepared statement
Hope to see the answerhttp://forum.java.sun.com/thread.jspa?threadID=460615&messageID=2116517
Timestamp insert problem
Using the "classes12.zip" file that comes with the distribution for Oracle versions 8.1.6.x and 8.1.7.x, Oracle's DATE datatype is mapped to the "java.sql.Timestamp" class. However, the "ojdbc14.jar" driver maps DATE to "java.sql.Date", and "java.sql.Date" only holds a date (without a time), whereas "java.sql.Timestamp" holds both a date and a time. -
PL/SQL package converted to java
Hi everyone!
I have a question. Has anyone use this function of jdeveloper?
I mean the option of take a PL/SQL and convert it to .java with jDeveloper 11gTP4.
I´m prooving it, and I´m having some problems with the code that jdeveloper insert.
sqlj.runtime.ref.DefaultContext __sJT_cc = getConnectionContext();
if (__sJT_cc==null)
sqlj.runtime.error.RuntimeRefErrors.raise_NULL_CONN_CTX();
If someone have experience with this? ....
Thanks,
RowanSorry for not explaining well
After this code:
sqlj.runtime.ref.DefaultContext __sJT_cc = getConnectionContext();
if (__sJT_cc==null)
sqlj.runtime.error.RuntimeRefErrors.raise_NULL_CONN_CTX();
I´ve got the next error:
ADVERTENCIA: java.lang.NullPointerException
javax.faces.el.EvaluationException: java.lang.NullPointerException
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
My app, is a table and a button to modify a Row.
Rowan -
RE: Database (SQL-SERVER) access problem
Have you used NT Control Panel/ ODBC to set up the ODBC data source name?
You have to define the data source (database) SecTrade as well as the
driver to be used (SQL Server). This can be done by selecting the Add
button on the Data Sources screen in Control Panel/ ODBC.
Hope this helps.
Sanjay Murthi
Indus Consultancy Services, Inc.
From: Administrator
Sent: Wednesday, August 13, 1997 6:49 PM
To: "'[email protected]'"
Cc: murthis; thyagarajm; thyagarm; vasasm; chandraa
Subject: Database (SQL-SERVER) access problems
MCI Mail date/time: Mon Aug 11, 1997 10:28 pm EST
Source date/time: Mon, 11 Aug 1997 19:25:34 +0530
Hi Forte-Users,
We have a setup a Sql-Server database on a NT server. In the Forte
EConsole,
we have
setup a ODBC-type Resource for this server, named SERVER2_ODBC. This NT
server
is configured as a Client Node in the active Forte environment. Note
that
Server2 is not
the Forte server, but has Forte installed. There is another NT server
which
acts as the
Forte server. NODEMGR and Sql-Server are running on SERVER2.
In our application, we have a DBSession SO with the database source
as SERVER2_ODBC, Userid=ForteInstructor. When running the application,
Forte
throws an exception, the gist of it being as follows:
USER ERROR: (This error was converted)
Failed to connect to database: SecTrade, username: ForteInstructor.
[Microsoft][ODBC Driver Manager] Data source name not found and no
default
driver specified
We have tried
1) Installing ODBC drivers on the NT server (Server2)
2) Accessing local databases from Forte clients which works fine
3) Accessing the Sql-Server database through Isqlw (Sql-Server Client
s/w) -
It works.
Could someone suggest what we should try to get rid of this problem?
Thanks for any help,
Kishore PuvvadaRajsarawat wrote:
Dear sir/mam,
I have installed sql server 2005 (server) and on another computer installed client. It installed successfully but on client side it does not seen, from where should i start it. so please send me procedure to install sql server 2005 on both side(client and server).You have to turn on network (external to your computer) access.
Under programs->sql server look for "surface" -
Java.sql.Timestamp: does not have a no-arg default constructor ERROR
Hi,
I am using jaxws(jwsdp2.0) and when i use the apt tool I get this error because I use java.sql.Timestamp as one of the fields in a class. What is the workaround for this problem? Any help is appreciated.
Thanks,
VijayI just replaced java.sql.Timestamp to java.util.Date for this to work.
Any other workaround is welcome.
Vijay -
How to get java.sql.Timestamp data from database
Hello, i'm new to EJB and i can't get java.sql.Timestamp data, but when i'm trying to get java.lang.String data it works fine.
* @ejb.finder
* query="SELECT OBJECT(c) FROM userSCHEMA AS c
* WHERE c.lastName LIKE ?1
* AND c.firstName LIKE ?2
* AND c.registeredDate < ?3"
* signature="java.util.Collection findPatient * (java.lang.String lastName,
* java.lang.String firstName,
* java.sql.Timestamp)"
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.sql.Timestamp</method-param>
</method-params>
Where i made a mistake ?The main problem that I'm faced with, is that the
java.sql.Timestamp now has only one constructor, it
takes "long", i.e., milliseconds.That's because a Timestamp is just an offset from a particular instant of time. It doesn't have a timezone.
Please note that I'm not trying to "print", i.e., I'm
not interested in using the SimpleDateFormat.Then what are you interested in? You appear to be trying to create a Timestamp with a particular timezone, which doesn't make sense as I already noted. Is there a reason for this? -
RQL Error - JQuery Datepicker and java.sql.Timestamp
Hello everyone,
I am using JQuery Datepicker to select start and end date range.
Both start date and end date are successfully passed as like this. 10/01/2013 and 10/31/2013
It has java.sql.Timestamp mapping in both startDate and endDate.
Property name in component browser is transactionTimestamp.
It gives me following error when i passed both parameters.
<dsp:droplet name="/atg/dynamo/droplet/RQLQueryForEach">
<dsp:param name="repository" value="/atg/commerce/order/OrderRepository" />
<dsp:param name="itemDescriptor" value="inStorePaymentStatus" />
<dsp:param name="queryRQL" value="transactionTimestamp>=:startDate AND transactionTimestamp<:endDate" />
**** Error Wed Oct 02 16:07:21 IST 2013 1380710241490 /atg/dynamo/droplet/RQLQueryForEach unable to parse/execute query due to RepositoryException CONTAINER:atg.repository.RepositoryException; SOURCE:java.sql.SQLException: java.sql.SQLDataException: ORA-01843: not a valid month
It gives NO error when i passed single parameter.
<dsp:param name="queryRQL" value="transactionTimestamp>=:startDate"/>
can anyone suggest me a solution.
Thanks
saminda konkaduwaHi all,
Found the solution. We have to use parameter converter tools as well. that is the additional parameter called "date" where we passed date format.
<dsp:param name="startDate" param="10/12/2012" date="MM/dd/yyyy"/>
<dsp:param name="endDate" param="10/12/2015" date="MM/dd/yyyy"/>
Explanation :
JSP FILE ( testing.jsp)
=================
<dsp:page>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="merchant_portal_ajax_agent_report.js"></script>
<script type="text/javascript">
$(function() {
$("#startDate").datepicker();
$(function() {
$("#endDate").datepicker();
</script>
</head>
<body>
<table>
<tr>
<td>Start Date</td>
<td><input type="text" id="startDate" class="picker" name="sDate" /></td>
<td>End Date</td>
<td><input type="text" id="endDate" class="picker" name="sDate" /></td>
<td><input value="Find" type="submit" class="atg_button" onclick="loadAgentReport()" /></td>
</tr>
<tr>
<div id="agentReportTable"></div>
</tr>
</table>
</body>
</dsp:page>
JAVA SCRIPT FILE (merchant_portal_ajax_agent_report.js)
============================================
function loadAgentReport() {
var startDateValue = $("#startDate").val();
var endDateValue = $("#endDate").val();
$(document).ready(function() {
$.ajax({
type : "POST",
url : "merchant_portal_view_agent_report.jsp",
data : {
startDate : "" + startDateValue + "" , endDate : "" + endDateValue + ""
success : function(result) {
$("#agentReportTable").html("");
$("#agentReportTable").html(result);
JSP File ( This invoked by Jquery ) merchant_portal_view_agent_report.jsp
=======================================================
<dsp:page>
<dsp:droplet name="/atg/dynamo/droplet/RQLQueryForEach">
<dsp:param name="repository" value="/atg/commerce/order/OrderRepository" />
<dsp:param name="itemDescriptor" value="inStorePaymentStatus" />
<dsp:param name="queryRQL" value="agentId=:agentId AND transactionTimestamp>:startDate AND transactionTimestamp<:endDate" />
<dsp:oparam name="output">
<dsp:valueof param="element.transactionId"/> <dsp:valueof param="element.transactionStatus"/>
</br>
</dsp:oparam>
<dsp:oparam name="empty">
No data found
</dsp:oparam>
</dsp:droplet>
</dsp:page>
Thanks
saminda konkaduwa -
Session problems in tomcat 5.0.28
Even I shutdown the tomcat 5.0.28 server the session variable is still existing and it is showing the old values. What I have to do to disable the old values? Is it the problem with tomcat 5.0.28 or with JSP coding!
Tomcat serializes sessions to the hard drive when it shutsdown. If you don't want this you have three choices:
1: you can disable this functionality in the server.xml. Check the documentation.
2: you could just delete the session.ser file when you shut down tomcat. This file is under work/standalone/{webapp name}
3: you could close and re-open the browser so that the old jsessionid will not be sent and a new session will be created. The old session will eventually time out.
The third option is probably the easiest. -
Java.sql.Timestamp and the Epoch
Hello all
according to the JavaDoc for Timestamp, the long parameter of the constructor represents "milliseconds since January 1, 1970, 00:00:00 GMT". However, running
class Main
public static void main (String [] args)
System.out.println (new java.sql.Timestamp (0l));
} produces 1970-01-01 01:00:00.0, which is 3.6 million ms since the time stated in the doc.
My box is set to GMT. Does anyone know of an explanation for this?
CheersI'd say that extra hour is the daylight savings hour.
The GMT timezone uses it, but UTC ( Universal time coordinates ) doesn't.
regards,
Owen
Maybe you are looking for
-
How can we transfer games from ipod 4 to a different ipod 4
how can we transfer games from ipod 4 to a different ipod 4??
-
Retina Pro 13" 10.8 Facebook click to post does nothing.
This is a brand new laptop, just got it like 3 days ago. The notifications center has the click to face book button, and I"m receiving notificaitons from facebook. But when i click on the "Click to post" for facebook, it does absolutely nothing. What
-
Can I change the background color (from black) for a slideshow created in iPhoto '11 ? Just want to make sure I'm not missing something before I purchase Aperture (where that option is available). Thanks
-
Evaluating an arbitrary length boolean logic expression
Is it possible to have labview evaluate a boolean expression of arbitrary length and complexity, which would be input by the user. Storage format of the expression isn't necessarily important. Use of the attached vi might provide some help for evalua
-
Scheduling infocube activation in background
It is taking too long and timeout when I tried to activate a SAP delivered InfoCube. Can this be scheduled in background job?