Procedure or Java Stored procedure to send message/xml/data to MQ Series Qu
Hi
Using a simple Oracle Procedure or Oracle's Java stored procedure, I would like to send data to MQ Queue. It would be great if someone can help me with a piece of sample code.
Thanks in Advance
-GV
Hi Prabhu, Vlad
This is the same question which i asked few days back.
Our Backend system, only understands ISO8583 message format. And since I work in a financial environment, I can only send and receive data using "socket" protocol (tcp/ip).
So, This is where I have stuck forever...
I create a BS. select "any xml" . Then, I select "socket" as protocol. and click on finish.
Then, I create a Proxy Service based on my BS.
But, where/how do I convert the input xml packet into an ISO8583 format and send it over to my backend system ???
salil
Similar Messages
-
Oracle stored procedure to Java stored procedure
Hello,
I got a school assignement "Create a java stored procedure and call it out from JAVA program outside database".
I've done it, but in case of JAVA stored procedure I have the procedure written in PL/SQL.
PL/SQL procedure:
CREATE OR REPLACE PROCEDURE getDogInfo
(Dog_ID IN NUMBER, Dog_name OUT VARCHAR) AS
BEGIN
SELECT Name INTO Dog_name
FROM Dog_family
WHERE ID = Dog_ID;
END;
How do I convert it to JAVA stored procedure?
Maybe it's just plain stupid and I should keep it as PL/SQL? I don't know if I have done it right.
Also I don't know what to do with IN/OUT parameters in JAVA.Could my procedure java class look something like this? I am aware that I have to make a PL/SQL function that is associated with JAVA method CALL, just asking about JAVA Class at the moment.
import java.sql.*;
import java.io.*;
public class Procedure {
public static void getDogInfo (int Dog_ID, String Dog_name)
throws SQLException
{ String sql =
"SELECT Dog_name INTO Name FROM Dog_family WHERE ID = Dog_ID";
try { Connection conn = DriverManager.getConnection("jdbc:default:connection:");
PreparedStatement apstmt = conn.prepareStatement(sql);
apstmt.setInt(1, Dog_ID);
apstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
ResultSet rset = apstmt.executeQuery();
rset.close();
apstmt.close(); //Connection close
catch (SQLException e) {System.err.println(e.getMessage());
My java program looks like this:
package client;
import java.sql.*;
public class JDBCPiemers {
static final String JDBC_DRIVER = "oracle.jdbc.OracleDriver";
static final String DB_URL = "jdbc:oracle:thin:@localhost:1521:ORCL";
static final String USER = "SYSTEM";
static final String PASS = "asdasd";
private String sql;
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Connection conn = null;
CallableStatement stmt = null;
try {
//Registering JDBC driver
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Connecting to database ...");
conn = DriverManager.getConnection(DB_URL, USER, PASS);
System.out.println("Preparing command...");
String SQL = "{CALL getDogInfo (?, ?)}";
stmt = conn.prepareCall(SQL);
int Dog_ID = 4;
stmt.setInt(1,Dog_ID);
stmt.registerOutParameter(2, java.sql.Types.VARCHAR);
System.out.println("CALL of JAVA stored procedure ...");
// Executing SQL
stmt.execute();
//Using getXXX method
String Name = stmt.getString(2);
System.out.println("Printing results ...");
System.out.println("ID NR. " +Dog_ID + " is Dog with
a name '" + Name + "'" );
stmt.close();
conn.close(); }
catch(SQLException se) {
//JDBC Errors
se.printStackTrace(); }
catch(Exception e) {
//Errors Class.forName
e.printStackTrace(); }
finally {
//Clossing resurses
try {if(stmt!=null)
stmt.close(); }
catch(SQLException se2) {}
try {if(conn!=null)
conn.close(); }
catch(SQLException se) {se.printStackTrace(); }
//finally block end
} // try
System.out.println("Closing program."); }} -
How to retrieve 'long' column with 32K length in Java stored procedure
For some reasons, we are not using CLOB, BLOB, or BFILE to store large objects and I have to live with LONG. So I wrote a Java stored procedure to insert, select and manipulate a LONG column by retrieving the LONG into a java.lang.String class (which happens to be the Java class mapped to the LONG SQL datatype). It all works fine as long as the length of the value being retrieved is less than the magic figure of 32767 bytes (which is the restriction on LONG and VARCHAR2 datatype in PL/SQL as well). So looks like Oracle's implementation of the JVM limits String values to a max of 32767 bytes. Suggestions on how to overcome this limitation (other classes that you suggest or do I have to move to files)?
Thanks,
Jeet
nullthe jvm has nothing to do with it ...
this is a pol/sql limitation on parameters in stored procedures.
and java stored procedures require a clal spec that makes the j-s-p look like a pl/qsl stored proc. -
Java stored procedures connection context
In my Oracle database there are two java stored procedures:
A java stored procedure P1 having
Connection conn1 = DriverManager.getConnection("jdbc:default:connection")
and
a java stored procedure P2 having
Connection conn2 = DriverManager.getConnection("jdbc:default:connection")
P1 calls P2 using conn1.CallableStatement.
Here is the question: does P2 inherit the connection
context conn1 (so that actualy conn2 = conn1) or P2's transactional
scope is separate from P1's one?
Thanks,
-EugeneAFAIK, when you run Java in the database, for local SQL data access, there is only one default connection per session, P1 and P2 should share the same transaction context.
Kuassi -
Issue with sending mail through java stored procedure in Oracle
Hello
I am using Oracle 9i DB. I created a java stored procedure to send mail using the code given below. The java class works fine standalone. When its run from Java, mail is sent as desired. But when the java stored procedure is called from pl/sql "Must issue a STARTTLS command first" error is thrown. Please let me know if am missing something. Tried the same code in 11.2.0.2 DB and got the same error
Error:
javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. va6sm31201010igc.6
Code for creating java stored procedure: (T1 is the table created for debugging)
==================================================
create or replace and compile java source named "MailUtil1" AS
import java.util.Enumeration;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class MailUtil1 {
public static void sendMailwithSTARTTLS(String host, //smtp.projectp.com
String from, //sender mail id
String fromPwd,//sender mail pwd
String port,//587
String to,//recepient email ids
String cc,
String subject,
String messageBody) {
try{
Properties props = System.getProperties();
props.put("mail.smtp.starttls.enable", "True"); // added this line
props.put("mail.smtp.host", host);
props.put("mail.smtp.user", from);
props.put("mail.smtp.password", fromPwd);
props.put("mail.smtp.port", port);
props.put("mail.smtp.auth", "true");
#sql { insert into t1 (c1) values ('1'||:host)};
Session session = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
#sql { insert into t1 (c1) values ('2')};
InternetAddress[] toAddress = new InternetAddress[1];
// To get the array of addresses
for( int i=0; i < toAddress.length; i++ ) { // changed from a while loop
toAddress[i] = new InternetAddress(to);
//System.out.println(Message.RecipientType.TO);
for( int i=0; i < toAddress.length; i++) { // changed from a while loop
message.addRecipient(Message.RecipientType.TO, toAddress);
if (cc!=null) {
InternetAddress [] ccAddress = new InternetAddress[1];
for(int j=0;j<ccAddress.length;j++){
ccAddress[j] = new InternetAddress(cc);
for (int j=0;j<ccAddress.length;j++){
message.addRecipient(Message.RecipientType.CC, ccAddress[j]);
message.setSubject(subject);
message.setText(messageBody);
message.saveChanges();
#sql { insert into t1 (c1) values ('3')};
Enumeration en = message.getAllHeaderLines();
String token;
while(en.hasMoreElements()){
token ="E:"+en.nextElement().toString();
#sql { insert into t1 (c1) values (:token)};
token ="ConTyp:"+message.getContentType();
#sql { insert into t1 (c1) values (:token)};
token = "Encod:"+message.getEncoding();
#sql { insert into t1 (c1) values (:token)};
token = "Con:"+message.getContent();
#sql { insert into t1 (c1) values (:token)};
Transport transport = session.getTransport("smtp");
#sql { insert into t1 (c1) values ('3.1')};
transport.connect(host, from, fromPwd);
#sql { insert into t1 (c1) values ('3.2')};
transport.sendMessage(message, message.getAllRecipients());
#sql { insert into t1 (c1) values ('3.3')};
transport.close();
#sql { insert into t1 (c1) values ('4')};
catch(Exception e){
e.printStackTrace();
String ex= e.toString();
try{
#sql { insert into t1 (c1) values (:ex)};
catch(Exception e1)
Edited by: user12050615 on Jan 16, 2012 12:18 AMHello,
Thanks for the reply. Actually I have seen that post before creating this thread. I thought that I could make use of java mail to work around this problem. I created a java class that succesfully sends mail to SSL host. I tried to call this java class from pl-sql through java stored procedure. That did not work
So, is this not supported in Oracle ? Please note that I have tested this in both 9i and 11g , in both the versions I got the error. You can refer to the code in the above post.
Thanks
Srikanth
Edited by: user12050615 on Jan 16, 2012 12:17 AM -
Sending mail in a Java Stored Procedure
Question: What is the best way to have a Java Stored Procedure connect to our mailhost and send an email? I have been trying to use URL and URLConnection, but I found out URL somehow does not support the "mailto" protocol in the Java Stored Procedure. Funny enough the "mailto" protocol is definetely supported by URL when I test it in the JDK virtual machine.
Maybe this is the reason: I read in the 8i docs that the 8i Virtual Machine is only JDK1.1.6 compliant.
Unfortunately I can't find the 1.1.6 docs anywhere. So I cannot do any research on what protocals are supported in JDK1.1.6 .
Conclusion: Is it possible to send an email in a Java Stored Procedure, and how?
Thanks in advance :-) JohanThe Java mail API was a set of extension libraries for the 1.1 JDK. I have heard of folks who succeeded in loading these intot he database and then using them from within a Java stored procedure.
-
NameFromLastDDL Error during java stored procedure upload...
Hi guys,
I am trying to upload a class to send email within a java stored procedure.
JDeveloper fails to upload the class, and the error message doesn't help me:
I guess the automatically generated SQL statment features a "NameFromLastDDL" argument, but i have no control over that....anybody had this issue before ?
Following, the "ugly" exception:
Error while creating class client/Utils
ORA-06550: line 1, column 91:
PLS-00201: identifier 'NameFromLastDDL' must be declared
ORA-06550: line 1, column 85:
PL/SQL: Statement ignored
java.sql.SQLException: ORA-06550: line 1, column 91:
PLS-00201: identifier 'NameFromLastDDL' must be declared
ORA-06550: line 1, column 85:
PL/SQL: Statement ignored
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:184)
at oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(T4CCallableStatement.java:873)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1086)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3076)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4273)
at oracle.aurora.server.tools.loadjava.ClientClassObject.create(ClientClassObject.java:68)
at oracle.aurora.server.tools.loadjava.SchemaObject.process1(SchemaObject.java:223)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:530)
at oracle.aurora.server.tools.loadjava.LoadJava.addClass(LoadJava.java:584)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:434)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:378)
at oracle.aurora.server.tools.loadjava.LoadJava.addJar(LoadJava.java:717)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:430)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:378)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:347)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:643)
at oracle.aurora.server.tools.loadjava.LoadJava.processDeferredFiles(LoadJava.java:615)
at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:806)
at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:116)
at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:46)
at oracle.jdevimpl.deploy.OracleDeployer.deploy(OracleDeployer.java:97)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:473)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:360)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeployToMostRecent(StoredProcHandler.java:256)
at oracle.jdevimpl.deploy.StoredProcProfileDt$2.run(StoredProcProfileDt.java:193)
The following operations failed
class client/Utils: creation (createFailed)
oracle.aurora.server.tools.loadjava.ToolsException: Failures occurred during processing
at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:863)
at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:116)
at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:46)
at oracle.jdevimpl.deploy.OracleDeployer.deploy(OracleDeployer.java:97)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:473)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:360)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeployToMostRecent(StoredProcHandler.java:256)
at oracle.jdevimpl.deploy.StoredProcProfileDt$2.run(StoredProcProfileDt.java:193)I think u dont've previleges to run
the procedure.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by arunr12:
hi I am calling java stored procedure from jdbc. i am getting wierd exceptions:
CallableStatement cstmt = conn.prepareCall("begin SEND_MAIL(?,?,?);end;");
cstmt.setString(1,"[email protected]");
cstmt.setString(2,"Mail from Stored Proc");
cstmt.setString(3,"This is test mail from Oracle8i");
cstmt.execute();
i am getting following Exception:
java.sql.SQLException: ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.util.PropertyPermission * read,write) has not been granted by dbms_java.grant_permission to SchemaProtectionDomain(ISTORE_CUST|PolicyTableProxy(ISTORE_CUST))
ORA-06512: at "ISTORE_CUST.SEND_MAIL", line 0
ORA-06512: at line 1
<HR></BLOCKQUOTE>
null -
Size limitation that can be passed to Java stored procedure
Hello!
I enjoy using Oracle8i these days. But I have some questions
about Java stored procedure. I want to pass the XML data to Java
stored procedure as IN parameter. But I got some errors when the
data size is long. Is there any limitation in the data size that
can be passed to Java stored procedure?
Would you please help me ?
This message is long, but would you please read my message?
Contents
1. Outline : I write what I want to do and the error message I
got
2. About the data size boundary: I write about the boundary
size. I found that it depend on which calling sequence I use.
3. The source code of the Java stored procedure
4. The source code of the Java code that call the Java stored
procedure
5. The call spec
6. Environment
1.Outline
I want to pass the XML data to Java stored procedure. But I got
some errors when the data size is long. The error message I got
is below.
[ Error messages and stack trace ]
java.sql.SQLException: ORA-01460: unimplemented or unreasonable
conversion reque
sted
java.sql.SQLException: ORA-01460: unimplemented or unreasonable
conversion reque
sted
at oracle.jdbc.ttc7.TTIoer.processError(Compiled Code)
at oracle.jdbc.ttc7.Oall7.receive(Compiled Code)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(Compiled Code)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch
(TTC7Protocol.java:721
at oracle.jdbc.driver.OracleStatement.doExecuteOther
(Compiled Code)
at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch
(Compiled Code)
at oracle.jdbc.driver.OracleStatement.doExecute(Compiled
Code)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(Compiled
Code
at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate
(OraclePrepar
edStatement.java:256)
at oracle.jdbc.driver.OraclePreparedStatement.execute
(OraclePreparedStat
ement.java:273)
at javaSp.javaSpTestMain.sample_test
(javaSpTestMain.java:37)
at javaSp.javaSpTestMain.main(javaSpTestMain.java:72)
2. About the data size boundary
I don|ft know the boundary that I got errors exactly, but I
found that the boundary will be changed if I use |gprepareCall("
CALL insertData(?)");|h or |gprepareCall ("begin insertData
(?); end ;")|h.
When I use |gprepareCall(" CALL insertData(?)".
The data size 3931 byte --- No Error
The data size 4045 byte --- Error
Whne I use prepareCall ("begin insertData(?); end ;")
The data size 32612 byte --No Error
The data size 32692 byte --- Error
3. The source code of the Java stored procedure
public class javaSpBytesSample {
public javaSpBytesSample() {
public static int insertData( byte[] xmlDataBytes ) throws
SQLException{
int oraCode =0;
String xmlData = new String(xmlDataBytes);
try{
Connection l_connection; //Database Connection Object
//parse XML Data
dits_parser dp = new dits_parser(xmlData);
//Get data num
int datanum = dp.getElementNum("name");
//insesrt the data
PreparedStatement l_stmt;
for( int i = 0; i < datanum; i++ ){
l_stmt = l_connection.prepareStatement("INSERT INTO test
" +
"(LPID, NAME, SEX) " +
"values(?, ?, ?)");
l_stmt.setString(1,"LIPD_null");
l_stmt.setString(2,dp.getElemntValueByTagName("name",i));
l_stmt.setString(3,dp.getElemntValueByTagName("sex",i));
l_stmt.execute();
l_stmt.close(); //Close the Statement
l_stmt = l_connection.prepareStatement("COMMIT"); //
Commit the changes
l_stmt.execute();
l_stmt.close(); //Close the Statement l_stmt.execute
(); // Execute the Statement
catch(SQLException e ){
System.out.println(e.toString());
return(e.getErrorCode());
return(oraCode);
4. The source code of the Java code that call the Java stored
procedure
public static void sample_test(int num) {
//make data
Patient p = new Patient();
byte[] xmlData = p.generateXMLData(num);
try{
// Load the Oracle JDBC driver
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
Connection m_connection = DriverManager.getConnection
("jdbc:oracle:thin:@max:1521:test",
"testuser", "testuser");
CallableStatement l_stmt =
// m_connection.prepareCall(" CALL insertData(?)");
m_connection.prepareCall("begin insertData(?); end
l_stmt.setBytes(1,xmlData);
l_stmt.execute();
l_stmt.close();
System.out.println("SUCCESS to insert data");
catch(SQLException e ){
System.out.println( e.toString());
e.printStackTrace();
5. The call spec
CREATE OR REPLACE PROCEDURE insertData( xmlData IN LONG RAW)
AS
LANGUAGE JAVA NAME 'javaSp.javaSpBytesSample.insertData(byte[])';
6. Environment
OS: Windows NT 4.0 SP3
RDBMS: Oracle 8i Enterprise Edition Release 8.1.5.0.0 for
Windows NT
JDBC Driver: Oracle JDBC Drivers 8.1.5.0.0.
JVM: Java1.1.6_Borland ( The test program that call Java stored
procedure run on this Java VM)
nullIam passing an array of objects from Java to the C
file. The total size of data that Iam sending is
around 1GB. I have to load this data into the Shared
memory after getting it in my C file. Iam working on
HP-UX (64-bit). Everything works fine for around 400MB
of data. When I try to send around 500MB of data, the
disk utilization becomes 100%, so does my memory
utilization and I get a "Not enough space" when I try
to access shared memory. I have allocated nearly 2.5GB
in my SHMMAX variable. Also, I have around 45GB of
disk free. The JVM heap size is also at 2048MB. Where did you get the 400/500 number from? Is that the size of the file?
What do you do with the data? Are you doing nothing but copying it byte for byte into shared memory?
If yes then a simple test is to write a C application that does the same thing. If it has problems then it means you have an environment problem.
If no then you are probably increasing the size of the data by creating a structure to hold it. How much overhead does that add to the size of the data? -
Help with use of Java Stored Procedures to invoke Java Code within Applicat
Good afternoon everyone
Our development team is looking for some assistance/validation of a design strategy we are deploying for a client. Let me first layout the environment and then the design issue at hand:
Business User Workstation component: Oracle SQL*Developer 1.5.x
Reporting Tool: Actuate e.Spreadsheet A10
Application Web UI: J2EE application developed with Eclipse
Application Scripting: Application has a scripting component whereby business users can write Oracle PL/SQL to perform many of the functions that are available in the Web UI, but can be batched up or repeated several times.
Application Server WebLogic 9.2.3 (client constraint)
Database Serve: Oracle 11g, Release 11.1.0.7
Lots of other stuff included but irrelevant for this conversation.
Here's the scenario in question:
1. Through the scripting solution, the application user must use PL/SQL to invoke functionality within the Web UI. All PL/SQL that the application user creates does not contain any SQL. Instead our security model mandates that “pre-defined” routines will perform all of the SQL operations against the database; the application user simply invokes the stored procedures of functions to perform activities in the database.
2. There is a component of the scripting application that facilitates the creation of reports. In our application, we are using Actuate’s e.Spreadsheet Engine to create the report and format the report based on a template. The template is provided as input, as well as other data items, into Actuate for processing. The net result is the report is created by the Actuate e.Spreadsheet engine in pdf format and then sent back to the user for distribution to other users in the company.
3. The Actuate e.Spreadsheet engine consists of one or more JAR files within the Application Server framework. The Web UI utilizes these JAR files as well to perform report generation and data manipulation activities. In the case of the reporting functionality, the pdf report that is generated by Actuate is returned into either the Web UI or into the scripting component for persistence in the database. The mechanism exists to create multi-step jobs that can create multiple reports in one run.
4. So to facilitate the above, we are creating one or more Java Stored Procedures that will mediate the communication between the PL/SQL the user’s create and the Java components that are required for business processing. PL/SQL will invoke one or more Java Stored Procedures. Then the Java Stored Procedures invoke Actuate e.Spreadsheet, generate the report, saves the report in the database and returns control back to the invoking procedure.
So the question is: Is this a viable and correct use of Oracle Java Stored Procedures. What are the advantages/disadvantages of doing so? Any security issues or potholes that you can think of? Tuning issues for the JVMs? Any white papers that you can think of?
For any Oracle employees that respond, material such as Oracle Whitepapers, etc. would be great.
I can be contacted at (313) 227-4350 or at [email protected]
Thanks in advance.So are you planning on loading the entire e.Spreadsheet engine into the database server's JVM?
If so, I would expect that to work, but I expect that you'd have some performance issues. I'd expect that the process of building these PDFs is going to be relatively expensive. Tuning the database server's JVM tends to be rather more challenging than tuning JVM's in an app server.
If not, I'm not sure how the Java stored procedure would invoke the e.Spreadsheet engine on the application server. It is possible to use Oracle AQ to send a JMS message, but I don't think you can use the standard J2EE JMS APIs-- I think you'd have to use Oracle's AQ interface.
Justin -
Using Directory alias in Java stored procedure
hi !!
I want use Directory alias in Java strored procedure
I 'hv created dir alias as
Create Directory BFILE_DIR AS 'C:\MyImages'
my java statements -
myfile="C:\MyImages\myPH01.jpg"
File binaryFile = new File(myFile);
instead of giving absolute path I want give directory alias BFILE_DIR
myfile= BFILE_DIR + "myPH01.jpg"
can anyone pl suugest how should I write this in Java procedure
thanks
SPDHi there i am currently trying to develope a java
stored procedure and place it in oracle and will try
to use that procedure to send a message to a server
but then it doesnt seems to work. is it possible?And what do you do with exceptions in your java proc?
I haven't ever done it myself, but I would be very surprised if it wasn't possible. I also wouldn't be surprised to find out that you have to configure various things to allow it in Oracle itself. -
Using socket programming in java stored procedure
Hi there i am currently trying to develope a java stored procedure and place it in oracle and will try to use that procedure to send a message to a server but then it doesnt seems to work. is it possible?
The server and the database is in the same pc and the server is just a small program listening to a port. Hope someone can help me thanksHi there i am currently trying to develope a java
stored procedure and place it in oracle and will try
to use that procedure to send a message to a server
but then it doesnt seems to work. is it possible?And what do you do with exceptions in your java proc?
I haven't ever done it myself, but I would be very surprised if it wasn't possible. I also wouldn't be surprised to find out that you have to configure various things to allow it in Oracle itself. -
Is is possible to create Socket using Java Stored Procedures/Function(Ora)?
Hello Friends,
Is is possible to create Socket using Java Stored Procedures/Function in Oracle?
OR
How I can send a message from oracle to Java Desktop Application which is working like server program?
Please Guide !!J3Ganesh wrote:
Hello Friends,
Is is possible to create Socket using Java Stored Procedures/Function in Oracle?No, Oracle was very careful to take that feature out of the JDK provided in Oracle 10/11, but you can buy that feature back for, if I remember correctly, about 5000 dollars. (I actually raised a service request on this and then told my rep what I thought about the answer I received--some thing along the line of money grubbing so and so....)
How I can send a message from oracle to Java Desktop Application which is working like server program?You can make a table and poll it from time to time from the Java side and write and commit what ever you want to the table. I do not know any way to send a signal from Oracle DB an external Java application--Java or PL/SQL stored procedure. -
Error while executing java stored procedure from a pl/sql procedure
We have a requirement where we need to execute JAVA code stored in an Oracle database (Java Stored Procedure). This code uses some JAR files which we have already loaded without any errors in the database.
The class file was also loaded in the database without any errors. But when we execute the method of this class (JAVA code), it gives the following error:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.NoClassDefFoundError
Is there any way of debugging the code and getting to know where exactly the problem is? Or, any tool/software available for doing the same.
Any pointers would be of great help!
Thanks in advanceHi Uday,
My guess is that there is a problem with your java stored procedure that is causing the "ExceptionInInitializer" error to be thrown. According to the javadoc:
is thrown to indicate that an exception occurred during
evaluation of a static initializer or
the initializer for a static variable
Since I didn't see any of your code in your post, I can't help you much more, I'm afraid. Perhaps if you would provide some more details, I may be able to help you some more. I think the following details would be helpful:
1. Complete error message and stack trace you are getting.
2. The section of your java code that you think is causing the problem.
3. Oracle database version you are using.
Good Luck,
Avi. -
Calling the Java Method in PL/SQL Java Stored procedure errors out
Hi,
I could not find a suitable thread to post my PL/SQL question so iam posting it here.........
I have written a java class by name XYZ which has a method ABC for which there are 9 arguements being passed and its a VOID method.
This java class has been loaded into ORACLE using DBMS_JAVA.LOADJAVA pkg, Now this class is being called in the oracle as a JAVA Stored procedure...... When ever im trying to call the procedure it throws the following error
ORA-29531: no method
*Cause: An attempt was made to execute a non-existent method in a
Java class.
*Action: Adjust the call or create the specified method.
The code snippet as follows
JAVA CODE:
Class xyz
public static void Abc (String hostName,
int port,
String serviceURL,
String soapAction,
int timeOut,
String wsUser,
String wsPasWd,
String keyStore,
String keyStorePasWd)
//method implementation
JAVA STORED PROCEDURE:
create OR REPLACE procedure ABC_JAVA_SP_CALL
(p_hostname in varchar2, p_port in number, p_serviceurl in varchar2, p_soapaction in varchar2, p_timeout in number, p_wsuser in varchar2, p_wspasswd in varchar2, p_ks_path in varchar2, p_ks_passwd in varchar2)
as
language java
name 'xyz.Abc(java.lang.String, int, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String)';
When i try to call
declare
p_hostname varchar2(100);
p_port number;
p_serviceurl varchar2(100);
p_soapaction varchar2(100);
p_timeout number;
p_wsuser varchar2(100);
p_wspasswd varchar2(100);
p_ks_path varchar2(100);
p_ks_passwd varchar2(100);
begin
//SP which returns the values for the required parameters.
comppkg.getvcsinfo(
p_hostname,
p_port ,
p_serviceurl,
p_soapaction,
p_timeout,
p_wsuser,
p_wspasswd,
p_ks_path,
p_ks_passwd
Layer7_icengc_ws_tes(p_hostname,
p_port ,
p_serviceurl,
p_soapaction,
p_timeout,
p_wsuser,
p_wspasswd,
p_ks_path,
p_ks_passwd);
end;
This thing ends up with
29531. 00000 - "no method %s in class %s"
*Cause: An attempt was made to execute a non-existent method in a
Java class.
*Action: Adjust the call or create the specified method.
Im not understanding what wrong am i doing
pls help
Edited by: madhusudan on Feb 12, 2013 8:07 PMHello,
there is the forum {forum:id=65} for questions about using Java within Oracle.
Regards
Marcus
Edited by: Marwim on 13.02.2013 07:56
I could not find a suitable thread to post my PL/SQL question so iam posting it here.........You got the hint to the correct forum alread in another thread {message:id=10837976}
And if you think this is not related to Java but PL/SQL, then you should ask in {forum:id=75} -
While executing java stored procedure i got an error
I have used this command to load java source into data base
loadjava -user ENCORA/ENCORA C:\framework\Packages\testdevelopement\HOST.java
but while executing i got an error.
SQL> create or replace function run_cmd(p_cmd in varchar2) return number
2 as
3 language java
4 name 'HOST.RunThis(java.lang.String[]) return integer';
5 /
Function created.
SQL> create or replace procedure RC(p_cmd in varchar2)
2 as
3 x number;
4 begin
5 x := run_cmd(p_cmd);
6 end;
7 /
Procedure created.
SQL> set serveroutput on size 1000000
SQL> exec dbms_java.set_output(1000000)
PL/SQL procedure successfully completed.
SQL> exec rc('/usr/bin/ps -ef');
BEGIN rc('/usr/bin/ps -ef'); END;
ERROR at line 1:
ORA-29540: class HOST does not exist
ORA-06512: at "ENCORA.RUN_CMD", line 0
ORA-06512: at "ENCORA.RC", line 5
ORA-06512: at line 1
can any one suggest me how can i resolve this problem?Hi Uday,
My guess is that there is a problem with your java stored procedure that is causing the "ExceptionInInitializer" error to be thrown. According to the javadoc:
is thrown to indicate that an exception occurred during
evaluation of a static initializer or
the initializer for a static variable
Since I didn't see any of your code in your post, I can't help you much more, I'm afraid. Perhaps if you would provide some more details, I may be able to help you some more. I think the following details would be helpful:
1. Complete error message and stack trace you are getting.
2. The section of your java code that you think is causing the problem.
3. Oracle database version you are using.
Good Luck,
Avi.
Maybe you are looking for
-
Problem with coolers in Asus Eee pc 1011 px
Well I installed Arch in this netbook and the performance is wonderful, but i have an important problem. The fans dont seem to regulate themself and they dont start speeding when the netbook is getting hotter. Is there any way to solve this, like set
-
Blue screen appears when installing boot camp in windows 7
i have tried four times to run setup and the same blue screen appears and it restarts, what am i doing wrong please thanku xx
-
How to set file permission using Oracle FTP Adapter
Hi, I am using Oracle SOA Suite 11.1.1.4. I am trying to put a file using Oracle FTP adapter on unix box. The file that gets written to target system has file permission as RW/R/R. But this is a legacy system, and for them to consume this file - they
-
Why did my new iphone change my contacts area code?
I just bought the iphone 5s. And when I switched over my contacts info, the numbers appear instead of names when I am trying to text!! Very annoying!! The actual names still pop up if I compose a text, but all the old ones are just phone numbers. h
-
How can I change the thickness of the cell border of a table in Pages for iPad ?
Hi, i want to change the thickness of cell borders in tables in Pages for iPad to at least 2pt, better 3pt. How can I change the thickness in the iOS Version of Pages ? Thanks