-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
running-java-within-postgres comment #3
Comments
Hey @jcflack, thanks for reaching out and giving feedback on the article. I'll add the missing links/parts in the blog post. Thank you! |
You're welcome. :) I noticed another thing:
To be honest, PL/Java doesn't really care whether the URL is relative or absolute, certainly not enough to put "fully-qualified" in boldface.
would load You can also give an absolute Cheers! |
I've updated the post: https://rieckpil.de/howto-writing-postgresql-functions-with-java-using-pl-java/. You can have a second look and give me feedback if you want. Thank you very much! |
It looks good. The "install with apt-get" section skips a little too far ahead: it is still necessary to In neither case should it be necessary to
I might say something like "this is not a conventional JDBC connection to a new postgres backend, but rather direct access into the current backend through the JDBC API." The word 'than' is extraneous. 'Rather' can work two ways in English, with and without 'than', and the JDBC sentence is of the second type:
Thanks! |
I remembered one more thing I meant to mention. Before I forget it again:
Could be done as:
so that both the Even this way would work:
where only the But auto-closing a |
@jcflack I've updated the post again. Thanks for your patience |
I see another possible refinement: :)
A user with Once a function is created, any user with Depending on your security requirements, you might want the same user to be able to create new functions and to use existing ones, or you might want an application user only to be able to execute existing functions, while reserving the privilege of creating functions to a different user, or even only to superusers (in which case no |
Hi!
Thanks for the blog post about PL/Java. I noticed a couple of things that might allow it to be simplified.
apt-get install postgresql-server-9.6 postgresql-9.6-pljava
(along with whatever other packages you need at run time). There is then no need for maven, gcc, git, or any build-from-source process.default-java
, so that package will be pulled in if you don't have it, without needing to be requested.SET pljava.libjvm_location
as the packager has compiled in a default value that refers to the normaldefault-java
package. Therefore, thepljava.libjvm_location
variable only needs to be set if you wish to run PL/Java with a different Java runtime than the default.postgres
is a superuser in your database, there is no real need forGRANT USAGE ON LANGUAGE java TO postgres;
.jdbc:default:connection
is not a conventional JDBC connection (it does not use PG's network protocol to converse with the backend); it is simply a shim that presents direct internal access to the backend via the familiar JDBC API.Connection
s,Statement
s, orResultSet
s. (In PL/Java, forConnection
it doesn't really matter, as that shim "connection" never closes anyway. But it is harmless, and forStatement
orResultSet
it can ensure resources are released.)@Function
annotation does not have acomment
attribute, but the function has a javadoc comment, the first sentence of the javadoc will be used as the SQL function comment.But those are minor points. I think the post did quite a good job covering the basics.
A couple more direct links into the documentation that might be helpful are to the Hello, world example (which is much like your own example but has a "further reading" list at the bottom) and, for production environments, the VM option recommendations page: Java's default VM options on a server machine kind of assume it has the machine to itself, and some tweaks to those options can greatly reduce its footprint when running in PostgreSQL.
Thanks for the coverage!
The text was updated successfully, but these errors were encountered: