Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Jave Stored Proc fails when using Socket

Jave Stored Proc fails when using Socket

From: Rob Groves <rob.groves_at_btinternet.com>
Date: Wed, 01 Sep 1999 22:14:13 GMT
Message-ID: <37cda339.1088052@news.btinternet.com>


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;

} Received on Wed Sep 01 1999 - 17:14:13 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US