• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Retriving time from Oracle database in JSP

 
Greenhorn
Posts: 10
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I need to display certain column from Oracle database. But the columns for stime, etime and reservedate doesn't display in my jsp page.
I use data type timestamp in those three columns.

My program throw an exception "Exception is ;java.sql.SQLException: Invalid column name"



My servlet code snippet.




Here is my jsp code

 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome.

Your error is "invalid column name". Have you tried the run the query directly in Oracle? Does the table have those column names?

I'm not aware that Oracle can just store time. Usually the type is date with timestamp.

check out this if you are using Oracle 11g. The extract() function may be your answer.
 
Ummu Hanisah
Greenhorn
Posts: 10
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

K. Tsang wrote:Welcome.

Your error is "invalid column name". Have you tried the run the query directly in Oracle? Does the table have those column names?

I'm not aware that Oracle can just store time. Usually the type is date with timestamp.


I've already run the query in Oracle and it did display the data on those column.
Yup, Oracle store both date and timestamp and it can also show only the time.

 
K. Tsang
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right. Then you need to assign a (column) name to those to_char() columns. Because java doesn't know.

select ..., to_char(stime, 'HH24:MI:SS') stime, to_char(etime, 'HH24:MI:SS') etime from ...
 
Ummu Hanisah
Greenhorn
Posts: 10
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot!

At first I encounter exception "Session Time Zone not set!".
Now it works fine. Finally I can move to my next module.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic