From: thhal at mailblocks.com (Thomas Hallgren) Date: Mon, 11 Jul 2005 15:37:08 +0200 Subject: [Pljava-dev] How use external java class ? In-Reply-To: <42D2736F.5070609@insa-toulouse.fr> References: <42D2708C.9030500@insa-toulouse.fr> <42D27113.3010504@mailblocks.com> <42D27243.7080406@insa-toulouse.fr> <42D272AC.90800@mailblocks.com> <42D2736F.5070609@insa-toulouse.fr> <42D27604.3050905@mailblocks.com> Message-ID: Yes, you normally load all 50 jars into PostgreSQL. There's a couple of reasons for that: 1. There's a difference in how you access the file-system and the database server. A client often resides on another machine and access the server using TCP/IP. So there's no guarantee that a jar file that resides on the client can be accessed by a server and no guarantee that a client have access to install files in the file system on the server machine. 2. A trusted language in the database is not permitted to access the file system on the server. To allow that would be very insecure. PL/Java can use the PostgreSQL grant/revoke etc. to control who can install a jar file and access the functions there. If jar files could simply be placed in the file-system all such control would be in vain. 3. If you use database replication, you'd probably like changes to jars that is part of your app to be replicated as well. Having said that, there still is a way to actually have jars reside in the file system. But to access them you have to use the untrusted version of PL/Java, i.e. your functions must be declared with LANGAGE 'javaU' (only the super user can declare such functions but anyone can run them). If they are, then you can set the pljava.classpath environment in postgresql.conf to include your jar files. But please note, this is NOT something that I recommend. A much better solution is to create a script that maintains your jars in the database. Regards, Thomas Hallgren brice rouanet wrote: > Yes, > but if I have 50 jars files, i must install all files into postgres ? > At time i have just a jar file in postgres with a simple function > which is call a method (callClient(TriggerData td)) which is a XML RPC > client... > > Thx > Brice. > >> No, you load the jar into the database using the sqlj.install_jar and >> sqlj.set_classpath commands. Please read the user guide. >> >> Regards, >> Thomas Hallgren >> >> brice rouanet wrote: >> >>> I'm not really good in english, but I will try to explain this. >>> >>> I have a jar in /home/brice/test.jar, and I want than the Pl/Java >>> function call a methode in test.jar, >>> is I must add my jar in the classpath setting of postgres.conf ? >>> >>> Thanks, >>> Brice. >>> >>> >>>> brice rouanet wrote: >>>> >>>>> Hi, >>>>> >>>>> how to set the classpath to use external java classes ? >>>>> >>>>> ie : >>>>> >>>>> POSTRGRES / PLJAVA call a method in a class out of postgres. >>>>> >>>>> Best regards, >>>>> >>>>> Brice. >>>>> >>>>> >>>> I'm not sure what you mean by "external". Can you elaborate please? >>>> >>>> Regards, >>>> Thomas Hallgren >>>> >>>> >>>> >>> >>> >> >> >> > >