[Pljava-dev] Newbie question org.postgresql.pljava.internal.ServerException

From: stefano(dot)bianchi at iskranet(dot)net (stefano bianchi)
To:
Subject: [Pljava-dev] Newbie question org.postgresql.pljava.internal.ServerException
Date: 2007-01-05 10:39:53
Message-ID: 00c901c730b5$d5e83fd0$16c7a8c0@thinkstefano
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

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

Responses

Browse pljava-dev by date

  From Date Subject
Next Message stefano bianchi 2007-01-05 12:19:27 [Pljava-dev] R: Newbie questionorg.postgresql.pljava.internal.ServerException
Previous Message Marek Lewczuk 2007-01-02 07:26:26 [Pljava-dev] Java SE 6 support