agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feed[Pljava-dev] select CURRENT_TIMESTAMP is wrong
2+ messages / 0 participants
[nested] [flat]
* [Pljava-dev] select CURRENT_TIMESTAMP is wrong
@ 2008-01-23 12:34
0 siblings, 1 reply; 2+ messages in thread
From: @ 2008-01-23 12:34 UTC (permalink / raw)
Hi,
I have a PostgreSQL 8.1.10 on i486-pc-linux-gnu, compiled by GCC cc (GCC)
4.2.1 (Debian 4.2.1-5), with pljava-i686-pc-linux-gnu-pg8.1-1.3.0.tar.gz
installed.
I try to use CURRENT_TIMESTAMP (now()) from database with this simple
function:
package net.iskranet.java.pljava.test;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Logger;
import java.util.Date;
public class HelloWorld {
private static java.lang.String m_url = "jdbc:default:connection";
public static String helloWorld() throws SQLException {
String query="select current_timestamp";
Logger.getAnonymousLogger().info( "Time is " + new
Date(System.currentTimeMillis())+"\n");
Connection conn = DriverManager.getConnection(m_url);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
conn.close();
rs.next();
Logger.getAnonymousLogger().info( "Sql Time is
:"+rs.getString(1)+"\n");
return "Hello World";
}
}
BUT my result are:
INFO: xxx HelloWorld Time is Wed Jan 23 12:32:31 CET 2008
INFO: xxx HelloWorld Sql Time is :1978-02-13 06:19:06.000088
I read on news pljava should adapt itself on different postgresql
installation, but may I have do somethings wrong, because it don't work
Can anyone help me ?
Thanks in advance
^ permalink raw reply [nested|flat] 2+ messages in thread
* [Pljava-dev] select CURRENT_TIMESTAMP is wrong
@ 2008-01-23 12:47
parent:
0 siblings, 0 replies; 2+ messages in thread
From: @ 2008-01-23 12:47 UTC (permalink / raw)
What happens if, instead of rs.getString(1), you retrieve the
Timestamp via an rs.getTimestamp(1).toString()?
J
On Jan 23, 2008, at 7:34 AM, Stefano Bianchi wrote:
> Hi,
>
> I have a PostgreSQL 8.1.10 on i486-pc-linux-gnu, compiled by GCC cc
> (GCC)
> 4.2.1 (Debian 4.2.1-5), with pljava-i686-pc-linux-gnu-
> pg8.1-1.3.0.tar.gz
> installed.
>
> I try to use CURRENT_TIMESTAMP (now()) from database with this simple
> function:
>
> package net.iskranet.java.pljava.test;
> import java.sql.Connection;
> import java.sql.DriverManager;
> import java.sql.ResultSet;
> import java.sql.SQLException;
> import java.sql.Statement;
> import java.util.logging.Logger;
> import java.util.Date;
>
>
> public class HelloWorld {
> private static java.lang.String m_url = "jdbc:default:connection";
>
> public static String helloWorld() throws SQLException {
> String query="select current_timestamp";
>
> Logger.getAnonymousLogger().info( "Time is " + new
> Date(System.currentTimeMillis())+"\n");
>
> Connection conn = DriverManager.getConnection(m_url);
> Statement stmt = conn.createStatement();
> ResultSet rs = stmt.executeQuery(query);
> conn.close();
>
> rs.next();
> Logger.getAnonymousLogger().info( "Sql Time is
> :"+rs.getString(1)+"\n");
> return "Hello World";
> }
> }
>
> BUT my result are:
> INFO: xxx HelloWorld Time is Wed Jan 23 12:32:31 CET 2008
> INFO: xxx HelloWorld Sql Time is :1978-02-13 06:19:06.000088
>
> I read on news pljava should adapt itself on different postgresql
> installation, but may I have do somethings wrong, because it don't
> work
>
> Can anyone help me ?
> Thanks in advance
>
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at pgfoundry.org
> http://pgfoundry.org/mailman/listinfo/pljava-dev
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2008-01-23 12:47 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-01-23 12:34 [Pljava-dev] select CURRENT_TIMESTAMP is wrong
2008-01-23 12:47 `
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox