Обсуждение: intervals and jdbc

Поиск
Список
Период
Сортировка

intervals and jdbc

От
Joseph Shraibman
Дата:
If I try to get an interval from postgres via jdbc I get:

No class found for interval
         at
org.postgresql.jdbc1.AbstractJdbc1Connection.getObject(AbstractJdbc1Connection.java:693)
         at
org.postgresql.jdbc2.AbstractJdbc2Connection.getObject(AbstractJdbc2Connection.java:117)
         at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getObject(AbstractJdbc2ResultSet.java:147)

Why can't the interval just be returned as a String?


Re: intervals and jdbc

От
Dave Cramer
Дата:
Joseph,

Can you send me a test case to demonstrate what you are trying to do?

Dave
On Thu, 2002-12-05 at 21:45, Joseph Shraibman wrote:
> If I try to get an interval from postgres via jdbc I get:
>
> No class found for interval
>          at
> org.postgresql.jdbc1.AbstractJdbc1Connection.getObject(AbstractJdbc1Connection.java:693)
>          at
> org.postgresql.jdbc2.AbstractJdbc2Connection.getObject(AbstractJdbc2Connection.java:117)
>          at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getObject(AbstractJdbc2ResultSet.java:147)
>
> Why can't the interval just be returned as a String?
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
--
Dave Cramer <Dave@micro-automation.net>


Re: intervals and jdbc

От
Joseph Shraibman
Дата:
Try this:
select current_timestamp - '2002-12-05 22:14'::timestamp;

Dave Cramer wrote:
> Joseph,
>
> Can you send me a test case to demonstrate what you are trying to do?
>
> Dave
> On Thu, 2002-12-05 at 21:45, Joseph Shraibman wrote:
>
>>If I try to get an interval from postgres via jdbc I get:
>>
>>No class found for interval
>>         at
>>org.postgresql.jdbc1.AbstractJdbc1Connection.getObject(AbstractJdbc1Connection.java:693)
>>         at
>>org.postgresql.jdbc2.AbstractJdbc2Connection.getObject(AbstractJdbc2Connection.java:117)
>>         at
>>org.postgresql.jdbc2.AbstractJdbc2ResultSet.getObject(AbstractJdbc2ResultSet.java:147)
>>
>>Why can't the interval just be returned as a String?
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 5: Have you checked our extensive FAQ?
>>
>>http://www.postgresql.org/users-lounge/docs/faq.html


--
Joseph Shraibman
joseph@xtenit.com
Increase signal to noise ratio.  http://xis.xtenit.com


Re: intervals and jdbc

От
Dave Cramer
Дата:
Joseph,

What do you want it to return, postgres is assuming you want an
interval, but there is no jdbc interval type. What are you expecting it
to return?

Dave
On Thu, 2002-12-05 at 22:15, Joseph Shraibman wrote:
> Try this:
> select current_timestamp - '2002-12-05 22:14'::timestamp;
>
> Dave Cramer wrote:
> > Joseph,
> >
> > Can you send me a test case to demonstrate what you are trying to do?
> >
> > Dave
> > On Thu, 2002-12-05 at 21:45, Joseph Shraibman wrote:
> >
> >>If I try to get an interval from postgres via jdbc I get:
> >>
> >>No class found for interval
> >>         at
> >>org.postgresql.jdbc1.AbstractJdbc1Connection.getObject(AbstractJdbc1Connection.java:693)
> >>         at
> >>org.postgresql.jdbc2.AbstractJdbc2Connection.getObject(AbstractJdbc2Connection.java:117)
> >>         at
> >>org.postgresql.jdbc2.AbstractJdbc2ResultSet.getObject(AbstractJdbc2ResultSet.java:147)
> >>
> >>Why can't the interval just be returned as a String?
> >>
> >>
> >>---------------------------(end of broadcast)---------------------------
> >>TIP 5: Have you checked our extensive FAQ?
> >>
> >>http://www.postgresql.org/users-lounge/docs/faq.html
--
Dave Cramer <Dave@micro-automation.net>


Re: intervals and jdbc

От
Joseph Shraibman
Дата:
Dave Cramer wrote:
> Joseph,
>
> What do you want it to return, postgres is assuming you want an
> interval, but there is no jdbc interval type. What are you expecting it
> to return?
>
I was expecting a String. I had to explicity cast it to text to get it to work.


Re: intervals and jdbc

От
Dave Cramer
Дата:
Really, why a string, I would expect a timestamp, a time, or a date.

ideally this should return a timestamp, as both sides are a timestamp.

Dave
On Thu, 2002-12-05 at 22:29, Joseph Shraibman wrote:
> Dave Cramer wrote:
> > Joseph,
> >
> > What do you want it to return, postgres is assuming you want an
> > interval, but there is no jdbc interval type. What are you expecting it
> > to return?
> >
> I was expecting a String. I had to explicity cast it to text to get it to work.
--
Dave Cramer <Dave@micro-automation.net>