[Pljava-dev] R: Newbie questionorg.postgresql.pljava.internal.ServerException

From: stefano(dot)bianchi at iskranet(dot)net (stefano bianchi)
To:
Subject: [Pljava-dev] R: Newbie questionorg.postgresql.pljava.internal.ServerException
Date: 2007-01-05 12:19:27
Message-ID: 001901c730c3$bee28260$c109d1c2@thinkstefano
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Response to myself....

Looking into source code, I see how the example works.....

Then i comment out the log call, as I see the process stop & exit when it
submit a message to the logger.

I'll have to study further how it work.

bye

Stefano Bianchi
mailto:stefano.bianchi at iskranet.net
Tl +393347516311 o-o Tl +39 348 26 53 362
Fx +39 02 700 438 539

-----Messaggio originale-----
Da: pljava-dev-bounces at gborg.postgresql.org
[mailto:pljava-dev-bounces at gborg.postgresql.org] Per conto di stefano
bianchi
Inviato: venerd? 5 gennaio 2007 11.40
A: pljava-dev at gborg.postgresql.org
Oggetto: [Pljava-dev] Newbie
questionorg.postgresql.pljava.internal.ServerException

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

_______________________________________________
Pljava-dev mailing list
Pljava-dev at gborg.postgresql.org
http://gborg.postgresql.org/mailman/listinfo/pljava-dev

In response to

Browse pljava-dev by date

  From Date Subject
Next Message Ryan Holmes 2007-01-12 22:54:05 [Pljava-dev] PostgreSQL 8.2 PL/Java version
Previous Message stefano bianchi 2007-01-05 10:39:53 [Pljava-dev] Newbie question org.postgresql.pljava.internal.ServerException