From: thhal at mailblocks.com (Thomas Hallgren) Date: Fri, 11 Mar 2005 13:38:55 +0100 Subject: [Pljava-dev] Re: Subject: Re: Loading of native libraries in PLJAVA In-Reply-To: <3214799999CED64882731155DB0AAD922CEA6E@MLSW00103> References: <3214799999CED64882731155DB0AAD922CEA6E@MLSW00103> Message-ID: <4231915F.10703@mailblocks.com> Nageshwar Rao wrote: >Hi, >You can find JNI interface in >http://www.teamlinux.org.uk/saxm/projects/icmp/, there is PingClient java >file, which calls a JNI ping utility. > >Steps to replicate the error:- > > Basically we need to create a jar file of PingUtility and install >the jar file in PLJava and set the classpath then insert record in the >referenced table to invoke the trigger and the trigger should call the ping >utility via JNI. > > I have no linker problems loading and running libping from within PL/Java so there must be an error in your setup. I run into another perhaps bigger problem though. ping.c creates a RAW socket. Only root is allowed to do that. PostgreSQL refuses to run as root (rightly so, that would be a major security hole). Here's a quote from the teamlinux page: "Unfortunately, it requires root (at least, on a Linux box) - as ping.c creates a raw packet, which can only be done by the super-user." Perhaps you should consider skip using libping altogether and go for J2SE 5.0 instead and then use java.net.InetAddress.isReachable()? Regards, Thomas Hallgren