@@ -965,3 +965,139 @@ TIP 5: Have you checked our extensive FAQ?
965965
966966http://www.postgresql.org/users-lounge/docs/faq.html
967967
968+ From pgsql-general-owner+M18147=candle.pha.pa.us=pgman@postgresql.org Mon Dec 3 13:53:24 2001
969+ Return-path: <pgsql-general-owner+M18147=candle.pha.pa.us=pgman@postgresql.org>
970+ Received: from west.navpoint.com (west.navpoint.com [207.106.42.13])
971+ by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id fB3IrNS29264
972+ for <pgman@candle.pha.pa.us>; Mon, 3 Dec 2001 13:53:24 -0500 (EST)
973+ Received: from rs.postgresql.org (server1.pgsql.org [64.39.15.238] (may be forged))
974+ by west.navpoint.com (8.11.6/8.10.1) with ESMTP id fB3IrO213373
975+ for <pgman@candle.pha.pa.us>; Mon, 3 Dec 2001 13:53:24 -0500 (EST)
976+ Received: from postgresql.org (postgresql.org [64.49.215.8])
977+ by rs.postgresql.org (8.11.6/8.11.6) with ESMTP id fB3Iq1N35610
978+ for <pgman@candle.pha.pa.us>; Mon, 3 Dec 2001 12:52:02 -0600 (CST)
979+ (envelope-from pgsql-general-owner+M18147=candle.pha.pa.us=pgman@postgresql.org)
980+ Received: from tiger.tigrasoft (fw.tigrasoft.hu [195.70.42.161])
981+ by postgresql.org (8.11.3/8.11.4) with ESMTP id fAU95km73601
982+ for <pgsql-general@postgresql.org>; Fri, 30 Nov 2001 04:05:46 -0500 (EST)
983+ (envelope-from hornyakl@freemail.hu)
984+ Received: from freemail.hu ([192.168.0.200])
985+ by tiger.tigrasoft (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id KAA11457
986+ for <pgsql-general@postgresql.org>; Fri, 30 Nov 2001 10:05:45 +0100
987+ X-Authentication-Warning: tiger.tigrasoft: Host [192.168.0.200] claimed to be freemail.hu
988+ Message-ID: <3C074DE4.9040905@freemail.hu>
989+ Date: Fri, 30 Nov 2001 10:14:12 +0100
990+ From: Laszlo Hornyak <hornyakl@freemail.hu>
991+ Reply-To: hornyakl@users.sourceforge.net
992+ User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20010913
993+ X-Accept-Language: hu, en-us
994+ MIME-Version: 1.0
995+ To: pgsql-general@postgresql.org
996+ Subject: [GENERAL] java stored procedures
997+ Content-Type: text/plain; charset=us-ascii; format=flowed
998+ Content-Transfer-Encoding: 7bit
999+ Precedence: bulk
1000+ Sender: pgsql-general-owner@postgresql.org
1001+ Status: OR
1002+
1003+ Hi!
1004+
1005+ A few months ago I asked if anyone started working on PL/JAVA, the
1006+ ansver was no. Now I started to write a java stored procedure language
1007+ and environment for PostgreSQL. Some code is already working, and it is
1008+ geting interresting. So, I would like to ask you to write me your ideas,
1009+ suggestions, etc for this environment.
1010+ The source code will be available under GPL when it is worth for
1011+ distributing it (this will take for a while).
1012+ thanks.
1013+
1014+ Laszlo Hornyak
1015+
1016+
1017+ ---------------------------(end of broadcast)---------------------------
1018+ TIP 4: Don't 'kill -9' the postmaster
1019+
1020+ From pgsql-general-owner+M18182=candle.pha.pa.us=pgman@postgresql.org Tue Dec 4 13:14:09 2001
1021+ Return-path: <pgsql-general-owner+M18182=candle.pha.pa.us=pgman@postgresql.org>
1022+ Received: from west.navpoint.com (west.navpoint.com [207.106.42.13])
1023+ by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id fB4IE3r15972
1024+ for <pgman@candle.pha.pa.us>; Tue, 4 Dec 2001 13:14:04 -0500 (EST)
1025+ Received: from rs.postgresql.org (server1.pgsql.org [64.39.15.238] (may be forged))
1026+ by west.navpoint.com (8.11.6/8.10.1) with ESMTP id fB4IE2Y07122
1027+ for <pgman@candle.pha.pa.us>; Tue, 4 Dec 2001 13:14:02 -0500 (EST)
1028+ Received: from postgresql.org (postgresql.org [64.49.215.8])
1029+ by rs.postgresql.org (8.11.6/8.11.6) with ESMTP id fB4I9HN76662
1030+ for <pgman@candle.pha.pa.us>; Tue, 4 Dec 2001 12:09:17 -0600 (CST)
1031+ (envelope-from pgsql-general-owner+M18182=candle.pha.pa.us=pgman@postgresql.org)
1032+ Received: from belphigor.mcnaught.org ([216.151.155.121])
1033+ by postgresql.org (8.11.3/8.11.4) with ESMTP id fB4Hwsm96365;
1034+ Tue, 4 Dec 2001 12:58:59 -0500 (EST)
1035+ (envelope-from doug@wireboard.com)
1036+ Received: (from doug@localhost)
1037+ by belphigor.mcnaught.org (8.11.6/8.9.3) id fB4Hwlo07786;
1038+ Tue, 4 Dec 2001 12:58:47 -0500
1039+ X-Authentication-Warning: belphigor.mcnaught.org: doug set sender to doug@wireboard.com using -f
1040+ To: Barry Lind <barry@xythos.com>
1041+ cc: Laszlo Hornyak <hornyakl@freemail.hu>, pgsql-general@postgresql.org,
1042+ pgsql-jdbc@postgresql.org
1043+ Subject: Re: [GENERAL] java stored procedures
1044+ References: <3C074DE4.9040905@freemail.hu> <3C0BE325.3020809@xythos.com>
1045+ <3C0C937E.9000405@freemail.hu> <3C0CFD82.1030600@xythos.com>
1046+ From: Doug McNaught <doug@wireboard.com>
1047+ Date: 04 Dec 2001 12:58:47 -0500
1048+ In-Reply-To: Barry Lind's message of "Tue, 04 Dec 2001 08:44:50 -0800"
1049+ Message-ID: <m3itbmeujs.fsf@belphigor.mcnaught.org>
1050+ Lines: 42
1051+ User-Agent: Gnus/5.0806 (Gnus v5.8.6) XEmacs/21.1 (20 Minutes to Nikko)
1052+ MIME-Version: 1.0
1053+ Content-Type: text/plain; charset=us-ascii
1054+ Precedence: bulk
1055+ Sender: pgsql-general-owner@postgresql.org
1056+ Status: OR
1057+
1058+ Barry Lind <barry@xythos.com> writes:
1059+
1060+ > Having one jvm that all the postgres backend processes communicate with makes
1061+ > the whole feature much more complicated, but is necessary in my opinion.
1062+
1063+ Agreed. Also, the JVM is a multithreaded app, and running it inside a
1064+ non-threaded program (the backend) might cause problems.
1065+
1066+ > Then the question becomes how does the jvm process interact with the database
1067+ > since they are two different processes. You will need some sort of
1068+ > interprocess communication between the two to execute sql statements. This
1069+ > could be accomplished by using the existing jdbc driver. But the bigest
1070+ > problem here is getting the transaction semantics right. How does a sql
1071+ > statement being run by a java stored procedure get access to the same
1072+ > connection/transaction as the original client? What you don't want happening
1073+ > is that sql issued in a stored java procedure executes in a different
1074+ > transaction as the caller, what would rollback of the stored function call
1075+ > mean in that case?
1076+
1077+ I think you would have to to expose the SPI layer to Java running in a
1078+ separate process, either using an RMI server written in C or a custom
1079+ protocol over a TCP socket (Java of course can't do Unix sockets).
1080+ This raises some thorny issues of authentication and security but I
1081+ don't think they're insurmountable. You could, for example, create a
1082+ cryptographically strong "cookie" in the backend when a Java function
1083+ is called. The cookie would be passed to the Java function when it
1084+ gets invoked, and then must be passed back to the SPI layer in order
1085+ for the latter to accept the call. A bit clunky but should be safe as
1086+ far as I can see.
1087+
1088+ The cookie would be needed anyhow, I think, in order for the SPI layer
1089+ to be able to find the transaction that the Java function was
1090+ originally invoked in.
1091+
1092+ You could make the SPI layer stuff look like a normal JDBC driver to
1093+ user code--PL/Perl does this kind of thing with the Perl DBI
1094+ interface.
1095+
1096+ -Doug
1097+ --
1098+ Let us cross over the river, and rest under the shade of the trees.
1099+ --T. J. Jackson, 1863
1100+
1101+ ---------------------------(end of broadcast)---------------------------
1102+ TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
1103+