From: thhal at mailblocks.com (Thomas Hallgren) Date: Mon, 28 Mar 2005 21:09:59 +0200 Subject: [Pljava-dev] java.lang.SecurityException In-Reply-To: <11C803742910E84E9CDBFD344773B814759F81@srqech02.teltronics.com> References: <11C803742910E84E9CDBFD344773B814759F81@srqech02.teltronics.com> Message-ID: <42485687.4060103@mailblocks.com> Joves Luo wrote: >Thomas Hallgren wrote: > > > >> > >>Ok, that looks good. Still, according to your stacktrace, an attempt is > >>made to load the PGtoXML.jar using the system classloader which in turn > >>tells me that either your CLASSPATH environment variable or the > >>pljava.classpath in the postgresql.conf contains this jar. You should > >>remove that setting. > >> > >>Regards, > >>Thomas Hallgren > >> > > > > Thank you, that seemed to do the trick on the securityexception. But > now I am getting another exception: > > > > ***Exception: > > java.lang.ClassNotFoundException: org.postgresql.Driver > Something in your code is asking explicitly for the org.postgresql.Driver. That driver is the client JDBC driver and should not be used within PL/Java. If it indeed was found, using it would result in a remote connection to another backend process that runs in a separate transaction, most likely in combination with a significant performance hit. In order to obtain a connection in PL/Java, you must use: Connection conn = DriverManager.getConnection("jdbc:default:connection"); The Driver in use here will be the org.postgresql.pljava.jdbc.SPIDriver but you shouldn't normally need to be concerned with choice of driver. Regards, Thomas Hallgren