在Oracle中创建java类,该类中创建Socket连接失败
create or replace and compile java source named clientsocket as
import java.io.*;
import java.net.*;
public class ClientSocket {
static int result=0;
public static void main(String args[]){
ClientSocket sc=new ClientSocket();
sc.sendmessage();
}
public static int sendmessage(){
try{
Socket s = new Socket("192.68.69.96", 8111);
result=1;
}
catch(SecurityException e){
result=2;
System.out.println("securityexception when connecting server!");
}
catch(IOException e){
result=3;
System.out.println("ioexception when connecting server!");
}
return result;
}
}
运行后result=2