Re: Bad Timestamp Format

Поиск
Список
Период
Сортировка
От Gunaseelan Nagarajan
Тема Re: Bad Timestamp Format
Дата
Msg-id 02012715225800.00750@linux
обсуждение исходный текст
Ответ на Bad Timestamp Format  (Gunaseelan Nagarajan <gnagarajan@dkf.de>)
Ответы Re: Bad Timestamp Format  ("Thomas O'Dowd" <tom@nooper.com>)
Список pgsql-jdbc
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</attribute>
    <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

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

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