Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id B5976EB1554; Wed, 11 Apr 2012 00:41:37 -0300 (ADT) Received: from mail-pb0-f46.google.com ([209.85.160.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SHoR4-0004xD-Oj; Wed, 11 Apr 2012 03:41:36 +0000 Received: by pbcun15 with SMTP id un15so709208pbc.19 for ; Tue, 10 Apr 2012 20:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-type:content-transfer-encoding:x-mailer :thread-index:content-language; bh=mdC05+HEa7yd9a+kdDJkmjFUU1o92qI8eSEYo6GNZv0=; b=ma52eLRy8FwBp9foYIzsVgwlj/a01qEUKZSh8O00TvDKB+Vcdgpcv5+wzxL+XM8sDe 5RENS3/ZtNvw3wbX3dnZvfgjwSDM/HHxG0mMdVE/8Z6lUXtOD6KlSvZMAyCYMc71Rw0H k3M4aIJ7zmEpnwia69AnDarGvraHYeisOjLM266rsEzkudKaTRM27Lz8uBNCKaq4RkEA 3iO6b2Z9snmYhiHLvZvM44PUuIor6na50JmoOFF0Gs1nSncT9GhHHpvEsUKQK3Ls+/wa Q6roCcLLxyX2sfVtriNdXpeC594e0ZIY/gCmW6ANe12+/kDjdwN87siE5yhl7oaigU+l M43w== Received: by 10.68.201.98 with SMTP id jz2mr34256953pbc.97.1334115680837; Tue, 10 Apr 2012 20:41:20 -0700 (PDT) Received: from GITCPC ([122.177.230.99]) by mx.google.com with ESMTPS id a9sm1636734pbr.73.2012.04.10.20.41.16 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 Apr 2012 20:41:19 -0700 (PDT) From: "Atri Sharma" To: "'Merlin Moncure'" , "'Tom Lane'" Cc: "'Andrew Dunstan'" , "'Dave Cramer'" , "'Pg Hackers'" , References: <4f802005.cc76440a.668b.ffffcd8e@mx.google.com> <4F831234.7040209@dunslane.net> <4F8438AD.7060503@dunslane.net> <4F844089.2050308@dunslane.net> <4F84480F.1020905@dunslane.net> <9511.1334071505@sss.pgh.pa.us> <9745.1334072198@sss.pgh.pa.us> < CAHyXU0z93NV5Q=UeaeSLkYN272KDsVX0Wrd=VHLMJ_-qeGEvug@mail.gmail.com> In-Reply-To: Subject: Re: [JDBC] Regarding GSoc Application Date: Wed, 11 Apr 2012 09:11:10 +0530 Message-ID: <4f84fd5f.a93b440a.2eed.42c4@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac0XXXlqMG1JO8yKTH2UKrhOuA0UPwAMrFJg Content-Language: en-in X-Pg-Spam-Score: -2.7 (--) X-Archive-Number: 201204/564 X-Sequence-Number: 206367 >> I agree that JNI isn't required -- we're going to >> have to study the pl/java system a bit to determine the best way to >> hook in. This could end up getting us into the 'biting of more than >> can chew' territory admittedly, but Atri is enthusiastic and wants to >> give it a go. > >Well. maybe I spoke too soon...JNI is probably the best route. Since >SPI is off the table, all we're really pulling in from pl/java is the >(non-trivial) proper installation of a jvm into a postgres process. >pl/java is essentially a wrapper to JNI that does postgres to jni type >conversion and builds a database driven class lookup system that >allows building the java environment inside the database. That part >is not needed at all; since we're not going to install our routines as >pl/java installed they will be installed into a separate and more >typical class path from a jvm point of view. There are no exposed >routines in pljava.so that allow for easy manual invocation of a java >routine -- it's all pretty much hardwired to the language function >call handler system. > >This begs the question about why pl/java should be used at all. Well, >as I said the jvm insertion into postgres is non-trivial so that alone >is worth something. Maybe though we should just rip out the jvm guts >that we really need (mostly some parts of backend.c and some of the >type files) and do a completely standalone jni wrapper. pl/java's >build system is a mess anyways so we're not losing all that much in >trying to go off on our own and do something. OTOH, throwing a build >system on top of the growing pile of things to do is turning this into >a daunting project vs the (admittedly cobbled together) approach I was >hoping to do earlier. Anyways, it's really Atri's call if he's >comfortable proceeding. Hi All, I think we are back on the initial approach I proposed(hooking directly into the JVM and executing Java code that calls JDBC).I think the best way to do this is create a JVM that executes the Java code and give the control of the JVM to the native API. I agree,the only need of Pl/Java that is apparent here is the need of the Java internals(JDK et al).If we set them up independently,then,we can have the FDW wrapping JDBC directly through JNI.JNI would call pure Java functions to connect to the JDBC. I think we can proceed with this.Once we are done with the API calling Java functions,I think the rest of the path is easily mapped(writing Java functions to connect to JDBC). Please let me know your opinions on this. Atri