agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feedSubject: [Pljava-dev] Newbie question org.postgresql.pljava.internal.ServerException
Date: Fri, 5 Jan 2007 11:39:53 +0100
Message-ID: <00c901c730b5$d5e83fd0$16c7a8c0@thinkstefano> (raw)
In-Reply-To: <00c001c730b5$a0404990$16c7a8c0@thinkstefano>
Hi everybody,
I'm start in testing using Win Xp Postgres and PLJava.
As my old postgres installation was outdated i make a fresh installation,
incudingt also PLJava using, postgres-8-2-int installer.
Al the installation work well, and I suppose also the test runs good.
Then I start to write my own littlte class, and i "lear" ho pass and receive
data from postgres to the java class.
I got problem when i use jdbc connection. I play with a simple insert
statement, and it seem to work 8 i had received a 1 row result from insert
statement, but I got also an exception, and the record isn't stored in his
table.
Where i'm wrong ??
!!!!!!!!!!!
Sql
SELECT sqlj.remove_jar('SPYATE_jar', false);
SELECT sqlj.install_jar('file:///temp/SPyate.jar', 'SPYATE_jar', false);
SELECT sqlj.set_classpath('public', 'SPYATE_jar');
CREATE OR REPLACE FUNCTION usertest()
RETURNS int4 as
'net.gesttec.gbedidi.storedP.yate.UsrReg.test'
LANGUAGE 'java' VOLATILE;
select * from usertest();
ERROR: 05 gen 07 11:12:45 net.gesttec.gbedidi.storedP.yate.UsrReg
SQLException ::: org.postgresql.pljava.internal.ServerException: 05 gen 07
11:12:45 net.gesttec.gbedidi.storedP.yate.UsrReg TEST result row:1
Stato SQL: XX000
!!!!!!!!!!!!!!!!!!!!!!!!!!!
Java
package net.gesttec.gbedidi.storedP.yate;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Logger;
//import java.sql.ResultSet;
public class UsrReg
{
public static void log(String str)
{
Logger.getAnonymousLogger().severe(str);
}
public final static int test() throws SQLException
{
Connection conn = DriverManager
.getConnection("jdbc:default:connection");
if (conn == null)
{
log("ERROR invalid connection !!!");
} else
{
try
{
PreparedStatement insert = conn
.prepareStatement("insert
into public.users (username) values('pippo')");
log("TEST result row:" +
insert.executeUpdate());
// insert.close();
} catch (SQLException e)
{
log("SQLException ::: " + e + "\n");
}
}
return 1;
}
}
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
Any help is welcome.
Thanks in advace
Stefano Bianchi
mailto:stefano.bianchi at iskranet.net
Tl +393347516311 o-o Tl +39 348 26 53 362
Fx +39 02 700 438 539
Message-ID: <00c901c730b5$d5e83fd0$16c7a8c0@thinkstefano>
Permalink: ../00c901c730b5$d5e83fd0$16c7a8c0@thinkstefano/
Also on: postgresql.org/message-id/00c901c730b5$d5e83fd0$16c7a8c0@thinkstefano
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pljava-dev@postgresql.org
Subject: Re: [Pljava-dev] Newbie question org.postgresql.pljava.internal.ServerException
In-Reply-To: <00c901c730b5$d5e83fd0$16c7a8c0@thinkstefano>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox