Ich habe Probleme beim Aufruf einer PostgreSQL-Funktion von JDBC mit den folgenden Umständen. Gespeicherte Funktion endpoint_organizations
wird wie folgt definiert:Ausnahme "Funktion existiert nicht" beim Ausführen von PostgreSQL gespeicherten Funktion über JDBC
postgres=# \df public.endpoint_organizations
List of functions
Schema | Name | Result data type | Argument data types | Type
--------+------------------------+------------------------------------------+---------------------+--------
public | endpoint_organizations | TABLE(organizationid integer, name text) | staffid1 integer | normal
(1 row)
Ich bin es von Java wie folgt aufrufen:
int staffId = 1
PreparedStatement endpointOrganizations = connection.prepareStatement("SELECT * FROM endpoint_organizations (?)");
endpointOrganizations.setInt(1, staffId);
ResultSet resultSet = endpointOrganizations.executeQuery();
Und ich erhalte diese Ausnahme:
org.postgresql.util.PSQLException:
ERROR: function endpoint_organizations(integer) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Position: 15
Was könnte der Grund sein, warum ? Wenn ich mich nicht irre, hat das früher funktioniert. Ich habe jetzt zweimal überprüft und dreifach überprüft, aber sehe nicht, was das Problem verursachen könnte.
Haben Sie die Berechtigung, diese Funktion mit dem Benutzer jdbc auszuführen? Wenn nicht, gewähren Sie Ausführen an der Funktion endpoint_organizations; – d1ll1nger
@ d1ll1nger Ja, ich habe. Wenn ich 'psql -U' in die Datenbank und 'Select * von endpoint_organizations (1)' da, dann funktioniert es gut. –
Drux