How can i fetch a date datatype from a database ??
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   kumar_john
Posted On:   Sunday, October 28, 2007 02:45 AM

How can i fetch a date datatype from a database ?? when i'm using the following command Date d1=rs.getDate("departuredate"); then i got error like this:- Exception in thread "main" java.sql.SQLException: Column not found at sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(JdbcOdbcResultSet.java:185 0) at sun.jdbc.odbc.JdbcOdbcResultSet.getDate(JdbcOdbcResultSet.java:967) at test1.main(test1.java:18).. when i use this command :- select * from x where from ='bangalore' i got the following error:- Exception in thread "main" java.sql.SQLException: [IBM][CLI Driver][DB2/NT] SQL0 206N &quo   More>>

How can i fetch a date datatype from a database ??

when i'm using the following command

Date d1=rs.getDate("departuredate");


then i got error like this:-
Exception in thread "main" java.sql.SQLException: Column not found
at sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(JdbcOdbcResultSet.java:185
0)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDate(JdbcOdbcResultSet.java:967)
at test1.main(test1.java:18)..


when i use this command :-


select * from x where from ='bangalore'


i got the following error:-



Exception in thread "main" java.sql.SQLException: [IBM][CLI Driver][DB2/NT] SQL0
206N "DEPARTUREDATE" is not valid in the context where it is used. SQLSTATE=42
703
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:2
53)
at test1.main(test1.java:12)



so plz plz tell me how can i fetch date from database.

   <<Less

Re: How can i fetch a date datatype from a database ??

Posted By:   Anonymous  
Posted On:   Friday, December 14, 2007 10:16 AM

from is a reserved keyword.Probably you are mixing that.Check the name of ur column too as it is visible in the exception.
About | Sitemap | Contact