views:

83

answers:

2

Although I found PL/Java a powerful add-on for PostgreSQL, I couldn't find a way of remotely debug the clases loaded on the PSQL DBMS.

Is this possible to achieve?

Thanks in advance!

A: 

I suppose you could set pljava.vmoptions to enable debugging and include a port number to listen on, and then use Eclipse's "debug remote application" launcher to connect to it.

So a JVM option -agentlib:jdwp=transport=dt_socket,suspend=n,address=localhost:55000 will make the JVM listen on port 55000 for debuggers. You then open the "Debug configurations.." dialogue in Eclipse, right click "Remote Java Application" in the launch types pane on the left and update the connection properties on the right to use port 55000. You should connect up the debug launcher with a project as well, to pick up that project's class path and sources.

Note I haven't actually tried this in postgresql, but this corresponds to how I always used to run JBoss from a shell script rather than from within Eclipse.

araqnid
Thanks for the tip! Like you, I also debug JBoss that way with no problems at all. However, for some reason I can't get it to work with PL/Java. What I did:1. Add the line " pljava.vmoptions = ... " in postgresql.conf2. Create and configure a new Launch Configuration (Eclipse)3. Start postgresql4. Launch the Remote Java Application -> Cannot connect to VMAm I doing something wrong?
Federico Cristina
Selected this answer as the right one (although for the moment I couldn't make it work) because it should be the right way of doing it.
Federico Cristina
+1  A: 

I needed a slight change to the option line. The working one is-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=localhost:8000. Without the server=y part, the debugger complains about missing transport. With the above, everything worked.

Juho Östman