-
Notifications
You must be signed in to change notification settings - Fork 80
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
pljava.ddr This script file related issues #491
Comments
That's exactly what it's for. For that to happen, the
and the If you have not yet worked through the Hello, world example in PL/Java's user guide, I recommend starting there. The basic usage of the annotations and deployment of a jar with a Going beyond the Hello, world, there are plenty of examples of the annotations in use to be found in PL/Java's own example classes. The reference material for the annotations, you will find in the javadocs.
If the above references do not get you started, you might want to look at the very thorough example constructed by Bear Giles in which he creates a |
Hi, DEBUG: StartTransaction(1) name: unnamed; blockState: DEFAULT; state: INPROGRESS, xid/subid/cid: 0/1/0 Error: java.sql.SQLException LINE 1: INSERT into udt_test VALUES (1, '(1, 2)'); ^ ERROR: java.sql.SQLException SQL status: XX000 characters: 33 Here is the error stack when I inserted the udt using java's jdbc: org.postgresql.util.PSQLException: ERROR: java.sql.SQLException I have no idea how to solve this problem, and I would be grateful if you could give me a little help. |
PL/Java code runs in the database server, not the client. So an exception stacktrace that matters will be one from PL/Java in the server, not one from JDBC in the client. If you do
on a new connection, before any first use of a PL/Java function, then PL/Java exceptions will include stacktraces. The stacktraces, however, only go to the database server's standard error channel. That will be included in the server log if (In my earlier message I suggested to set |
Yes, I have tried Error: java.sql.SQLException ERROR: java.sql.SQLException If what I have done is still wrong, I would appreciate it if you could tell me in more detail what I should do. |
Yes, I have tried
before any first use of a PL/Java function and I have run the PL/Java function in my ubuntu server.And it still hint these:
If what I have done is still wrong, I would appreciate it if you could tell me in more detail what I should do. |
It will be difficult or impossible to help without the server-side (not client-side) stacktrace mentioned earlier. |
Hi,
I would appreciate it if you could tell me in more detail what I should do. |
Can you include the code of your Also, I see that you are using Java 11. A feature in Java 14 and later, helpful It is easy to change the Java version PL/Java will use. No rebuilding is required. It is enough to install another version of Java and change the setting of |
This is my parse method:
Sorry, I don't understand what you mean. Do you mean that I need to use a newer version of java or an older version of java? I would appreciate it if you could give me a more specific description.
|
You don't need to do anything. Java 11 is ok. I merely mentioned it is rather old, and newer versions have added useful features. If you use Java 14 or later, you get extra information with But that's not critical for this case: the exception is coming from the Java library. In Java 11 you just get
In any case, it's clear that a null argument has been passed to Can you attach the jar file you have installed into PostgreSQL for this test? |
This is the jar package I installed into PostgreSQL.
I used to use jdk version 17, but when working with a database in PostgreSQL, I was told that the version did not match.
Thank you very much for providing me with the above information. But I am only a beginner and it may be difficult for me to understand this official document. From the parse function I can't really see why an empty argument was passed to Double.parseDouble. I would appreciate it if you could give me a more specific description. |
Who, or what, told you that? If it was a message you were shown, can you include it? |
In the source code you attached in an earlier comment,
That looks correct as far as I can see. The However, when I inspect the jar file you attached: javap -classpath udt_test/UDT.jar -c com.example.udt.Point I think that this jar file does not correspond to the source code you showed earlier. It looks as if you made a later edit to the source, but didn't build a new jar file with the recompiled classes to load into PostgreSQL. The key difference is in how the parameters to the
(The However, the second constructor parameter is computed this way:
This code is calling I think if you make sure to compile your current source code (as you showed it earlier), and build a jar file from the new compiled classes, and use There are some other changes you might want to consider. (I understand that
If you are a beginner, you may be unfamiliar with the
The link I gave in that case was simply to the GitHub repository for the Java library source code itself, showing the line 1838 where the stacktrace you supplied showed the |
When I import the Pljava-API dependency into java, at which point I can use some of the features of pljava in java, I can then type my project into a jar package with maven and install the jar package into the postgresql database using the install_jar method.
My first problem is that some of the annotations in the pljava-api dependencies, such as @function, @MappedUDT, @BaseUDT, etc., I can't figure out how to use them.
My second problem is that I don't understand what the pljava.ddr file is for. Will the contents of the.ddr script file be automatically executed when I install the jar package into postgresql? If so, some of the methods I defined in java or some of the entity types I defined in java such as Complex need to be used in postgresql, then how do I properly generate the.ddr file, How to correctly map a Complex class and its methods in java to a postgresql database. If not, how am I supposed to install some of the entity types, methods, operators, and cast I defined in java properly into postgresql for use?
I'm very new to pljava. Any help would be really appreciated.
java version - 11
postgresql version -14
apache maven - 3.9.6
The text was updated successfully, but these errors were encountered: