Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Jave Stored Proc fails when using Socket
All,
I am having problems using a client Sockt from a java stored procedure on Oracle 8i for NT.
The Socket is used to send a string to a server process, which returns another string. The code works intermittently, and also, seems to leak handles, as the process handle count always goes up by 4 for each call.
Is this a bug, or am I doing something wrong? Code follows:
Rob.
public static String sendstr(String strIn) {
String strOut = null; Socket sock = null; InputStream strm_in = null; OutputStream strm_out = null; try
{
InetAddress ia = InetAddress.getByName("localhost"); sock = new Socket(ia, 9090); strm_in = sock.getInputStream(); InputStreamReader isr = new InputStreamReader(strm_in); BufferedReader in = new BufferedReader(isr); strm_out = sock.getOutputStream(); PrintWriter out = new PrintWriter(strm_out, true); out.println(strIn); strOut = in.readLine(); } catch (Exception e)
{
strOut = e.toString(); } finally
{
try { if (sock != null) { sock.close(); } } catch (IOException e) { strOut = e.toString(); } } return strOut;
![]() |
![]() |