agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
[Pljava-dev] java.lang.SecurityException
35+ messages / 0 participants
[nested] [flat]

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-28 16:42  
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-28 16:42 UTC (permalink / raw)

Someone please help me, this is driving me crazy.

 

 

I wrote a java program that accesses a database and turns the data into
an xml string.  I then use php to write that string to an .xml file.
Originally I was developing the program on a windows 2k server using
Apache 2, php5, and postgresql 8 with pljava.

 

My boss wanted me to move the server onto a Linux 7.3 box.  So now the
entire thing is sitting on a Linux 7.3 server with Apache 1.3, php4, and
postgresql 8 with pljava.

 

Everything works except for the java application.  I run:

 

select getxmlstring();

 

and I get:

 

ERROR:  java.lang.SecurityException: read on
/var/lib/pgsql/pljava/PGtoXML.jar

 

 

Here is the stack trace from the log file:

 

java.lang.SecurityException: read on /var/lib/pgsql/pljava/PGtoXML.jar

       at
org.postgresql.pljava.internal.Backend$2.assertPermission(Backend.java:1
84)

       at
org.postgresql.pljava.internal.Backend$PLJavaSecurityManager.nonRecursiv
eCheck(Backend.java:125)

       at
org.postgresql.pljava.internal.Backend$PLJavaSecurityManager.checkPermis
sion(Backend.java:103)

       at java.net.URLClassLoader$5.run(Unknown Source)

       at java.security.AccessController.doPrivileged(Native Method)

       at java.net.URLClassLoader.getPermissions(Unknown Source)

       at sun.misc.Launcher$AppClassLoader.getPermissions(Unknown
Source)

       at java.security.SecureClassLoader.getProtectionDomain(Unknown
Source)

       at java.security.SecureClassLoader.defineClass(Unknown Source)

       at java.net.URLClassLoader.defineClass(Unknown Source)

       at java.net.URLClassLoader.access$100(Unknown Source)

       at java.net.URLClassLoader$1.run(Unknown Source)

       at java.security.AccessController.doPrivileged(Native Method)

       at java.net.URLClassLoader.findClass(Unknown Source)

       at java.lang.ClassLoader.loadClass(Unknown Source)

       at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

       at java.lang.ClassLoader.loadClass(Unknown Source)

ERROR:  java.lang.SecurityException: read on
/var/lib/pgsql/pljava/PGtoXML.jar

 

I tried looking at the source code of pljava.internal.Backend, but there
are 3 places where the exception can be thrown.  Can someone please help
me out?

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20050328/7609db98/attachment.html;



^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-28 16:50  
  parent: 
  0 siblings, 0 replies; 35+ messages in thread

From:  @ 2005-03-28 16:50 UTC (permalink / raw)

Joves Luo wrote:

> Someone please help me, this is driving me crazy.
>
You try to load the PGtoXML.jar using the system classloader instead of 
installing it in the database with sqlj.install_jar, or in other words, 
you add the PGtoXML.jar to the PL/Java classpath. This in turn, causes 
an illegal file access. PL/Java installs "java" as a trusted language. 
Trusted languages have no access to the file system. Try installing 
removing PGtoXML.jar from the classpath and instead install it into the 
database using install_jar.

Regards,
Thomas Hallgren





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-28 17:02  
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-28 17:02 UTC (permalink / raw)

Thomas Hallgren wrote:
 
> 
>You try to load the PGtoXML.jar using the system classloader instead of

>installing it in the database with sqlj.install_jar, or in other words,

>you add the PGtoXML.jar to the PL/Java classpath. This in turn, causes 
>an illegal file access. PL/Java installs "java" as a trusted language. 
>Trusted languages have no access to the file system. Try installing 
>removing PGtoXML.jar from the classpath and instead install it into the

>database using install_jar.
> 
> 
>Regards,
>Thomas Hallgren

> 

 

I'm not sure what you mean, but I did use sqlj.install_jar to install
the jar files.  Here is the sql script I run:

 

------------------------------------------------------------------------
--------

SELECT sqlj.install_jar('file:///var/lib/pgsql/pljava/xercesImpl.jar',
'xercesImpl',  false);

SELECT sqlj.install_jar('file:///var/lib/pgsql/pljava/xml_apis.jar',
'xml_apis',  false);

SELECT sqlj.install_jar('file:///var/lib/pgsql/pljava/JDBC.jar', 'JDBC',
false);

SELECT sqlj.install_jar('file:///var/lib/pgsql/pljava/PGtoXML.jar',
'PGtoXML',  false);

 

SELECT sqlj.set_classpath('public', 'xercesImpl');

SELECT sqlj.set_classpath('public', 'xml_apis');

SELECT sqlj.set_classpath('public', 'JDBC');

SELECT sqlj.set_classpath('public', 'PGtoXML');

 

------------------------------------------------------------------------
--------

CREATE or REPLACE FUNCTION getXmlString()

  RETURNS VARCHAR

  AS 'PGtoXML.PGtoXML.getXmlString()'

  LANGUAGE java;

------------------------------------------------------------------------
--------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20050328/9cefd6cf/attachment.html;



^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-28 18:15  
  parent: 
  0 siblings, 0 replies; 35+ messages in thread

From:  @ 2005-03-28 18:15 UTC (permalink / raw)

Joves Luo wrote:

>Thomas Hallgren wrote:
>
> 
>
>> 
>
>>You try to load the PGtoXML.jar using the system classloader instead of 
>
>>installing it in the database with sqlj.install_jar, or in other words, 
>
>>you add the PGtoXML.jar to the PL/Java classpath. This in turn, causes 
>
>>an illegal file access. PL/Java installs "java" as a trusted language. 
>
>>Trusted languages have no access to the file system. Try installing 
>
>>removing PGtoXML.jar from the classpath and instead install it into the 
>
>>database using install_jar.
>
>> 
>
>> 
>
>>Regards,
>
>>Thomas Hallgren
>
>>
>
> I?m not sure what you mean, but I did use sqlj.install_jar to install 
> the jar files. Here is the sql script I run:
>
> --------------------------------------------------------------------------------
>
> SELECT sqlj.install_jar('file:///var/lib/pgsql/pljava/xercesImpl.jar', 
> 'xercesImpl', false);
>
> SELECT sqlj.install_jar('file:///var/lib/pgsql/pljava/xml_apis.jar', 
> 'xml_apis', false);
>
> SELECT sqlj.install_jar('file:///var/lib/pgsql/pljava/JDBC.jar', 
> 'JDBC', false);
>
> SELECT sqlj.install_jar('file:///var/lib/pgsql/pljava/PGtoXML.jar', 
> 'PGtoXML', false);
>
> SELECT sqlj.set_classpath('public', 'xercesImpl');
>
> SELECT sqlj.set_classpath('public', 'xml_apis');
>
> SELECT sqlj.set_classpath('public', 'JDBC');
>
> SELECT sqlj.set_classpath('public', 'PGtoXML');
>
> --------------------------------------------------------------------------------
>
> CREATE or REPLACE FUNCTION getXmlString()
>
> RETURNS VARCHAR
>
> AS 'PGtoXML.PGtoXML.getXmlString()'
>
> LANGUAGE java;
>
> --------------------------------------------------------------------------------
>
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





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-28 19:02  
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-28 19:02 UTC (permalink / raw)

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

java.lang.ClassNotFoundException: org.postgresql.Driver

       at org.postgresql.pljava.sqlj.Loader.findClass(Loader.java:193)

       at java.lang.ClassLoader.loadClass(Unknown Source)

       at java.lang.ClassLoader.loadClass(Unknown Source)

       at java.lang.ClassLoader.loadClassInternal(Unknown Source)

       at java.lang.Class.forName0(Native Method)

       at java.lang.Class.forName(Unknown Source)

       at PGtoXML.OWDBConnection.<init>(OWDBConnection.java:10)

       at PGtoXML.OWDBtoXML.<init>(OWDBtoXML.java:18)

       at PGtoXML.PGtoXML.getXmlString(PGtoXML.java:7)

LOG:  Exception

LOG:  in thread "main"

java.lang.NullPointerException

       at PGtoXML.OWDBtoXML.makeDBXML(OWDBtoXML.java:39)

       at PGtoXML.OWDBtoXML.makeDBXML(OWDBtoXML.java:34)

       at PGtoXML.PGtoXML.getXmlString(PGtoXML.java:8)

ERROR:  java.lang.NullPointerException

 

 

My code imports classes from another jar file (Postgresql JDBC).  I
installed all the jar files that are needed to run my program.  The
program compiles and runs on windows as a java program, and runs on
windows as a pljava function.  It just doesn't work when I do the same
thing for Linux.  Please let me know what I need to do.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20050328/61a3c1c0/attachment.html;



^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-28 19:09  
  parent: 
  0 siblings, 0 replies; 35+ messages in thread

From:  @ 2005-03-28 19:09 UTC (permalink / raw)

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





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-28 19:34  
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-28 19:34 UTC (permalink / raw)

Here is my code that calls the Driver.  The host, database, username,
and password all come from another constants file included in the
PGtoXML package.  I guess there is something wrong with the way I use
the JDBC driver.  I tried removing the import java.sql.* line to stop it
from looking for the JDBC jar files.  But now everything is broken
without it.  Do I need to rewrite all my code to use the pljava JDBC
driver?  Also why is it that this works 100% on a windows system, ( I
can even access the Linux database with the windows postgresql
function)?  Thank you for your help, I would have gotten nowhere without
it.

 

 

package PGtoXML;

 

import java.sql.*;

 

public class OWDBConnection {  

  private Connection db; 

  public OWDBConnection() throws ClassNotFoundException, SQLException{

            Class.forName("org.postgresql.Driver");

            db = DriverManager.getConnection("jdbc:postgresql:" + 

 
Constants.host + 

 
Constants.database,

 
Constants.username,

 
Constants.password);

  }

  

  

  public ResultSet getTableNames() throws SQLException{

            Statement sql = db.createStatement();

            ResultSet results = sql.executeQuery

                        ("select viewname from pg_views where schemaname
= 'public' and viewname like 'xml_%'");

            return results;

  }

 

  

  public ResultSet getTableColNames (String name) throws SQLException{

            Statement sql = db.createStatement();

            ResultSet results = sql.executeQuery

 
("select column_name from information_schema.columns where table_name =
'" 

                                                 + name + "' order by
ordinal_position");

            return results;    

  }

  

  

  public ResultSet getTableData (String name) throws SQLException{

            Statement sql = db.createStatement();

            ResultSet results = sql.executeQuery("select * from " +
name);

            return results;

  }

  

 

  public static void main (String args[]) {

    try{

            OWDBConnection demo = new OWDBConnection();

            System.out.println("\n");

            ResultSet tableNames = demo.getTableNames();

            ResultSet tableData;

        

            while (tableNames.next()) {

            System.out.println(tableNames.getString(1));

            tableData = demo.getTableData(tableNames.getString(1));


            for (int i=1; i<=tableData.getMetaData().getColumnCount();
i++){    

                        System.out.print("\t\t\t" +
tableData.getMetaData().getColumnName(i));

            }

            while (tableData.next()){ 

                        System.out.println();

                        for (int i=1;
i<=tableData.getMetaData().getColumnCount(); i++){

                                    System.out.print("\t\t\t" +
tableData.getString(i));

                        }

            }

            System.out.println("\n");

        }

    }

    catch (Exception ex) {

        System.out.println("***Exception:\n"+ex);

        ex.printStackTrace();

    }

 

  }

}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20050328/1f1e9041/attachment.html;



^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-28 21:01  
  parent: 
  0 siblings, 0 replies; 35+ messages in thread

From:  @ 2005-03-28 21:01 UTC (permalink / raw)

Joves Luo wrote:

> Here is my code that calls the Driver.  The host, database, username, 
> and password all come from another constants file included in the 
> PGtoXML package.  I guess there is something wrong with the way I use 
> the JDBC driver.  I tried removing the import java.sql.* line to stop 
> it from looking for the JDBC jar files.  But now everything is broken 
> without it.  Do I need to rewrite all my code to use the pljava JDBC 
> driver?  Also why is it that this works 100% on a windows system, ( I 
> can even access the Linux database with the windows postgresql 
> function)?  Thank you for your help, I would have gotten nowhere 
> without it.
>
>  
>
Only one method needs to be rewritten AFAICS, and that's the 
constructor. Try this:

public OWDBConnection() throws SQLException{
    db = DriverManager.getConnection("jdbc:default:connection");
}

That should do it. You will still use JDBC (that's just the interfaces) 
but now you'll use the PL/Java jdbc implementation. The connection used 
by PL/Java is implicit since it reflects the session of the caller of 
the function, hence there's need to "login".

If you got your code working on a windows system you probably have an 
older version of PL/Java then yor setup must be slightly different 
there. PL/Java somehow finds the jar file of the client driver. Perhaps 
you had that jar file in your classpath in combination with a sligthly 
older version of PL/Java where security was not as tight as it is now? 
Eihter that, or you loaded the actual PostgreSQL client driver .jar file 
into the database using sqlj.install_jar. As I explained earlier, such a 
setup might seem to work although what really happens is that your 
function will behave like a client for yet another backend. I have a 
hard time thinking of a case when that would be desirable.

Regards,
Thomas Hallgren

>  
>
> package PGtoXML;
>
>  
>
> import java.sql.*;
>
>  
>
> public class OWDBConnection { 
>
>   private Connection db;
>
>   public OWDBConnection() throws ClassNotFoundException, SQLException{
>
>             Class.forName("org.postgresql.Driver");
>
>             db = DriverManager.getConnection("jdbc:postgresql:" +
>
>                                                                                                 
> Constants.host +
>
>                                                                                                 
> Constants.database,
>
>                                                                                                 
> Constants.username,
>
>                                                                                                 
> Constants.password);
>
>   }
>
>  
>
>  
>
>   public ResultSet getTableNames() throws SQLException{
>
>             Statement sql = db.createStatement();
>
>             ResultSet results = sql.executeQuery
>
>                         ("select viewname from pg_views where 
> schemaname = 'public' and viewname like 'xml_%'");
>
>             return results;
>
>   }
>
>  
>
>  
>
>   public ResultSet getTableColNames (String name) throws SQLException{
>
>             Statement sql = db.createStatement();
>
>             ResultSet results = sql.executeQuery
>
>                                                                         
> ("select column_name from information_schema.columns where table_name 
> = '"
>
>                                                  + name + "' order by 
> ordinal_position");
>
>             return results;   
>
>   }
>
>  
>
>  
>
>   public ResultSet getTableData (String name) throws SQLException{
>
>             Statement sql = db.createStatement();
>
>             ResultSet results = sql.executeQuery("select * from " + name);
>
>             return results;
>
>   }
>
>  
>
>  
>
>   public static void main (String args[]) {
>
>     try{
>
>             OWDBConnection demo = new OWDBConnection();
>
>             System.out.println("\n");
>
>             ResultSet tableNames = demo.getTableNames();
>
>             ResultSet tableData;
>
>        
>
>             while (tableNames.next()) {
>
>             System.out.println(tableNames.getString(1));
>
>             tableData = demo.getTableData(tableNames.getString(1));    
>        
>
>             for (int i=1; i<=tableData.getMetaData().getColumnCount(); 
> i++){   
>
>                         System.out.print("\t\t\t" + 
> tableData.getMetaData().getColumnName(i));
>
>             }
>
>             while (tableData.next()){
>
>                         System.out.println();
>
>                         for (int i=1; 
> i<=tableData.getMetaData().getColumnCount(); i++){
>
>                                     System.out.print("\t\t\t" + 
> tableData.getString(i));
>
>                         }
>
>             }
>
>             System.out.println("\n");
>
>         }
>
>     }
>
>     catch (Exception ex) {
>
>         System.out.println("***Exception:\n"+ex);
>
>         ex.printStackTrace();
>
>     }
>
>  
>
>   }
>
> }
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Pljava-dev mailing list
>Pljava-dev at gborg.postgresql.org
>http://gborg.postgresql.org/mailman/listinfo/pljava-dev
>  
>





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-28 22:01  
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-28 22:01 UTC (permalink / raw)

Thomas Hallgren wrote:
 
> 
>Only one method needs to be rewritten AFAICS, and that's the 
>constructor. Try this:
> 
>public OWDBConnection() throws SQLException{
>    db = DriverManager.getConnection("jdbc:default:connection");
>}
> 
>That should do it. You will still use JDBC (that's just the interfaces)

>but now you'll use the PL/Java jdbc implementation. The connection used

>by PL/Java is implicit since it reflects the session of the caller of 
>the function, hence there's need to "login".
> 
>If you got your code working on a windows system you probably have an 
>older version of PL/Java then yor setup must be slightly different 
>there. PL/Java somehow finds the jar file of the client driver. Perhaps

>you had that jar file in your classpath in combination with a sligthly 
>older version of PL/Java where security was not as tight as it is now? 
>Eihter that, or you loaded the actual PostgreSQL client driver .jar
file 
>into the database using sqlj.install_jar. As I explained earlier, such
a 
>setup might seem to work although what really happens is that your 
>function will behave like a client for yet another backend. I have a 
>hard time thinking of a case when that would be desirable.
> 
>Regards,
>Thomas Hallgren

> 

 

Thank you once again.  I have one (hopefully last) problem.  

 

LOG:  Exception

LOG:  in thread "main"

java.lang.NoClassDefFoundError: org/apache/xerces/dom/DocumentImpl

       at PGtoXML.OWDBtoXML.<init>(OWDBtoXML.java:19)

       at PGtoXML.PGtoXML.getXmlString(PGtoXML.java:7)

ERROR:  java.lang.NoClassDefFoundError:
org/apache/xerces/dom/DocumentImpl

 

I have installed the xerces xml parser the same way I installed the
PGtoXML jar file.  Is there something else I need to do in order to have
PGtoXML see xerces?  How do I set the classpath to be seen?  I've
already entered:

 

       SELECT sqlj.set_classpath('public', 'xercesImpl');

SELECT sqlj.set_classpath('public', 'xml_apis');

SELECT sqlj.set_classpath('public', 'PGtoXML');

 

Also, you were right; I was running pljava 1.0.0 on the windows box.  I
have replaced it with the latest version, and now both servers are
broken.  But I am sure that once I get this to work it'll be better than
what I used to have.

 

Once again thank you for you help.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20050328/a3116b9d/attachment.html;



^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 06:14  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 06:14 UTC (permalink / raw)

Hello,

try
       SELECT sqlj.set_classpath('public', 'xercesImpl:xml_apis:PGtoXML');
 

instead of

       SELECT sqlj.set_classpath('public', 'xercesImpl');

SELECT sqlj.set_classpath('public', 'xml_apis');

SELECT sqlj.set_classpath('public', 'PGtoXML');



If you set the classpath three times, only the last one is effective. You should set it only once using a colon separated string.



Thomas, I think there could be one reason to use explicit JDBC driver within PL/Java routine if you want to log something in an autonomous transaction (if your session crashes or is rolled back, logged items remain saved). However, I don't think that this would be the Joves's case.



Filip Hrbek



 

  ----- Original Message ----- 
  From: Joves Luo 
  To: pljava-dev at gborg.postgresql.org 
  Sent: Tuesday, March 29, 2005 12:01 AM
  Subject: [Pljava-dev] java.lang.SecurityException


Thomas Hallgren wrote: > >Only one method needs to be rewritten AFAICS, and that's the >constructor. Try this:> >public OWDBConnection() throws SQLException{>    db = DriverManager.getConnection("jdbc:default:connection");>}> >That should do it. You will still use JDBC (that's just the interfaces) >but now you'll use the PL/Java jdbc implementation. The connection used >by PL/Java is implicit since it reflects the session of the caller of >the function, hence there's need to "login".> >If you got your code working on a windows system you probably have an >older version of PL/Java then yor setup must be slightly different >there. PL/Java somehow finds the jar file of the client driver. Perhaps >you had that jar file in your classpath in combination with a sligthly >older version of PL/Java where security was not as tight as it is now? >Eihter that, or you loaded the actual PostgreSQL client driver .jar file >into the database using sqlj.install_jar. As I explained earlier, such a >setup might seem to work although what really happens is that your >function will behave like a client for yet another backend. I have a >hard time thinking of a case when that would be desirable.> >Regards,>Thomas Hallgren> 

   

  Thank you once again.  I have one (hopefully last) problem.  

   

  LOG:  Exception

  LOG:  in thread "main"

  java.lang.NoClassDefFoundError: org/apache/xerces/dom/DocumentImpl

         at PGtoXML.OWDBtoXML.<init>(OWDBtoXML.java:19)

         at PGtoXML.PGtoXML.getXmlString(PGtoXML.java:7)

  ERROR:  java.lang.NoClassDefFoundError: org/apache/xerces/dom/DocumentImpl

   

  I have installed the xerces xml parser the same way I installed the PGtoXML jar file.  Is there something else I need to do in order to have PGtoXML see xerces?  How do I set the classpath to be seen?  I've already entered:

   

         SELECT sqlj.set_classpath('public', 'xercesImpl');

  SELECT sqlj.set_classpath('public', 'xml_apis');

  SELECT sqlj.set_classpath('public', 'PGtoXML');

   

  Also, you were right; I was running pljava 1.0.0 on the windows box.  I have replaced it with the latest version, and now both servers are broken.  But I am sure that once I get this to work it'll be better than what I used to have.

   

  Once again thank you for you help.

   



------------------------------------------------------------------------------


  _______________________________________________
  Pljava-dev mailing list
  Pljava-dev at gborg.postgresql.org
  http://gborg.postgresql.org/mailman/listinfo/pljava-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20050329/5714e1ef/attachment.html;



^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 06:59  
  parent: 
  0 siblings, 0 replies; 35+ messages in thread

From:  @ 2005-03-29 06:59 UTC (permalink / raw)

Filip Hrbek wrote:

> Thomas, I think there could be one reason to use explicit JDBC driver 
> within PL/Java routine if you want to log something in an autonomous 
> transaction (if your session crashes or is rolled back, logged items 
> remain saved).
>
Yes, that would be a special case where it (perhaps) would make sense 
although the performance hit caused by such logging would be 
significant. I wouldn't recommend it. One major reason to move 
functionality into functions is to get rid of the overhead of using a 
remote process. Logging through a client jdbc driver will introduce that 
overhead once again and every session that uses it will tie up two 
backend processes. I'm not sure of what use case you are thinking of but 
perhaps it can be solved using the standard java.util.log.Logger? 
Entries written there ends up in the backend log. Formatted the right 
way they should be easy to parse if need be.

Regards,
Thomas Hallgren





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 15:52  
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 15:52 UTC (permalink / raw)

I had to change my e-mail.  My work e-mail wasn't receiveing the
messages (reason why I had to start a new thread everytime).

Thanks Filip for your help.  I've gotten one step closer to finishing
this up.  But now when I start postgresql and run the function I get
this:

LOG:  
LOG:  An unexpected exception has been detected in native code outside the VM.
LOG:  Unexpected Signal : 4 occurred at PC=0x4915444C
LOG:  Function=
LOG:  [Unknown.
LOG:  ]
LOG:  Library=(N/A)
LOG:  
LOG:  NOTE: We are unable to locate the function name symbol for the error
LOG:        just occurred. Please refer to release documentation for possible
LOG:        reason and solutions.
LOG:  
LOG:  
LOG:  Current Java thread:
LOG:  
LOG:  Dynamic libraries:
LOG:  08048000-08282000 r-xp 00000000 03:05 362139     /usr/bin/postgres
LOG:  08282000-0828c000 rw-p 00239000 03:05 362139     /usr/bin/postgres
LOG:  40000000-40012000 r-xp 00000000 03:05 3759355    /lib/ld-2.3.2.so
LOG:  40012000-40013000 rw-p 00011000 03:05 3759355    /lib/ld-2.3.2.so
LOG:  40013000-40017000 rw-s 00000000 03:05 8667673   
/tmp/hsperfdata_postgres/2317
LOG:  40017000-4001a000 r--s 00000000 03:05 7452900   
/usr/lib/jre/lib/ext/dnsns.jar
LOG:  4001c000-40023000 r-xp 00000000 03:05 3759347    /lib/libpam.so.0.75
LOG:  40023000-40024000 rw-p 00006000 03:05 3759347    /lib/libpam.so.0.75
LOG:  40024000-4004e000 r-xp 00000000 03:05 3759341    /lib/libssl.so.0.9.6b
LOG:  4004e000-40051000 rw-p 00029000 03:05 3759341    /lib/libssl.so.0.9.6b
LOG:  40051000-40108000 r-xp 00000000 03:05 3759340    /lib/libcrypto.so.0.9.6b
LOG:  40108000-40113000 rw-p 000b7000 03:05 3759340    /lib/libcrypto.so.0.9.6b
LOG:  40117000-40123000 r-xp 00000000 03:05 377925     /usr/lib/libz.so.1.1.3
LOG:  40123000-40125000 rw-p 0000b000 03:05 377925     /usr/lib/libz.so.1.1.3
LOG:  40125000-40146000 r-xp 00000000 03:05 377832    
/usr/lib/libreadline.so.4.2
LOG:  40146000-4014a000 rw-p 00021000 03:05 377832    
/usr/lib/libreadline.so.4.2
LOG:  4014b000-4014e000 r-xp 00000000 03:05 3759337    /lib/libtermcap.so.2.0.8
LOG:  4014e000-4014f000 rw-p 00002000 03:05 3759337    /lib/libtermcap.so.2.0.8
LOG:  40150000-40154000 r-xp 00000000 03:05 3759276    /lib/libcrypt-2.3.2.so
LOG:  40154000-40155000 rw-p 00003000 03:05 3759276    /lib/libcrypt-2.3.2.so
LOG:  4017c000-40189000 r-xp 00000000 03:05 3759310    /lib/libresolv-2.3.2.so
LOG:  40189000-4018a000 rw-p 0000d000 03:05 3759310    /lib/libresolv-2.3.2.so
LOG:  4018c000-4019c000 r-xp 00000000 03:05 3759282    /lib/libnsl-2.3.2.so
LOG:  4019c000-4019d000 rw-p 00010000 03:05 3759282    /lib/libnsl-2.3.2.so
LOG:  4019f000-401a1000 r-xp 00000000 03:05 3759278    /lib/libdl-2.3.2.so
LOG:  401a1000-401a2000 rw-p 00001000 03:05 3759278    /lib/libdl-2.3.2.so
LOG:  401a2000-401c2000 r-xp 00000000 03:05 3759280    /lib/libm-2.3.2.so
LOG:  401c2000-401c3000 rw-p 00020000 03:05 3759280    /lib/libm-2.3.2.so
LOG:  401c3000-402e2000 r-xp 00000000 03:05 3759274    /lib/libc-2.3.2.so
LOG:  402e2000-402e6000 rw-p 0011e000 03:05 3759274    /lib/libc-2.3.2.so
LOG:  402e9000-402f3000 r-xp 00000000 03:05 3759298   
/lib/libnss_files-2.3.2.so
LOG:  402f3000-402f4000 rw-p 00009000 03:05 3759298   
/lib/libnss_files-2.3.2.so
LOG:  402f4000-40cd6000 rw-s 00000000 00:04 393218     /SYSV0052e2c1 (deleted)
LOG:  40cf7000-40d11000 r-xp 00000000 03:02 409682    
/var/lib/pgsql/pljava/libpljava.so
LOG:  40d11000-40d13000 rw-p 00019000 03:02 409682    
/var/lib/pgsql/pljava/libpljava.so
LOG:  40d13000-4110f000 r-xp 00000000 03:05 8634864   
/usr/lib/jre/lib/i386/client/libjvm.so
LOG:  4110f000-4112b000 rw-p 003fb000 03:05 8634864   
/usr/lib/jre/lib/i386/client/libjvm.so
LOG:  4113d000-4114b000 r-xp 00000000 03:05 3759308    /lib/libpthread-0.10.so
LOG:  4114b000-4114e000 rw-p 0000e000 03:05 3759308    /lib/libpthread-0.10.so
LOG:  4118e000-41196000 r-xp 00000000 03:05 8733367   
/usr/lib/jre/lib/i386/native_threads/libhpi.so
LOG:  41196000-41197000 rw-p 00007000 03:05 8733367   
/usr/lib/jre/lib/i386/native_threads/libhpi.so
LOG:  41197000-411a7000 r-xp 00000000 03:05 8060343   
/usr/lib/jre/lib/i386/libverify.so
LOG:  411a7000-411a9000 rw-p 0000f000 03:05 8060343   
/usr/lib/jre/lib/i386/libverify.so
LOG:  411a9000-411c9000 r-xp 00000000 03:05 8060329   
/usr/lib/jre/lib/i386/libjava.so
LOG:  411c9000-411cb000 rw-p 0001f000 03:05 8060329   
/usr/lib/jre/lib/i386/libjava.so
LOG:  411cb000-411df000 r-xp 00000000 03:05 8060344   
/usr/lib/jre/lib/i386/libzip.so
LOG:  411df000-411e2000 rw-p 00013000 03:05 8060344   
/usr/lib/jre/lib/i386/libzip.so
LOG:  411e2000-428cc000 r--s 00000000 03:05 1362607    /usr/lib/jre/lib/rt.jar
LOG:  42916000-4292c000 r--s 00000000 03:05 1362608   
/usr/lib/jre/lib/sunrsasign.jar
LOG:  4292c000-42a05000 r--s 00000000 03:05 1362600    /usr/lib/jre/lib/jsse.jar
LOG:  42a05000-42a16000 r--s 00000000 03:05 1362599    /usr/lib/jre/lib/jce.jar
LOG:  42a16000-42f5f000 r--s 00000000 03:05 1362536   
/usr/lib/jre/lib/charsets.jar
LOG:  4d090000-4d14b000 r--s 00000000 03:05 7452902   
/usr/lib/jre/lib/ext/localedata.jar
LOG:  4d14b000-4d158000 r--s 00000000 03:05 7452901   
/usr/lib/jre/lib/ext/ldapsec.jar
LOG:  4d158000-4d174000 r--s 00000000 03:05 7452903   
/usr/lib/jre/lib/ext/sunjce_provider.jar
LOG:  4d174000-4d193000 r--s 00000000 03:02 409684    
/var/lib/pgsql/pljava/pljava.jar
LOG:  
LOG:  Heap at VM Abort:
LOG:  
LOG:  Heap
LOG:   def new generation
LOG:   total 576K, used 217K
LOG:   [0x45010000, 0x450b0000, 0x454f0000)
LOG:    eden
LOG:   space 512K,  291087438054sed
LOG:   [0x45010000, 0x45036638, 0x45090000)
LOG:    from
LOG:   space 64K, 1001087438054sed
LOG:   [0x45090000, 0x450a0000, 0x450a0000)
LOG:    to
LOG:   space 64K,   01087438054sed
LOG:   [0x450a0000, 0x450a0000, 0x450b0000)
LOG:   tenured generation
LOG:   total 1408K, used 178K
LOG:   [0x454f0000, 0x45650000, 0x49010000)
LOG:     the
LOG:   space 1408K,  121087438054sed
LOG:   [0x454f0000, 0x4551cba0, 0x4551cc00, 0x45650000)
LOG:   compacting perm gen
LOG:   total 4096K, used 2170K
LOG:   [0x49010000, 0x49410000, 0x4d010000)
LOG:     the
LOG:   space 4096K,  521087438054sed
LOG:   [0x49010000, 0x4922e8b8, 0x4922ea00, 0x49410000)
LOG:  
LOG:  Local Time = Tue Mar 29 05:41:53 2005
LOG:  Elapsed Time = 0
LOG:  #
LOG:  # The exception above was detected in native code outside the VM
LOG:  #
LOG:  # Java VM: Java HotSpot(TM) Client VM (1.4.2_06-b03 mixed mode)
LOG:  #
LOG:  # An error report file has been saved as hs_err_pid2317.log.
LOG:  # Please refer to the file for further information.
LOG:  #
LOG:  server process (PID 2317) was terminated by signal 6
LOG:  terminating any other active server processes
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back
the current transaction and exit, because another server process
exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and
repeat your command.
LOG:  all server processes terminated; reinitializing
LOG:  database system was interrupted at 2005-03-29 05:40:41 EST
LOG:  checkpoint record is at 0/12574B8C
LOG:  redo record is at 0/12574B8C; undo record is at 0/0; shutdown TRUE
LOG:  next transaction ID: 39667; next OID: 176603
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  record with zero length at 0/12574BC8
LOG:  redo is not required
LOG:  database system is ready





Now, if I run the function again (without logging out) I get no
errors, but I don't get my results either.
I look at my log and I see this:

***Exception:
java.sql.SQLException: Cannot derive a value of class java.lang.String
from an object of class java.lang.Boolean
java.sql.SQLException: Cannot derive a value of class java.lang.String
from an object of class java.lang.Boolean
	at org.postgresql.pljava.jdbc.ObjectResultSet.getValue(ObjectResultSet.java:417)
	at org.postgresql.pljava.jdbc.ObjectResultSet.getString(ObjectResultSet.java:205)
	at PGtoXML.OWDBtoXML.makeDBXML(OWDBtoXML.java:62)
	at PGtoXML.OWDBtoXML.makeDBXML(OWDBtoXML.java:34)
	at PGtoXML.PGtoXML.getXmlString(PGtoXML.java:8)

Does the pljava JDBC work diffrently than the postgresql JDBC I was
using originally?

Again you guys have been tremendous hlep.




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 16:12  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 16:12 UTC (permalink / raw)

Joves Luo wrote:

>I had to change my e-mail.  My work e-mail wasn't receiveing the
>messages (reason why I had to start a new thread everytime).
>
>Thanks Filip for your help.  I've gotten one step closer to finishing
>this up.  But now when I start postgresql and run the function I get
>this:
>  
>
>...
>LOG:  #
>LOG:  # The exception above was detected in native code outside the VM
>LOG:  #
>LOG:  # Java VM: Java HotSpot(TM) Client VM (1.4.2_06-b03 mixed mode)
>LOG:  #
>LOG:  # An error report file has been saved as hs_err_pid2317.log.
>LOG:  # Please refer to the file for further information.
>LOG:  #
>  
>
The file "hs_err_pid2317.log" will be present somewhere under your 
<PostgreSQL data>/base/<some number> directory. Can you please attach 
that file and email it to me?

>I look at my log and I see this:
>
>***Exception:
>java.sql.SQLException: Cannot derive a value of class java.lang.String
>from an object of class java.lang.Boolean
>java.sql.SQLException: Cannot derive a value of class java.lang.String
>from an object of class java.lang.Boolean
>	at org.postgresql.pljava.jdbc.ObjectResultSet.getValue(ObjectResultSet.java:417)
>	at org.postgresql.pljava.jdbc.ObjectResultSet.getString(ObjectResultSet.java:205)
>	at PGtoXML.OWDBtoXML.makeDBXML(OWDBtoXML.java:62)
>	at PGtoXML.OWDBtoXML.makeDBXML(OWDBtoXML.java:34)
>	at PGtoXML.PGtoXML.getXmlString(PGtoXML.java:8)
>
>Does the pljava JDBC work diffrently than the postgresql JDBC I was
>using originally?
>  
>
Yes, that's possible although all things that are standardized should 
work the same way. The conversion from boolean to string is standardized 
so you have encountered a bug in PL/Java.

Regards,
Thomas Hallgren





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 16:20  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 16:20 UTC (permalink / raw)

> Yes, that's possible although all things that are standardized should
> work the same way. The conversion from boolean to string is standardized
> so you have encountered a bug in PL/Java.
> 
> Regards,
> Thomas Hallgren

When you say a bug in PL/Java, does that mean there isn't much I can
do to fix it?

What about the:
    LOG:  An unexpected exception has been detected in native code
outside the VM.
    LOG:  Unexpected Signal : 4 occurred at PC=0x4915444C
    LOG:  Function=
    LOG:  [Unknown.

Is that also a bug in PL/java, or is that something I should be looking to fix?

If that is indeed something I can't fix, is there anywhere I can get
the 1.0.0 release so that I can rool everything back to when it was
working?  I don't mind the performance really since the java
application will be runned maybe once or twice per day.

Thank you




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 16:25  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 16:25 UTC (permalink / raw)

Joves Luo wrote:

>>Yes, that's possible although all things that are standardized should
>>work the same way. The conversion from boolean to string is standardized
>>so you have encountered a bug in PL/Java.
>>
>>Regards,
>>Thomas Hallgren
>>    
>>
>
>When you say a bug in PL/Java, does that mean there isn't much I can
>do to fix it?
>  
>
You can always change your code to do a getBoolean() to fetch boolean 
values instead of getString().

>What about the:
>    LOG:  An unexpected exception has been detected in native code
>outside the VM.
>    LOG:  Unexpected Signal : 4 occurred at PC=0x4915444C
>    LOG:  Function=
>    LOG:  [Unknown.
>
>Is that also a bug in PL/java, or is that something I should be looking to fix?
>  
>
I don't know. That's why I want you to send me the "hs_err_pid2317.log" 
file.

>If that is indeed something I can't fix, is there anywhere I can get
>the 1.0.0 release so that I can rool everything back to when it was
>working?  I don't mind the performance really since the java
>application will be runned maybe once or twice per day.
>  
>
If it's broke in 1.1, I doublt it will be working in 1.0.

Regards,
Thomas Hallgren





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 16:41  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 16:41 UTC (permalink / raw)

> You can always change your code to do a getBoolean() to fetch boolean
> values instead of getString().

I am looking at the PL/Java source and my code.  I see that the
problem is I am trying to get the string of the data and put it into
an xml node attribute.  The problem comes when the JDBC returns the a
sql boolean as a boolean object and the toString method can not handle
it.  I am not sure what the correct standard for this is, but the
postgresql JDBC allowed it.  I will change my code accordingly.


> I don't know. That's why I want you to send me the "hs_err_pid2317.log"
> file.

Sorry I didn't read that part originally.  I will include it with this e-mail

> If it's broke in 1.1, I doublt it will be working in 1.0.

I think the reason that it worked in 1.0 was because the lower
security allowed me to add the Postgresql JDBC to the classpath and
the Postgresql JDBC was able to handle a toString() on all data types.

-- 
Joves Luo
Georgia Tech Senior
CS Major
School Email: gtg861b at mail.gatech.edu
Personal Email: Joves.Luo at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hs_err_pid2317.log
Type: application/octet-stream
Size: 5444 bytes
Desc: not available
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20050329/33103023/attachment.obj;



^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 16:51  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 16:51 UTC (permalink / raw)

Joves Luo wrote:

>Sorry I didn't read that part originally.  I will include it with this e-mail
>  
>
Thanks. Unfortunately that log didn't reveal anything at all. What exact 
version of PL/Java are you using? Is it a pre-compiled binary? Would it 
be possible for you to try the latest CVS?

- thomas





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 17:12  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 17:12 UTC (permalink / raw)

> Thanks. Unfortunately that log didn't reveal anything at all. What exact
> version of PL/Java are you using? Is it a pre-compiled binary? Would it
> be possible for you to try the latest CVS?

I am using 1.1.0b1.  I changed my code from:

data.getString(i);

to:

data.getObject(i).toString();

And it seems to work.  It still crashes the first time I run the
function when I log into postgresql though.  But it'll work if I just
restart postgresql, which I will add to my script.  And randomly I
will get this:

LOG:  Exception
LOG:  in thread "main"
java.sql.SQLException: Stale Handle to native structure
	at org.postgresql.pljava.internal.Tuple._getObject(Native Method)
	at org.postgresql.pljava.internal.Tuple.getObject(Tuple.java:32)
	at org.postgresql.pljava.jdbc.SPIResultSet.peekNext(SPIResultSet.java:172)
	at org.postgresql.pljava.jdbc.SPIResultSet.next(SPIResultSet.java:80)
	at org.postgresql.pljava.sqlj.Loader.getSchemaLoader(Loader.java:88)
ERROR:  java.sql.SQLException: Stale Handle to native structure

Also, although I get my xml string, there is alot of junk in front of it.


-- 
Joves Luo
Georgia Tech Senior
CS Major
School Email: gtg861b at mail.gatech.edu
Personal Email: Joves.Luo at gmail.com




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 17:17  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 17:17 UTC (permalink / raw)

Joves Luo wrote:

>>Thanks. Unfortunately that log didn't reveal anything at all. What exact
>>version of PL/Java are you using? Is it a pre-compiled binary? Would it
>>be possible for you to try the latest CVS?
>>    
>>
>
>I am using 1.1.0b1.  I changed my code from:
>
>data.getString(i);
>
>to:
>
>data.getObject(i).toString();
>
>And it seems to work.  It still crashes the first time I run the
>function when I log into postgresql though.  But it'll work if I just
>restart postgresql, which I will add to my script.  And randomly I
>will get this:
>
>LOG:  Exception
>LOG:  in thread "main"
>java.sql.SQLException: Stale Handle to native structure
>	at org.postgresql.pljava.internal.Tuple._getObject(Native Method)
>	at org.postgresql.pljava.internal.Tuple.getObject(Tuple.java:32)
>	at org.postgresql.pljava.jdbc.SPIResultSet.peekNext(SPIResultSet.java:172)
>	at org.postgresql.pljava.jdbc.SPIResultSet.next(SPIResultSet.java:80)
>	at org.postgresql.pljava.sqlj.Loader.getSchemaLoader(Loader.java:88)
>ERROR:  java.sql.SQLException: Stale Handle to native structure
>
>Also, although I get my xml string, there is alot of junk in front of it.
>  
>
Right, I think you encounter a bug that has been fixed in CVS head, so 
if you have a chance to get the source-tree using CVS and then compile 
and test again using that, it would be very helpful.

A bugfix that greatly improves the ResultSet type mappings is in the 
works by the way. I hope to get it in tonight.

- thomas





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 18:10  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 18:10 UTC (permalink / raw)

> Right, I think you encounter a bug that has been fixed in CVS head, so
> if you have a chance to get the source-tree using CVS and then compile
> and test again using that, it would be very helpful.
> 
> A bugfix that greatly improves the ResultSet type mappings is in the
> works by the way. I hope to get it in tonight.
> 
> - thomas
> 
> 

Do you mean the java.sql.SQLException: Stale Handle to native structure
or the error that I already fixed?
-- 
Joves Luo
Georgia Tech Senior
CS Major
School Email: gtg861b at mail.gatech.edu
Personal Email: Joves.Luo at gmail.com




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 18:20  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 18:20 UTC (permalink / raw)

Joves Luo wrote:

>>Right, I think you encounter a bug that has been fixed in CVS head, so
>>if you have a chance to get the source-tree using CVS and then compile
>>and test again using that, it would be very helpful.
>>
>>A bugfix that greatly improves the ResultSet type mappings is in the
>>works by the way. I hope to get it in tonight.
>>
>>- thomas
>>
>>
>>    
>>
>
>Do you mean the java.sql.SQLException: Stale Handle to native structure
>or the error that I already fixed?
>  
>
Oh, sorry. I mean both. Or to clarify, the "Stale Handle" is a bug that 
I belive has been fixed in CVS already. A fix for the bug that you found 
a good workaround for using getObject().toString() will be commited shortly.

- thomas
 




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 18:32  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 18:32 UTC (permalink / raw)

> Oh, sorry. I mean both. Or to clarify, the "Stale Handle" is a bug that
> I belive has been fixed in CVS already. A fix for the bug that you found
> a good workaround for using getObject().toString() will be commited shortly.
> 
> - thomas

Ok, I'll work on useing the cvs version then.  Out of curiosity, do
you know about when your next release is going to be?


-- 
Joves Luo
Georgia Tech Senior
CS Major
School Email: gtg861b at mail.gatech.edu
Personal Email: Joves.Luo at gmail.com




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 18:35  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 18:35 UTC (permalink / raw)

Joves Luo wrote:

>>Oh, sorry. I mean both. Or to clarify, the "Stale Handle" is a bug that
>>I belive has been fixed in CVS already. A fix for the bug that you found
>>a good workaround for using getObject().toString() will be commited shortly.
>>
>>- thomas
>>    
>>
>
>Ok, I'll work on useing the cvs version then.  Out of curiosity, do
>you know about when your next release is going to be?
>  
>
Barring serious bugs that must be fixed, perhaps by the end of this week.

- thomas





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-29 18:37  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-29 18:37 UTC (permalink / raw)

> Barring serious bugs that must be fixed, perhaps by the end of this week.
> 
> - thomas

Great, I'll try the cvs version and wait for the new release.  I'll
let you know if I get any more problems after that.

Thanks again.
-- 
Joves Luo
Georgia Tech Senior
CS Major
School Email: gtg861b at mail.gatech.edu
Personal Email: Joves.Luo at gmail.com




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-31 19:25  
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-31 19:25 UTC (permalink / raw)

Ohhhh... Excuse me , my errors! but i want to learn pljava! :)  eheheh


So... Now, when i try to run the listSuper function, the erro ERROR:  
java.lang.SecurityException: read on C:\Arquivos de 
programas\PostgreSQL\8.0\pljava\examples.jar, is showed...

Why?

Antonio Carlos

_________________________________________________________________
Chegou o que faltava: MSN Acesso Gr?tis. Instale J?! 
http://www.msn.com.br/discador





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-31 19:52  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-03-31 19:52 UTC (permalink / raw)

Antonio Carlos de Andrade Brito wrote:

> Ohhhh... Excuse me , my errors! but i want to learn pljava! :)  eheheh
>
>
> So... Now, when i try to run the listSuper function, the erro ERROR:  
> java.lang.SecurityException: read on C:\Arquivos de 
> programas\PostgreSQL\8.0\pljava\examples.jar, is showed...

Because you have not done as I suggested and removed it from your 
CLASSPATH. Consequently, the system classloader tries to load it from 
disk instead of from the database.

- thomas





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-03-31 19:58  
  parent: 
  0 siblings, 0 replies; 35+ messages in thread

From:  @ 2005-03-31 19:58 UTC (permalink / raw)

Ok!!!
Excuse me again!! Now is works fine!

  Valeu! ( The same that "Thanks" in portuguese )

Antonio - Brazil, Rio de Janeiro


>From: Thomas Hallgren <thhal at mailblocks.com>
>To: Antonio Carlos de Andrade Brito <acabhgg at hotmail.com>
>CC: pljava-dev at gborg.postgresql.org
>Subject: Re: [Pljava-dev] java.lang.SecurityException
>Date: Thu, 31 Mar 2005 21:52:35 +0200
>
>Antonio Carlos de Andrade Brito wrote:
>
>>Ohhhh... Excuse me , my errors! but i want to learn pljava! :)  eheheh
>>
>>
>>So... Now, when i try to run the listSuper function, the erro ERROR:  
>>java.lang.SecurityException: read on C:\Arquivos de 
>>programas\PostgreSQL\8.0\pljava\examples.jar, is showed...
>
>Because you have not done as I suggested and removed it from your 
>CLASSPATH. Consequently, the system classloader tries to load it from disk 
>instead of from the database.
>
>- thomas
>

_________________________________________________________________
MSN Messenger: converse online com seus amigos .  
http://messenger.msn.com.br





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-04-05 14:20  
  parent: 
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-04-05 14:20 UTC (permalink / raw)

On Mar 29, 2005 2:37 PM, Joves Luo <joves.luo at gmail.com> wrote:
> > Barring serious bugs that must be fixed, perhaps by the end of this week.
> >
> > - thomas
> 

I was wondering if there will be a new release sometime this week.

Thank you,


-- 
Joves Luo
Georgia Tech Senior
CS Major
School Email: gtg861b at mail.gatech.edu
Personal Email: Joves.Luo at gmail.com




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] Re: java.lang.SecurityException
@ 2005-04-06 08:55  
  parent: 
  0 siblings, 0 replies; 35+ messages in thread

From:  @ 2005-04-06 08:55 UTC (permalink / raw)

Joves Luo wrote:
> On Mar 29, 2005 2:37 PM, Joves Luo <joves.luo at gmail.com> wrote:
> 
>>>Barring serious bugs that must be fixed, perhaps by the end of this week.
>>>
>>>- thomas
>>
> 
> I was wondering if there will be a new release sometime this week.
> 
Joves,
I'm still awaiting some input that might indicate that some problem 
remain. I hope to resolve everything and release in matter of days. 
Can't give you an exact date though.

Regards,
Thomas Hallgren





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-04-20 10:15  
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-04-20 10:15 UTC (permalink / raw)

I wrote a litlle class test to see pljava in action. This class named
test.jar and the jar name used in the install routine is test_luca.

My procedure is very simple:

 

public class Test {

 

            public static String test() {

                        String ret = "nu cazz!!!!!!!!";

                        try {

 
Class.forName("org.postgresql.Driver");

                                    String url =
"jdbc:postgresql://myhost/mydb";

                                    Properties props = new Properties();

                                    props.setProperty("user", "user");

                                    props.setProperty("password",
"password");

                                    Connection conn =
DriverManager.getConnection(url, props);

                                    Statement s =
conn.createStatement();

                                    int uid = 13;

                                    String _url = "some url";

                                    String sql = "insert into
request(UID, url) values(" + uid + ", '" + _url + "')";

                                    s.execute(sql);

                                    s.close();

                                    s = conn.createStatement();

                                    sql = "select * from request where
uid = 13";

                                    ResultSet rs = s.executeQuery(sql);

                                    rs.first();

                                    ret = rs.getString("url");

                                    rs.close();

                                    conn.close();

                        } catch (ClassNotFoundException e) {

                                    // TODO Auto-generated catch block

                                    ret = "non ho trovato la classe del
dirver jdbc!!";

                                    //e.printStackTrace();

                        } catch (SQLException e1) {

                                    ret = e1.getMessage();

                                    //e1.printStackTrace();

                        }

                        return ret;

            }

} 

 

when I try to execute this is the result:

SELECT test_luca();

 

ERROR:  java.lang.SecurityException: read on \C:\Program
Files\PostgreSQL\8.0\jdbc\postgresql-8.0-310.jdbc3.jar

 

Some body can help me?

 

Thanks in advance,

Luca

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20050420/7e4d1b18/attachment.html;



^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-04-20 10:20  
  parent: 
  0 siblings, 0 replies; 35+ messages in thread

From:  @ 2005-04-20 10:20 UTC (permalink / raw)

Luca Rasconi wrote:

> I wrote a litlle class test to see pljava in action. This class named 
> test.jar and the jar name used in the install routine is test_luca.
>
> My procedure is very simple:
>
> public class Test {
>
> public static String test() {
>
> String ret = "nu cazz!!!!!!!!";
>
> try {
>
> Class.forName("org.postgresql.Driver");
>
> String url = "jdbc:postgresql://myhost/mydb";
>
> Properties props = new Properties();
>
> props.setProperty("user", "user");
>
> props.setProperty("password", "password");
>
> Connection conn = DriverManager.getConnection(url, props);
>
> Statement s = conn.createStatement();
>
> int uid = 13;
>
> String _url = "some url";
>
> String sql = "insert into request(UID, url) values(" + uid + ", '" + 
> _url + "')";
>
> s.execute(sql);
>
> s.close();
>
> s = conn.createStatement();
>
> sql = "select * from request where uid = 13";
>
> ResultSet rs = s.executeQuery(sql);
>
> rs.first();
>
> ret = rs.getString(?url?);
>
> rs.close();
>
> conn.close();
>
> } catch (ClassNotFoundException e) {
>
> // TODO Auto-generated catch block
>
> ret = "non ho trovato la classe del dirver jdbc!!";
>
> //e.printStackTrace();
>
> } catch (SQLException e1) {
>
> ret = e1.getMessage();
>
> //e1.printStackTrace();
>
> }
>
> return ret;
>
> }
>
> }
>
> when I try to execute this is the result:
>
> SELECT test_luca();
>
> ERROR: java.lang.SecurityException: read on \C:\Program 
> Files\PostgreSQL\8.0\jdbc\postgresql-8.0-310.jdbc3.jar
>
> Some body can help me?
>
1) Don't use the PostgreSQL client jdbc driver inside of PL/Java since 
that will a) create a network connection to another PostgreSQL session 
and b) have a transaction-scope that is decoupled from the 
transaction-scope of the executing function. In order to obtain a 
connection, please do:

Connection conn = DriverManager.getConnection("jdbc.default.connection");

2) Never have anything but the pljava.jar in the postgresql.conf 
variable pljava.classpath or in the CLASSPATH env seen by the postmaster 
process . Jar files *must* be loaded using sqlj.install_jar

Regards,
Thomas Hallgren





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-04-20 10:49  
  0 siblings, 0 replies; 35+ messages in thread

From:  @ 2005-04-20 10:49 UTC (permalink / raw)

-----Original Message-----
From: Thomas Hallgren [mailto:thhal at mailblocks.com] 
Sent: Wednesday, April 20, 2005 12:20 PM
To: Luca Rasconi
Cc: Pljava-dev at gborg.postgresql.org
Subject: Re: [Pljava-dev] java.lang.SecurityException

Luca Rasconi wrote:

> I wrote a litlle class test to see pljava in action. This class named 
> test.jar and the jar name used in the install routine is test_luca.
>
> My procedure is very simple:
>
> public class Test {
>
> public static String test() {
>
> String ret = "nu cazz!!!!!!!!";
>
> try {
>
> Class.forName("org.postgresql.Driver");
>
> String url = "jdbc:postgresql://myhost/mydb";
>
> Properties props = new Properties();
>
> props.setProperty("user", "user");
>
> props.setProperty("password", "password");
>
> Connection conn = DriverManager.getConnection(url, props);
>
> Statement s = conn.createStatement();
>
> int uid = 13;
>
> String _url = "some url";
>
> String sql = "insert into request(UID, url) values(" + uid + ", '" + 
> _url + "')";
>
> s.execute(sql);
>
> s.close();
>
> s = conn.createStatement();
>
> sql = "select * from request where uid = 13";
>
> ResultSet rs = s.executeQuery(sql);
>
> rs.first();
>
> ret = rs.getString("url");
>
> rs.close();
>
> conn.close();
>
> } catch (ClassNotFoundException e) {
>
> // TODO Auto-generated catch block
>
> ret = "non ho trovato la classe del dirver jdbc!!";
>
> //e.printStackTrace();
>
> } catch (SQLException e1) {
>
> ret = e1.getMessage();
>
> //e1.printStackTrace();
>
> }
>
> return ret;
>
> }
>
> }
>
> when I try to execute this is the result:
>
> SELECT test_luca();
>
> ERROR: java.lang.SecurityException: read on \C:\Program 
> Files\PostgreSQL\8.0\jdbc\postgresql-8.0-310.jdbc3.jar
>
> Some body can help me?
>
1) Don't use the PostgreSQL client jdbc driver inside of PL/Java since 
that will a) create a network connection to another PostgreSQL session 
and b) have a transaction-scope that is decoupled from the 
transaction-scope of the executing function. In order to obtain a 
connection, please do:

Connection conn =
DriverManager.getConnection("jdbc.default.connection");

2) Never have anything but the pljava.jar in the postgresql.conf 
variable pljava.classpath or in the CLASSPATH env seen by the postmaster

process . Jar files *must* be loaded using sqlj.install_jar

Regards,
Thomas Hallgren


Ok... but how can DriverManager choose a specific database or user?




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* FW: [Pljava-dev] java.lang.SecurityException
@ 2005-04-20 10:51  
  0 siblings, 0 replies; 35+ messages in thread

From:  @ 2005-04-20 10:51 UTC (permalink / raw)



-----Original Message-----
From: Luca Rasconi 
Sent: Wednesday, April 20, 2005 12:50 PM
To: 'Thomas Hallgren'
Cc: Pljava-dev at gborg.postgresql.org
Subject: RE: [Pljava-dev] java.lang.SecurityException

-----Original Message-----
From: Thomas Hallgren [mailto:thhal at mailblocks.com] 
Sent: Wednesday, April 20, 2005 12:20 PM
To: Luca Rasconi
Cc: Pljava-dev at gborg.postgresql.org
Subject: Re: [Pljava-dev] java.lang.SecurityException

Luca Rasconi wrote:

> I wrote a litlle class test to see pljava in action. This class named 
> test.jar and the jar name used in the install routine is test_luca.
>
> My procedure is very simple:
>
> public class Test {
>
> public static String test() {
>
> String ret = "nu cazz!!!!!!!!";
>
> try {
>
> Class.forName("org.postgresql.Driver");
>
> String url = "jdbc:postgresql://myhost/mydb";
>
> Properties props = new Properties();
>
> props.setProperty("user", "user");
>
> props.setProperty("password", "password");
>
> Connection conn = DriverManager.getConnection(url, props);
>
> Statement s = conn.createStatement();
>
> int uid = 13;
>
> String _url = "some url";
>
> String sql = "insert into request(UID, url) values(" + uid + ", '" + 
> _url + "')";
>
> s.execute(sql);
>
> s.close();
>
> s = conn.createStatement();
>
> sql = "select * from request where uid = 13";
>
> ResultSet rs = s.executeQuery(sql);
>
> rs.first();
>
> ret = rs.getString("url");
>
> rs.close();
>
> conn.close();
>
> } catch (ClassNotFoundException e) {
>
> // TODO Auto-generated catch block
>
> ret = "non ho trovato la classe del dirver jdbc!!";
>
> //e.printStackTrace();
>
> } catch (SQLException e1) {
>
> ret = e1.getMessage();
>
> //e1.printStackTrace();
>
> }
>
> return ret;
>
> }
>
> }
>
> when I try to execute this is the result:
>
> SELECT test_luca();
>
> ERROR: java.lang.SecurityException: read on \C:\Program 
> Files\PostgreSQL\8.0\jdbc\postgresql-8.0-310.jdbc3.jar
>
> Some body can help me?
>
1) Don't use the PostgreSQL client jdbc driver inside of PL/Java since 
that will a) create a network connection to another PostgreSQL session 
and b) have a transaction-scope that is decoupled from the 
transaction-scope of the executing function. In order to obtain a 
connection, please do:

Connection conn =
DriverManager.getConnection("jdbc.default.connection");

2) Never have anything but the pljava.jar in the postgresql.conf 
variable pljava.classpath or in the CLASSPATH env seen by the postmaster

process . Jar files *must* be loaded using sqlj.install_jar

Regards,
Thomas Hallgren


Ok... but how can DriverManager choose a specific database or user?


Sorry!!! Stupid question :-)




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-04-20 11:09  
  0 siblings, 1 reply; 35+ messages in thread

From:  @ 2005-04-20 11:09 UTC (permalink / raw)

I made as you suggested. But the result now is: no suitable driver.
The CLASSPATH does not exist and in the postgresql.conf 
variable pljava.classpath has only pljava.jar.

this is my change in the source

public class Test {

	public static String test() {
		String ret = "nu cazz!!!!!!!!";
		try {
			/*
			Class.forName("org.postgresql.Driver");
			String url =
"jdbc:postgresql://etechsviluppo.cefriel.it/context";
			Properties props = new Properties();
			props.setProperty("user", "context");
			props.setProperty("password", "context");
			Connection conn =
DriverManager.getConnection(url, props);
			*/
			Connection conn =
DriverManager.getConnection("jdbc.default.connection");
			Statement s = conn.createStatement();
			...

thank you,
Luca

-----Original Message-----
From: Thomas Hallgren [mailto:thhal at mailblocks.com] 
Sent: Wednesday, April 20, 2005 12:20 PM
To: Luca Rasconi
Cc: Pljava-dev at gborg.postgresql.org
Subject: Re: [Pljava-dev] java.lang.SecurityException

Luca Rasconi wrote:

> I wrote a litlle class test to see pljava in action. This class named 
> test.jar and the jar name used in the install routine is test_luca.
>
> My procedure is very simple:
>
> public class Test {
>
> public static String test() {
>
> String ret = "nu cazz!!!!!!!!";
>
> try {
>
> Class.forName("org.postgresql.Driver");
>
> String url = "jdbc:postgresql://myhost/mydb";
>
> Properties props = new Properties();
>
> props.setProperty("user", "user");
>
> props.setProperty("password", "password");
>
> Connection conn = DriverManager.getConnection(url, props);
>
> Statement s = conn.createStatement();
>
> int uid = 13;
>
> String _url = "some url";
>
> String sql = "insert into request(UID, url) values(" + uid + ", '" + 
> _url + "')";
>
> s.execute(sql);
>
> s.close();
>
> s = conn.createStatement();
>
> sql = "select * from request where uid = 13";
>
> ResultSet rs = s.executeQuery(sql);
>
> rs.first();
>
> ret = rs.getString("url");
>
> rs.close();
>
> conn.close();
>
> } catch (ClassNotFoundException e) {
>
> // TODO Auto-generated catch block
>
> ret = "non ho trovato la classe del dirver jdbc!!";
>
> //e.printStackTrace();
>
> } catch (SQLException e1) {
>
> ret = e1.getMessage();
>
> //e1.printStackTrace();
>
> }
>
> return ret;
>
> }
>
> }
>
> when I try to execute this is the result:
>
> SELECT test_luca();
>
> ERROR: java.lang.SecurityException: read on \C:\Program 
> Files\PostgreSQL\8.0\jdbc\postgresql-8.0-310.jdbc3.jar
>
> Some body can help me?
>
1) Don't use the PostgreSQL client jdbc driver inside of PL/Java since 
that will a) create a network connection to another PostgreSQL session 
and b) have a transaction-scope that is decoupled from the 
transaction-scope of the executing function. In order to obtain a 
connection, please do:

Connection conn =
DriverManager.getConnection("jdbc.default.connection");

2) Never have anything but the pljava.jar in the postgresql.conf 
variable pljava.classpath or in the CLASSPATH env seen by the postmaster

process . Jar files *must* be loaded using sqlj.install_jar

Regards,
Thomas Hallgren





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* [Pljava-dev] java.lang.SecurityException
@ 2005-04-20 11:26  
  parent: 
  0 siblings, 0 replies; 35+ messages in thread

From:  @ 2005-04-20 11:26 UTC (permalink / raw)


----- Original Message ----- 
From: "Luca Rasconi" <Luca.Rasconi at students.cefriel.it>
To: "Thomas Hallgren" <thhal at mailblocks.com>
Cc: <Pljava-dev at gborg.postgresql.org>
Sent: Wednesday, April 20, 2005 1:09 PM
Subject: RE: [Pljava-dev] java.lang.SecurityException


> I made as you suggested. But the result now is: no suitable driver.

You should use

jdbc:default:connection

(colons instead of dots)

Filip



> The CLASSPATH does not exist and in the postgresql.conf 
> variable pljava.classpath has only pljava.jar.
> 
> this is my change in the source
> 
> public class Test {
> 
> public static String test() {
> String ret = "nu cazz!!!!!!!!";
> try {
> /*
> Class.forName("org.postgresql.Driver");
> String url =
> "jdbc:postgresql://etechsviluppo.cefriel.it/context";
> Properties props = new Properties();
> props.setProperty("user", "context");
> props.setProperty("password", "context");
> Connection conn =
> DriverManager.getConnection(url, props);
> */
> Connection conn =
> DriverManager.getConnection("jdbc.default.connection");
> Statement s = conn.createStatement();
> ...
> 
> thank you,
> Luca
> 
> -----Original Message-----
> From: Thomas Hallgren [mailto:thhal at mailblocks.com] 
> Sent: Wednesday, April 20, 2005 12:20 PM
> To: Luca Rasconi
> Cc: Pljava-dev at gborg.postgresql.org
> Subject: Re: [Pljava-dev] java.lang.SecurityException
> 
> Luca Rasconi wrote:
> 
> > I wrote a litlle class test to see pljava in action. This class named 
> > test.jar and the jar name used in the install routine is test_luca.
> >
> > My procedure is very simple:
> >
> > public class Test {
> >
> > public static String test() {
> >
> > String ret = "nu cazz!!!!!!!!";
> >
> > try {
> >
> > Class.forName("org.postgresql.Driver");
> >
> > String url = "jdbc:postgresql://myhost/mydb";
> >
> > Properties props = new Properties();
> >
> > props.setProperty("user", "user");
> >
> > props.setProperty("password", "password");
> >
> > Connection conn = DriverManager.getConnection(url, props);
> >
> > Statement s = conn.createStatement();
> >
> > int uid = 13;
> >
> > String _url = "some url";
> >
> > String sql = "insert into request(UID, url) values(" + uid + ", '" + 
> > _url + "')";
> >
> > s.execute(sql);
> >
> > s.close();
> >
> > s = conn.createStatement();
> >
> > sql = "select * from request where uid = 13";
> >
> > ResultSet rs = s.executeQuery(sql);
> >
> > rs.first();
> >
> > ret = rs.getString("url");
> >
> > rs.close();
> >
> > conn.close();
> >
> > } catch (ClassNotFoundException e) {
> >
> > // TODO Auto-generated catch block
> >
> > ret = "non ho trovato la classe del dirver jdbc!!";
> >
> > //e.printStackTrace();
> >
> > } catch (SQLException e1) {
> >
> > ret = e1.getMessage();
> >
> > //e1.printStackTrace();
> >
> > }
> >
> > return ret;
> >
> > }
> >
> > }
> >
> > when I try to execute this is the result:
> >
> > SELECT test_luca();
> >
> > ERROR: java.lang.SecurityException: read on \C:\Program 
> > Files\PostgreSQL\8.0\jdbc\postgresql-8.0-310.jdbc3.jar
> >
> > Some body can help me?
> >
> 1) Don't use the PostgreSQL client jdbc driver inside of PL/Java since 
> that will a) create a network connection to another PostgreSQL session 
> and b) have a transaction-scope that is decoupled from the 
> transaction-scope of the executing function. In order to obtain a 
> connection, please do:
> 
> Connection conn =
> DriverManager.getConnection("jdbc.default.connection");
> 
> 2) Never have anything but the pljava.jar in the postgresql.conf 
> variable pljava.classpath or in the CLASSPATH env seen by the postmaster
> 
> process . Jar files *must* be loaded using sqlj.install_jar
> 
> Regards,
> Thomas Hallgren
> 
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/pljava-dev




^ permalink  raw  reply  [nested|flat] 35+ messages in thread


end of thread, other threads:[~2005-04-20 11:26 UTC | newest]

Thread overview: 35+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-28 16:42 [Pljava-dev] java.lang.SecurityException 
2005-03-28 16:50 ` 
2005-03-28 17:02 [Pljava-dev] java.lang.SecurityException 
2005-03-28 18:15 ` 
2005-03-28 19:02 [Pljava-dev] java.lang.SecurityException 
2005-03-28 19:09 ` 
2005-03-28 19:34 [Pljava-dev] java.lang.SecurityException 
2005-03-28 21:01 ` 
2005-03-28 22:01 [Pljava-dev] java.lang.SecurityException 
2005-03-29 06:14 ` 
2005-03-29 06:59   ` 
2005-03-29 15:52 [Pljava-dev] java.lang.SecurityException 
2005-03-29 16:12 ` 
2005-03-29 16:20   ` 
2005-03-29 16:25     ` 
2005-03-29 16:41       ` 
2005-03-29 16:51         ` 
2005-03-29 17:12           ` 
2005-03-29 17:17             ` 
2005-03-29 18:10               ` 
2005-03-29 18:20                 ` 
2005-03-29 18:32                   ` 
2005-03-29 18:35                     ` 
2005-03-29 18:37                       ` 
2005-04-05 14:20                         ` 
2005-04-06 08:55                           ` 
2005-03-31 19:25 [Pljava-dev] java.lang.SecurityException 
2005-03-31 19:52 ` 
2005-03-31 19:58   ` 
2005-04-20 10:15 [Pljava-dev] java.lang.SecurityException 
2005-04-20 10:20 ` 
2005-04-20 10:49 [Pljava-dev] java.lang.SecurityException 
2005-04-20 10:51 FW: [Pljava-dev] java.lang.SecurityException 
2005-04-20 11:09 [Pljava-dev] java.lang.SecurityException 
2005-04-20 11:26 ` 

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox