• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic