-
Hi,
I have questions regarding making https connections from a Java stored procedure in Oracle. Below are the details of the scenario, followed by the questions:
The software:
Oracle 8.1.7
Aurora JVM 1.2.1
The Objective:
To develop a Java stored procedure in Oracle, wrapped in an Oracle Stored Procedure, that can make an HTTPS connection to a remote host. The java stored procedure will call a PERL script on that remote host via an HTTPS URL address, listen to a reply, and parse the response data.
The problem:
The stored procedure seems capable of making the https connection, but when it attempts to read data from the incoming data stream Oracle returns the error:
ORA-03113: end-of-file on communication channel
Then, if I try to run the program again, I get the following:
ORA-03114: not connected to ORACLE
The Java code being used is as follows:
create or replace and compile java source named "ModemQuery" as
import java.io.*;
import java.lang.*;
import java.util.*;
import java.net.*;
import oracle.sql.*;
public class ModemQuery {
private static URL url = null;
private static HttpURLConnection connection = null;
private static OutputStream response = null;
private static OutputStream out = null;
private static InputStreamReader in = null;
private static StringBuffer returnData = new StringBuffer();
private static String data;
public static String doPost(String mac) {
data = "stuff";
openConnection();
getResponse();
return returnData.toString();
}
// This method opens an https connection
private static void openConnection() {
System.setProperty("java.protocol.handler.pkgs", "HTTPClient");
returnData.append("In oC method: ");
try {
url = new URL("https://some.ip.address:443/perl_program.pl?var=" + data );
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setUseCaches(false);
}
catch(Exception e)
{
returnData.append("oC Exception: " + e.toString());
}
}
// This method reads the incoming data
private static void getResponse() {
returnData.append("In gR method: ");
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
returnData = new StringBuffer();
String line;
while((line = reader.readLine()) != null) {
returnData.append(line+"\n");
}
reader.close();
reader = null;
}
catch(Exception e)
{
returnData.append("gR Exception: " + e.toString());
}
}
}
/
show errors
The code gets as far as openConnection without generating any exceptions, but when it gets to getResponse() Oracle generates error 03113
Questions:
What about this code could be causing me to lose my connection to Oracle?
I believe I have the permissions set correctly, but is there some other configuration on the database side that needs to be done before I can run this program?
If anyone has ever tried something similar to this, could you please let me know?
Thanks for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|