Hi,
We are trying to compile following class in Oracle database 23c. However, we are encountering surprising error (we are not using ANY database link:
Error report -
ORA-04054: database link MYOPTIMIUM does not exist
04054. 00000 - "database link %s does not exist"
*Cause: During compilation of a PL/SQL block, an attempt was made to use
a non-existent database link.
*Action: Either use a different database link or create the database link.
Java class:
create or replace and compile java source named "llm" as
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.sql.Clob;
import java.sql.SQLException;
import javax.script.ScriptEngineFactory;
import javax.script.ScriptEngineManager;
public class llm {
public static String postPrompt(String appSource, String appSourceID, String targetllm, String param4, Clob pprompt) throws IOException, SQLException {
try (Reader reader = pprompt.getCharacterStream()) {
if (reader != null) {
try (BufferedReader bufferedReader = new BufferedReader(reader)) {
StringBuilder stringBuilder = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line);
}
String clobData = stringBuilder.toString();
ProcessBuilder pb = new ProcessBuilder("python3", "/opt/oracle/Optimium/python/app/optimium/invokellm.py", appSource, appSourceID, targetllm, param4, clobData);
Process p = pb.start();
StringBuilder out = new StringBuilder();
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String thisLine;
while ((thisLine = in.readLine()) != null) {
out.append(thisLine);
}
return out.toString();
}
}
}
return "";
}
}
/
Thanks
Sammeer
I think you'll need to log an SR for that one, because I can't reproduce here
SQL> create or replace and compile java source named "llm" as
2 import java.io.BufferedReader;
3 import java.io.IOException;
4 import java.io.InputStreamReader;
5 import java.io.Reader;
6 import java.sql.Clob;
7 import java.sql.SQLException;
8 import javax.script.ScriptEngineFactory;
9 import javax.script.ScriptEngineManager;
10
11 public class llm {
12 public static String postPrompt(String appSource, String appSourceID, String targetllm, String param4, Clob pprompt) throws IOException, SQLException {
13 try (Reader reader = pprompt.getCharacterStream()) {
14 if (reader != null) {
15 try (BufferedReader bufferedReader = new BufferedReader(reader)) {
16 StringBuilder stringBuilder = new StringBuilder();
17 String line;
18 while ((line = bufferedReader.readLine()) != null) {
19 stringBuilder.append(line);
20 }
21 String clobData = stringBuilder.toString();
22 ProcessBuilder pb = new ProcessBuilder("python3", "/opt/oracle/Optimium/python/app/optimium/invokellm.py", appSource, appSourceID, targetllm, param4, clobData);
23 Process p = pb.start();
24 StringBuilder out = new StringBuilder();
25 BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
26 String thisLine;
27 while ((thisLine = in.readLine()) != null) {
28 out.append(thisLine);
29 }
30 return out.toString();
31 }
32 }
33 }
34 return "";
35 }
36 }
37 /
Java created.