Re: Bad Timestamp Format

Поиск
Список
Период
Сортировка
От G.Nagarajan
Тема Re: Bad Timestamp Format
Дата
Msg-id NFBBIOPECKPCJJHHBOGJCEEICLAA.gnagarajan@dkf.de
обсуждение исходный текст
Ответ на Re: Bad Timestamp Format  ("Thomas O'Dowd" <tom@nooper.com>)
Список pgsql-jdbc
Hi Tom,

I use a "Select * from table" and no to_char() functions. I will post
the same question to the jboss-mailing list and see if anyone there
has had the same problem. It could also be a feature of the JBoss
resultset implementation.

Regards,
Nagarajan.

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Thomas O'Dowd
Sent: Monday, January 28, 2002 2:30 AM
To: Gunaseelan Nagarajan
Cc:
Subject: Re: [JDBC] Bad Timestamp Format


Hi Nagarajan,

I'm not familiar with jboss, but I just tried messing with an old
7.1.2 database that I had lying around and can't get it to return
a short format of a timestamp like "1970-1-1 0:0". The driver
code in 7.1.3 will cause an exception for this short form as you
are getting and the 7.2 driver will just parse the datepart but
not the hour/minute part.

Before changing the new driver code to handle this format, I'd
like to know how you are generating it, so that a) I know it makes
sense to support it and b) that I can test it. Can anyone on the
list let me know how to get the backend to return this short format?

The only way I can think about doing it is using the to_char()
functions which you would have to be explicitly doing??? ie, something
like:

select now(), to_char(now(), 'YYYY-FMMM-FMDD FMHH24:FMMI');
          now           |     to_char
------------------------+-----------------
 2002-01-28 10:26:09+09 | 2002-1-28 10:26
(1 row)

If your select code or jboss is somehow using to_char() to alter the
default timestamp string, its doing something unusual which the driver
doesn't support.

Can anyone add anymore reasons why the backend would be returning
a short timestamp string to the driver, such as specific datestyle
options, a specific locale or other?

Tom.

On Sun, Jan 27, 2002 at 03:22:58PM +0100, Gunaseelan Nagarajan wrote:
> Hi Tom,
>
> I am using PostgreSQL 7.1.3. It was built from the source file
> by using ./configure --with-java etc. I used the jdbc source that comes
> along with the source and did not download it seperately.
>
> Here is my java environment.
>     JDK 1.3.10
>     JBoss 2.4
>
> I use the following code for inserting the date value
>
>     public String giveInsert(Calendar cal)
>         throws Exception{
>         String colValue = "";
>         colValue =  "'" + cal.get(Calendar.YEAR) + "-"
>             + ( cal.get( Calendar.MONTH ) + 1 ) + "-"
>             + cal.get(Calendar.DAY_OF_MONTH) + " "
>             + cal.get( Calendar.HOUR_OF_DAY ) + ":"
>             + cal.get( Calendar.MINUTE ) + "'";
>
>         return colValue;
>     }
>
> For retreiving from the database, I use the following code
>
>     public Calendar takeFromResultSet(ResultSet rs, String columnName)
>         throws SQLException, Exception{
>      Timestamp ts = rs.getTimestamp(columnName);
>     Calendar c = Calendar.getInstance();
>     if(ts != null)
>             c.set(ts.getYear()+1900, ts.getMonth(), ts.getDate(),
> ts.getHours(),ts.getMinutes());
>         else
>             c = null;
>         return c;
>     }
>
> The database connection comes through the JBoss connection pool handler.
> Maybe that is not setting the required database property?
>
> here is the configuration settings in jboss.jcml
>
> <mbean code="org.jboss.jdbc.XADataSourceLoader"
> name="DefaultDomain:service=XADataSource,name=postgresqlDS">
>     <attribute
>
name="DataSourceClass">org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl</attr
ibute>
>     <attribute name="PoolName">postgresqlDS</attribute>
>     <attribute name="URL">jdbc:postgresql:db</attribute>
>     <attribute name="JDBCUser">root</attribute>
>     <attribute name="Password">japan</attribute>
> </mbean>
>
>
> To get the database connection, I use the following code
>
>         cat.debug("Using jboss pool to get Connection");
>         Context ctx = new InitialContext();
>         javax.sql.DataSource ds =(javax.sql.DataSource)ctx.lookup( jndiName );
>         con = ds.getConnection();
>
> Thanks and Regards,
> Nagarajan.
>
> On Saturday 26 January 2002 14:33, you wrote:
> > hi,
> > I get the following error while retrieving a datetime column using
> > getTimestamp.
> >
> > Bad Timestamp Format at 12 in 1970-1-1 0:0;
> >
> >
> > Bad Timestamp Format at 12 in 1970-1-1 0:0
> >         at org.postgresql.jdbc2.ResultSet.getTimestamp(Unknown Source)
> >         at org.postgresql.jdbc2.ResultSet.getTimestamp(Unknown Source)
> >         at
> >
org.jboss.pool.jdbc.ResultSetInPool.getTimestamp(ResultSetInPool.java:734)
> >
> > regards,
> > Nagarajan.
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Thomas O'Dowd. - Nooping - http://nooper.com
tom@nooper.com - Testing - http://nooper.co.jp/labs

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Thomas O'Dowd"
Дата:
Сообщение: Re: Bad Timestamp Format
Следующее
От: "David De Mizio"
Дата:
Сообщение: Datasource question