Closed Houtx closed 8 months ago
Hello,
I cannot read the localized messages, but from the SQLSTATE 42710 in the last screenshot, I infer it is saying the extension has already been created. Just a few comments:
pljava.classpath
setting in postgresql.conf
. PL/Java has not even had a variable by that name since a rather old version, so that line has no effect.pljava
. It creates two languages by default, one named java
and one named javaU
. So try simply LANGUAGE java
instead of LANGUAGE pljava
.return "Hello from Java!";
, into the AS
string. The AS
string must refer to a public static
method in a Java class that you have already compiled, and loaded into PostgreSQL in a jar file.CREATE FUNCTION
declaration properly is to let the Java compiler do it, using annotations you place on the method in the Java source.There is a step-by-step "Hello, world"-style example here:
https://tada.github.io/pljava/use/hello.html
I am sorry that it is only available in English.
@jcflack I found that the previous installation method was wrong, and I have successfully reinstalled pljava1.6.6 into postgresql15. Then I want to package a jar according to the sample program, but pljava-api cannot be found in maven. What is the reason or from which repository can I download dependency?
Building and uploading the api jar to an online repo has been on the wish list for a long time, but still needs attention. One complication is coordinating the use of the org.postgresql
space, which the PL/Java project doesn't control.
But if you have installed PL/Java 1.6.6 on your PostgreSQL server, you already have the pljava-api-1.6.6.jar
on your server, in $(pg_config --sharedir)/pljava
and you can copy it from there, adding to your local Maven repository if that is what's most convenient.
Or, of course, if you build PL/Java from source using Maven, the API jar ends up in your local repository as a matter of course.
Building and uploading the api jar to an online repo has been on the wish list for a long time, but still needs attention. One complication is coordinating the use of the
org.postgresql
space, which the PL/Java project doesn't control.But if you have installed PL/Java 1.6.6 on your PostgreSQL server, you already have the
pljava-api-1.6.6.jar
on your server, in$(pg_config --sharedir)/pljava
and you can copy it from there, adding to your local Maven repository if that is what's most convenient.Or, of course, if you build PL/Java from source using Maven, the API jar ends up in your local repository as a matter of course.
Thanks, following this program will solve it!
postgresql 15、java 11、pljava1.6.6
Always prompts that the language pljava does not exist!
![image](https://github.com/tada/pljava/assets/17922172/8423905b-89f6-49ee-bf78-320b1f683280)