Re: Bad Timestamp Format

From: Gunaseelan Nagarajan <gnagarajan(at)dkf(dot)de>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Bad Timestamp Format
Date: 2002-01-27 14:22:58
Message-ID: 02012715225800.00750@linux
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Don Baccus 2002-01-27 15:16:40 Re: contrib/tree
Previous Message Hannu Krosing 2002-01-27 11:31:34 Re: contrib/tree

Browse pgsql-jdbc by date

  From Date Subject
Next Message Thomas O'Dowd 2002-01-28 01:29:39 Re: Bad Timestamp Format
Previous Message Thomas O'Dowd 2002-01-27 05:50:13 Re: Bad Timestamp Format