Problem creating dataset using db2 stored procedure in Eclipse BIRT
Hi,
I am using DB2 9.7 Express Edition in Eclipse BIRT(version 2.5.1) for generating reports. I have used Type4 driver for jdbc connection.
For that, I have established jdbc connection using db2jcc.jar and db2jcc_license_cu.jar files.
I have successfully created data source, say DB2BIRT having following requisites-
Driver Class - com.ibm.db2.jcc.DB2Driver ( v3.50)
Driver URL - jdbc:db2://localhost:50000/database_name
User name - user_name
Password - Password
I have written some stored procedures and trying to use resultsets from those stored procedures into my report..
The stored procedures having involvement of only single resultset are working absolutely fine for new dataset using above DB2BIRT.
But, I am unable to create new dataset using stored procedures those having involvement of multiple resultsets.
I am getting following error as -
org.eclipse.birt.data.engine.odaconsumer.PreparedStatement$SequentialResultSetHandler getMoreResults
SEVERE: Cannot get more result sets from the statement.
Cannot get the result set.
SQL error #1: [jcc][10120][10943][3.50.152] Invalid operation: statement is closed. ERRORCODE=-4470, SQLSTATE=null
org.eclipse.birt.report.data.oda.jdbc.JDBCException: Cannot get the result set.
SQL error #1: [jcc][10120][10943][3.50.152] Invalid operation: statement is closed. ERRORCODE=-4470, SQLSTATE=null
com.ibm.db2.jcc.b.SqlException: [jcc][10120][10943][3.50.152] Invalid operation: statement is closed. ERRORCODE=-4470, SQLSTATE=null
at org.eclipse.birt.report.data.oda.jdbc.CallStatement.getMoreResults(CallStatement.java:1760)
at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaAdvancedQuery.getMoreResults(OdaAdvancedQuery.java:214)
at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement$SequentialResultSetHandler.getMoreResults(PreparedStatement.java:5183)
at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.getMoreResults(PreparedStatement.java:792)
at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.flushResultSets(PreparedStatement.java:1009)
at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.close(PreparedStatement.java:980)
at org.eclipse.birt.data.engine.executor.DataSource$DataSourceReleaser.run(DataSource.java:374)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.ibm.db2.jcc.b.SqlException: [jcc][10120][10943][3.50.152] Invalid operation: statement is closed. ERRORCODE=-4470, SQLSTATE=null
at com.ibm.db2.jcc.b.wc.a(wc.java:55)
at com.ibm.db2.jcc.b.wc.a(wc.java:102)
at com.ibm.db2.jcc.b.tk.db(tk.java:3118)
at com.ibm.db2.jcc.b.tk.a(tk.java:1063)
at com.ibm.db2.jcc.b.tk.getMoreResults(tk.java:908)
at org.eclipse.birt.report.data.oda.jdbc.CallStatement.getMoreResults(CallStatement.java:1756)
... 7 more
Moreover, I tried to resolve above issue by changing Driver Class from com.ibm.db2.jcc.DB2Driver ( v3.50) to com.ibm.db2.jcc.uw.DB2StoredProcDriver ( v3.50)
So again while *"Test Connection"* for new Data source using this new driver class for stored procedure, there is an error reflection as -
org.eclipse.birt.report.data.oda.jdbc.JDBCException: The selected driver cannot parse the given url.
at org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager.testConnection(JDBCDriverManager.java:627)
at org.eclipse.birt.report.data.oda.jdbc.ui.util.DriverLoader.testConnection(DriverLoader.java:120)
at org.eclipse.birt.report.data.oda.jdbc.ui.util.DriverLoader.testConnection(DriverLoader.java:133)
at org.eclipse.birt.report.data.oda.jdbc.ui.profile.JDBCSelectionPageHelper.testConnection(JDBCSelectionPageHelper.java:653)
at org.eclipse.birt.report.data.oda.jdbc.ui.profile.JDBCSelectionPageHelper.access$7(JDBCSelectionPageHelper.java:627)
at org.eclipse.birt.report.data.oda.jdbc.ui.profile.JDBCSelectionPageHelper$7.widgetSelected(JDBCSelectionPageHelper.java:549)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1176)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3493)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3112)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.birt.report.designer.ui.dialogs.BaseDialog.open(BaseDialog.java:110)
at org.eclipse.birt.report.designer.data.ui.actions.EditDataSourceAction.doAction(EditDataSourceAction.java:68)
at org.eclipse.birt.report.designer.internal.ui.views.actions.AbstractElementAction.run(AbstractElementAction.java:70)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1176)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3493)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3112)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
Can anybody address my this issue for successful implementation of stored procedure(with involvement of multiple resultsets) for creating Data set in Eclipse BIRT ?
I will be really thankful.
Thanks in advance,
Manasi
Well, in my stored procedure I have used 2 to3 cursors(as per my business logic) and all cursors except one are holding result sets. That exceptional cursor is intended for holding as well as returning result set after call to the procedure. And its perfectly running on db2 and returning the desired output. The problem is with Eclipse. The same procedure is not working in Eclipse BIRT.
Similar Messages
-
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. -
DB2 Stored Procedure from Java-JDBC
Hi All,
I am using DB2 stored procedure which have been written in COBOL. I have two types of stored procedures. First types of stored procedure takes IN parameter and returns OUT parameter. These stored procedures are working fine. The second type of stored procedure takes IN parameter and returns a CURSOR. According to Database team (who wrote these stored procedure) claims that they can see data in a cursor when they test these stored procedure directly in the database. However, when I run these stored procedures from Java code it returns NULL ResultSet. Here is the code:
public SearchResult getAllBenefitHEDType(SearchParameter searchParam) throws DAOException {
log.debug(" getAllBenefitHEDType method - entering ");
HashMap searchParametersMap = searchParam.getHashMap();
SearchResult searchResult = new SearchResult();
String type = (String) searchParametersMap.get(UDFConstant.LOOKUP_SEARCH_TYPE);
HashMap resultParametersMap = new HashMap();
ArrayList resultSetDTO = new ArrayList();
try {
conn = this.getConnection();
conn.setAutoCommit(false);
System.out.println("getAllBenefitHEDType Step 1");
CallableStatement cs = conn.prepareCall("{call TEST.APS003(?)}"); // Stored Procedure with one IN parameter.
cs.setString(1,type);
boolean retVal = cs.execute(); // this should return true if ResultSet is available.. in my case it is returning false.
// I tried with getting the Object
ResultSet rs = (ResultSet) cs.getObject(1); // this should give me a valid result set ... in my case I am getting null
if (rs!=null) {
System.out.println("getAllBenefitHEDType Step 4A Result Set Not Null");
} else {
System.out.println("getAllBenefitHEDType Step 4A Result Set Is Null");
// I tried getting the resultset
ResultSet rs1 = cs.getResultSet(); // this should give me a valid result set ... in my case I am getting null
if (rs1!=null) {
System.out.println("getAllBenefitHEDType Step 4D Result Set Not Null");
} else {
System.out.println("getAllBenefitHEDType Step 4D Result Set Is Null");
while (rs.next()) {
System.out.println("getAllBenefitHEDType Step 5");
LookupDTO lookupDTO = new LookupDTO();
// the following code populate the Lookup DTOs from ResultSet.A few comments...
1) Creating tables, particularly tables whose names seem to imply that they are temporary tables, on the fly in a stored procedure is a bad idea. That is not the way to work with Oracle, though it is a common practice in other databases like SQL Server. There is undoubtedly a better way to do this in Oracle if you can explain what you're trying to accomplish from a business standpoint.
2) If you are going to use dynamic SQL, you almost always want to use bind variables, not literals. One of the quickest ways to kill an Oracle database's performance is to not use bind variables.
3) As has already been mentioned, assuming FH_INICIO is a DATE column, you need to put an explicit TO_DATE around your strings in order to convert them to dates. Otherwise, Oracle's implicit cast depends on the session's NLS_DATE_FORMAT, which is likely to be different in different client applications and from different client machines.
Justin -
ORA-29855 - Error creating Spatial Index using a Stored Procedure
Hi
I am using Oracle 10gR2 database and I have written a stored procedure to create spatial index. But when i execute this function i get the following error message.
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-13249: internal error in Spatial index: [mdidxrbd]
ORA-13249: Error in Spatial index: index build failed
ORA-13249: Error in R-tree: [mdrcrtscrt]
ORA-13231: failed to create index table [MDRT_217C1$] during R-tree creation
ORA-13249: Stmt-Execute Failure: CREATE TABLE FGDABZ40.MDRT_217C1$ (NODE_ID NUMBER, NODE_LEVEL NUMBER, INFO BLOB) LOB (INFO) STORE AS (CACHE) NOLOGGING PCTFREE 2
ORA-29400: data cartridge error
ORA-01031: insufficient privileges
ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10
ORA-06512: at line 1
ORA-06512: at "FGDABZ40.PKG_PSSDBE_APPLICATION", line 298
ORA-06512: at line 17
The tables that i am passing are registered in metadata and I am able to create indexes directly in sql plus. But when i try to create using this stored procedure, it fails.
it should be possible to create indexes using a generic function. Has any faced a similar problem?
regards
samHi,
I am having a same error on Oracle 10gR2 database. When I execute the same statement in sqlplus, it works. But it gives this error when I call the procedure which has this create spatial index statement.
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-13249: internal error in Spatial index: [mdidxrbd]
ORA-13249: Error in Spatial index: index build failed
ORA-13249: Error in R-tree: [mdrcrtscrt]
ORA-13231: failed to create index table [MDRT_20CDA$] during R-tree creation
ORA-13249: Stmt-Execute Failure: CREATE TABLE "SDOMGR".MDRT_20CDA$ (NODE_ID NUMBER, NODE_LEVEL NUMBER, INFO BLOB) LOB (INFO) STORE AS (CACHE) NOLOGGING PCTFREE 2
ORA-29400: data cartridge error
ORA-01031: i
Any help will be appreciated.
Thanks,
Sri -
Problem while using oracle stored procedure in VC
Hi All,
I have created JDBC system and connected my locally installed Oracle data base to the VC. I mapped the data base user to my VC user. I tested connection and it is fine. Further I see the DB alias in Visual Composer and I can drop stored procedures to my story board. I can define parameters, but when I am executing procedures I get the error message.
Problem: I can not execute stored procedures stored in Oracle data base. Error Message: Portal request failed. Could not execute stored procedure.
In the stored procedure, I have used select query, that returns set of records, so that I have used REF CURSOR as OUT Parameter. Is REF CURSOR supported by VC?. Else, any tricks available to solve this problem?.
Note: Stored Procedure of Sql server is working fine in VC.
Thanks,
Venkatesh RReturning (or sending in) multiple rows directly from (or to) a stored procedure is not currently possible. I have been in contact with SAP on this subject earlier, and they suggest using a web service to do the job. I used this as a work around, calling the stored procedure from a web service. I send in VC tables to this web service, and this in turn contacts my stored procedure.
The problem is related to the connector framework in the J2EE environment.
I am on 7.0 sps 17
If you use stored procedure single value parameters of type varchar, number ... then VC has no problem communicating with your procedures.
Good luck
Henning Strand -
Ssrs 2008 r2 report dataset call a stored procedure
I am modifying an existing SSRS 2008 r2 report. In a dataset that already exists within the ssrs 2008 r2 report I need execute
a stored procedure called StudentData and pass 3 parameter values to the stored procedure. The stored procedure will then return 5 values that are now needed for the modified ssrs report. My problem is I do not know how to have the dataset call the stored procedure
with the 3 parameter values and pass back the 5 different unique data values that I am looking for.
The basic dataset is the following:
SELECT SchoolNumber,
SchoolName,
StudentNumber,
from [Trans].[dbo].[Student]
order by SchoolNumber,
SchoolName,
StudentNumber
I basically want to pass the 3 parameters of SchoolNumber, SchoolName, and StudentNumber to the
stored procedure called StudentData from the data I obtain from the [Trans].[dbo].[Student]. The 3 parameter values will be obtained from the sql listed above.
The columns that I need from the stored procedure called StudentData will return the following data columns
that I need for the report: StudnentName, StudentAddress, Studentbirthdate, StudentPhoneNumber, GuardianName.
Thus can you show me how to setup the sql to meet this requirement I have?Hi wendy,
After testing the issue in my local environment, we can refer to the following steps to achieve your requirement:
Create three multiple parameters named SchoolNumber, SchoolName and StudentNumber in the report. Those available values from the basic dataset SchoolNumber, SchoolName and StudentNumber fields.
If you want to pass multiple values parameter to stored procedure, we should create a function as below to the database:
CREATE FUNCTION SplitParameterValues (@InputString NVARCHAR(max), @SplitChar VARCHAR(5))
RETURNS @ValuesList TABLE
param NVARCHAR(255)
AS
BEGIN
DECLARE @ListValue NVARCHAR(max)
SET @InputString = @InputString + @SplitChar
WHILE @InputString!= @SplitChar
BEGIN
SELECT @ListValue = SUBSTRING(@InputString , 1, (CHARINDEX(@SplitChar, @InputString)-1))
IF (CHARINDEX(@SplitChar, @InputString) + len(@SplitChar))>(LEN(@InputString))
BEGIN
SET @InputString=@SplitChar
END
ELSE
BEGIN
SELECT @InputString = SUBSTRING(@InputString, (CHARINDEX(@SplitChar, @InputString) + len(@SplitChar)) , LEN(@InputString)-(CHARINDEX(@SplitChar, @InputString)+ len(@SplitChar)-1) )
END
INSERT INTO @ValuesList VALUES( @ListValue)
END
RETURN
END
Use the query below to create a stored procedure, then use it to create a dataset to return 5 values:
create proc proc_test(@SchoolNumber nvarchar(50),@SchoolName nvarchar(50),@StudentNumber nvarchar(50))
as
begin
select StudnentName, StudentAddress, Studentbirthdate, StudentPhoneNumber, GuardianName
from table7 where SchoolNumber in (SELECT * FROM SplitParameterValues (@SchoolNumber,',')) and SchoolName in(SELECT * FROM SplitParameterValues (@SchoolName,',')) and StudentNumber in (SELECT * FROM SplitParameterValues (@StudentNumber,','))
end
Right-click the new dataset to modify the parameter value in the Parameters pane as below:
=join(Parameters!SchoolNumber.Value,",")
=join(Parameters!SchoolName.Value,",")
=join(Parameters!StudentNumber.Value,",")
For more details about pass multi-value to stored procedure, please see:
http://munishbansal.wordpress.com/2008/12/29/passing-multi-value-parameter-in-stored-procedure-ssrs-report/
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
If you have any feedback on our support, please click
here.
Katherine Xiong
TechNet Community Support -
To call db2 stored procedure having parameters in java application
Hi,
I've created db2 stored procedure which is running perfectly on db2 server after giving a CALL to it. But when I tried to call this same stored procedure in java application, its reflecting with following error......
com.ibm.db2.jcc.b.SqlException: [jcc][10100][10910][3.50.152] java.sql.CallableStatement.executeQuery() was called but no result set was returned.
Use java.sql.CallableStatement.executeUpdate() for non-queries. ERRORCODE=-4476, SQLSTATE=null
at com.ibm.db2.jcc.b.wc.a(wc.java:55)
at com.ibm.db2.jcc.b.wc.a(wc.java:102)
at com.ibm.db2.jcc.b.tk.b(tk.java:575)
at com.ibm.db2.jcc.b.vk.yb(vk.java:136)
at com.ibm.db2.jcc.b.vk.executeQuery(vk.java:114)
at SPApplication.main(SPApplication.java:31)
Here is the code.......
import java.sql.*; public class SPApplication { public static Connection con; public static CallableStatement proc_stmt; public static ResultSet rs; /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try { Class.forName("DB2 DRIVER CLASS"); System.out.println("Class loaded....."); con = DriverManager.getConnection("jdbc:db2://localhost:PORTNO/" + " DatabaseName", "username", "password"); System.out.println("Connection established....."); proc_stmt = con.prepareCall("call procedure_name(?)"); //IN Parameter proc_stmt.setInt(1, 5); System.out.println("Called procedure....."); rs = proc_stmt.executeQuery(); /******** THIS IS LINE NO. 31 *********/ while (rs.next()) { // Fetching rows one by one over here } proc_stmt.close(); rs.close(); con.close(); } catch (ClassNotFoundException cnfe) { cnfe.printStackTrace(); } catch (SQLException sqle) { sqle.printStackTrace(); } finally { /* try { proc_stmt.close(); rs.close(); con.close(); } catch (SQLException sqle) { sqle.printStackTrace(); } */ } } }
Please correct me, if I am wrong at any point in my application..
I would really appreciate for resolving my problem.
Thanks,
Manasi N.Hi jschell ,
Firstly, I tried out with execute() and getMoreResults() to check if the statement is returning result set. - Its returning "null" only.
Secondly, I tried with following one by one :
1. Find a new jdbc driver
2. Write a different stored procedure.I am using DB2 Express edition - DB2 v9.7.0.0
I have the required jar files - i)db2jcc.jar ii) db2jcc_license_cu.jar
From these I found the available jdbc drivers as -
i) com.ibm.db2.jcc.DB2Driver
ii) COM.ibm.db2os390.sqlj.jdbc.DB2SQLJDriver
iii) com.ibm.db2.jcc.uw.DB2StoredProcDriver
I tried out my code by using each of these drivers, but still returning result set as null.
Moreover, I changed my stored procedure which has cursor returning result set. In this case also, result set is null.
Code snippet for this SP is -
30 Class.forName("com.ibm.db2.jcc.uw.DB2StoredProcDriver");
31 System.out.println("Class loaded....");
32 con = DriverManager.getConnection
33 ("jdbc:db2://localhost:portno/dbName", "user", "password");
34 System.out.println("Connection established....");
35
36 proc_stmt = con.prepareCall("call javaSP()");
37
38 System.out.println("Called stored procedure....");
39
40 proc_stmt.execute();
41 //proc_stmt.executeUpdate();
42 //rs = proc_stmt.getResultSet();
43
44 System.out.println("Query executed....");
45
46 if ((proc_stmt.getMoreResults() == false) &&
47 (proc_stmt.getUpdateCount() == -1)) {
48 System.out.println("No more result sets");
49 }o/p is (for every mentioned above jdbc driver) :-
Class loaded....
Connection established....
Called stored procedure....
Query executed....
No more result sets..
The o/p is always "No more result sets"
What else can be tried out to retrieve the result set from stored procedure from Java application? And the most important, these same stored procedures are returning result sets on db2 server after calling them.
Thank you,
Manasi.N
Edited by: Manasi.N on Apr 14, 2010 12:27 AM
Edited by: Manasi.N on Apr 14, 2010 12:28 AM -
Need help with BC4J/Struts application using a Stored Procedure
Hi,
I am doing a proof of concept for a new project using JDeveloper, Struts and BC4J. We want to reuse our Business logic that is currently residing in Oracle Stored Procedures. I previously created a BC4J Entity Object based on a stored procedure Using Oracle Stored Procedures but this stored procedure is a bit different in that it returns a ref cursor as one of the paramters. http://radio.weblogs.com/0118231/stories/2003/03/03/gettingAViewObjectsResultRowsFromARefCursor.html
I tried the above method, but I am having some trouble with it. I keep getting the error ORA-01008: not all variables are bound when I test it using the AppModule tester.
Here is the store procedure definition:
CREATE OR REPLACE PACKAGE pprs_test_wrappers IS
TYPE sn_srch_results IS REF CURSOR;
PROCEDURE sn_srch_main_test
(serial_num_in IN OUT VARCHAR2
,serial_coll_cd_in IN OUT NUMBER
,max_rows_allowed IN OUT NUMBER
,total_rows_selected IN OUT NUMBER
,message_cd_out IN OUT VARCHAR2
,query_results OUT sn_srch_results
END pprs_test_wrappers;
And here is my code:
package pprs;
import java.math.BigDecimal;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import oracle.jbo.JboException;
import oracle.jbo.domain.Number;
import oracle.jbo.server.DBTransaction;
import oracle.jbo.server.ViewObjectImpl;
import oracle.jbo.server.ViewRowImpl;
import oracle.jbo.server.ViewRowSetImpl;
import oracle.jdbc.driver.OracleCallableStatement;
import oracle.jdbc.driver.OracleTypes;
// --- File generated by Oracle Business Components for Java.
public class LienCheckImpl extends ViewObjectImpl
* This is the PLSQL block that we will execute to retrieve the REF CURSOR
private static final String SQL =
"begin ? := pprs_test_wrappers.sn_srch_main_test(?, ?, ?, ?, ?, ?);end;";
public LienCheckImpl() {}
* Overridden framework method.
* Executed when the framework needs to issue the database query for
* the query collection based on this view object. One view object
* can produce many related result sets, each potentially the result
* of different bind variable values. If the rowset in query is involved
* in a framework-coordinated master/detail viewlink, then the params array
* will contain one or more framework-supplied bind parameters. If there
* are any user-supplied bind parameter values, they will PRECEED the
* framework-supplied bind variable values in the params array, and the
* number of user parameters will be indicated by the value of the
* numUserParams argument.
protected void executeQueryForCollection(Object qc,Object[] params,int numUserParams) {
* If there are where-clause params (for example due to a view link)
* they will be in the 'params' array.
* We assume that if some parameter is present, that it is a Deptno
* value to pass as an argument to the stored procedure.
* NOTE: Due to Bug#2828248 I have to cast to BigDecimal for now,
* ---- but this parameter value should be oracle.jbo.domain.Number type.
String serialNumIn = null;
BigDecimal serialCollCdIn = null;
BigDecimal maxRowsAllowed = null;
BigDecimal totalRowsSelected = null;
String messageCdOut = null;
if (params != null) {
serialNumIn = (String)params[0];
serialCollCdIn = (BigDecimal)params[1];
maxRowsAllowed = (BigDecimal)params[2];
totalRowsSelected = (BigDecimal)params[3];
messageCdOut = (String)params[4];
storeNewResultSet(qc,retrieveRefCursor(qc,serialNumIn,
serialCollCdIn,
maxRowsAllowed,
totalRowsSelected,
messageCdOut));
super.executeQueryForCollection(qc, params, numUserParams);
* Overridden framework method.
* Wipe out all traces of a built-in query for this VO
protected void create() {
getViewDef().setQuery(null);
getViewDef().setSelectClause(null);
setQuery(null);
* Overridden framework method.
* The role of this method is to "fetch", populate, and return a single row
* from the datasource by calling createNewRowForCollection() and populating
* its attributes using populateAttributeForRow().
protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs) {
* We ignore the JDBC ResultSet passed by the framework (null anyway) and
* use the resultset that we've stored in the query-collection-private
* user data storage
rs = getResultSet(qc);
* Create a new row to populate
ViewRowImpl r = createNewRowForCollection(qc);
try {
* Populate new row by attribute slot number for current row in Result Set
populateAttributeForRow(r,0, nullOrNewNumber(rs.getBigDecimal(1)));
populateAttributeForRow(r,1, nullOrNewNumber(rs.getBigDecimal(2)));
populateAttributeForRow(r,2, rs.getString(3));
populateAttributeForRow(r,3, rs.getString(4));
populateAttributeForRow(r,4, rs.getString(5));
catch (SQLException s) {
throw new JboException(s);
return r;
* Overridden framework method.
* Return true if the datasource has at least one more record to fetch.
protected boolean hasNextForCollection(Object qc) {
ResultSet rs = getResultSet(qc);
boolean nextOne = false;
try {
nextOne = rs.next();
* When were at the end of the result set, mark the query collection
* as "FetchComplete".
if (!nextOne) {
setFetchCompleteForCollection(qc, true);
* Close the result set, we're done with it
rs.close();
catch (SQLException s) {
throw new JboException(s);
return nextOne;
* Overridden framework method.
* The framework gives us a chance to clean up any resources related
* to the datasource when a query collection is done being used.
protected void releaseUserDataForCollection(Object qc, Object rs) {
* Ignore the ResultSet passed in since we've created our own.
* Fetch the ResultSet from the User-Data context instead
ResultSet userDataRS = getResultSet(qc);
if (userDataRS != null) {
try {
userDataRS.close();
catch (SQLException s) {
/* Ignore */
super.releaseUserDataForCollection(qc, rs);
* Return a JDBC ResultSet representing the REF CURSOR return
* value from our stored package function.
private ResultSet retrieveRefCursor(Object qc,
String serialNum,
BigDecimal serialColCd,
BigDecimal maxRows,
BigDecimal totalRows,
String messageCd ) {
CallableStatement st = null;
try {
st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
* Register the first bind parameter as our return value of type CURSOR
st.registerOutParameter(1,OracleTypes.CURSOR);
* Set the value of the 2nd bind variable to pass id as argument
if (serialNum == null) st.setNull(2,Types.CHAR);
else st.setString(2,serialNum);
if (serialColCd == null) st.setNull(3,Types.NUMERIC);
else st.setBigDecimal(3,serialColCd);
if (maxRows == null) st.setNull(4,Types.NUMERIC);
else st.setBigDecimal(4,maxRows);
if (totalRows == null) st.setNull(5,Types.NUMERIC);
else st.setBigDecimal(5,totalRows);
if (messageCd == null) st.setNull(6,Types.CHAR);
else st.setString(6,messageCd);
st.execute();
ResultSet rs = ((OracleCallableStatement)st).getCursor(1);
* Make this result set use the fetch size from our View Object settings
rs.setFetchSize(getFetchSize());
return rs ;
catch (SQLException s) {
throw new JboException(s);
finally {try {st.close();} catch (SQLException s) {}}
* Store a new result set in the query-collection-private user-data context
private void storeNewResultSet(Object qc, ResultSet rs) {
ResultSet existingRs = getResultSet(qc);
// If this query collection is getting reused, close out any previous rowset
if (existingRs != null) {
try {existingRs.close();} catch (SQLException s) {}
setUserDataForCollection(qc,rs);
hasNextForCollection(qc); // Prime the pump with the first row.
* Retrieve the result set wrapper from the query-collection user-data
private ResultSet getResultSet(Object qc) {
return (ResultSet)getUserDataForCollection(qc);
* Return either null or a new oracle.jbo.domain.Number
private static oracle.jbo.domain.Number nullOrNewNumber(BigDecimal b) {
try {
return b != null ? new oracle.jbo.domain.Number(b) : null;
catch (SQLException s) { }
return null;
I created the view object in expert mode so there is no entity object. Can someone help? I don't have much time left to finish this.
Also, could I have done this from the Entity object instead of the view object by registering the ref cursor OUT parameter in handleStoredProcInsert()?
Thanks
NatalieI was able to get the input parameter by putting the following in my struts actions class
vo.setWhereClauseParam(0,request.getParameter("row0_SerialNum"));
The full code is:
package mypackage2;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import oracle.jbo.html.BC4JContext;
import oracle.jbo.ViewObject;
import oracle.jbo.html.struts11.BC4JUtils;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class LienCheckView1QueryAction extends Action
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
BC4JContext context = BC4JContext.getContext(request);
// Retrieve the view object instance to work with by name
ViewObject vo = context.getApplicationModule().findViewObject("LienCheckView1");
vo.setRangeSize(3);
vo.setIterMode(ViewObject.ITER_MODE_LAST_PAGE_PARTIAL);
// Do any additional VO setup here (e.g. setting bind parameter values)
vo.setWhereClauseParam(0,request.getParameter("row0_SerialNum"));
// default value for serialCollCd 1 is for Motor Vehicles
vo.setWhereClauseParam(1,new oracle.jbo.domain.Number(1));
// Default value for maxRows_allowed
vo.setWhereClauseParam(2,new oracle.jbo.domain.Number(20));
return BC4JUtils.getForwardFromContext(context, mapping);
This doesn't always work properly though. The first time I press the query button, the SerialNum parameter is still null, however if I re-execute the query by pressing the query button again. It will work, and return the rows. I always have to query twice. Also the SerialNum attribute is set to a String in my view object, it is a varchar column in the database, but some serial number I enter give a "Error Message: oracle.jbo.domain.Number ". This happens even though the underlying BC4J is returning values for the query. I also get a "500 Internal Server Error java.lang.ClassCastException: java.lang.String on my View object's code at line 65 which is
if (params.length>1) serialCollCdIn = (BigDecimal)params[1];
This is an input paramter to the oracle stored procedure that defaults to a Number value of 1.
Any idea what the problem is? Here is the full code for my view object:
package mypackage1;
import java.math.BigDecimal;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import oracle.jbo.JboException;
import oracle.jbo.domain.Number;
import oracle.jbo.server.DBTransaction;
import oracle.jbo.server.ViewObjectImpl;
import oracle.jbo.server.ViewRowImpl;
import oracle.jbo.server.ViewRowSetImpl;
import oracle.jdbc.driver.OracleCallableStatement;
import oracle.jdbc.driver.OracleTypes;
// --- File generated by Oracle Business Components for Java.
public class LienCheckViewImpl extends ViewObjectImpl
* This is the PLSQL block that we will execute to retrieve the REF CURSOR
private static final String SQL =
"begin pprs_test_wrappers.sn_srch_main_test(?, ?, ?, ?, ?, ?);end;";
private BigDecimal totalRows = null;
private String messageCd = null;
private BigDecimal serialColCd = null;
private BigDecimal maxRows = null;
public LienCheckViewImpl() {}
* Overridden framework method.
* Executed when the framework needs to issue the database query for
* the query collection based on this view object. One view object
* can produce many related result sets, each potentially the result
* of different bind variable values. If the rowset in query is involved
* in a framework-coordinated master/detail viewlink, then the params array
* will contain one or more framework-supplied bind parameters. If there
* are any user-supplied bind parameter values, they will *PRECEED* the
* framework-supplied bind variable values in the params array, and the
* number of user parameters will be indicated by the value of the
* numUserParams argument.
protected void executeQueryForCollection(Object qc,Object[] params,int numUserParams) {
* If there are where-clause params (for example due to a view link)
* they will be in the 'params' array.
* We assume that if some parameter is present, that it is a Deptno
* value to pass as an argument to the stored procedure.
* NOTE: Due to Bug#2828248 I have to cast to BigDecimal for now,
* ---- but this parameter value should be oracle.jbo.domain.Number type.
String serialNumIn = null;
BigDecimal serialCollCdIn = null;
BigDecimal maxRowsAllowed = null;
BigDecimal totalRowsSelected = null;
String messageCdOut = null;
if (params != null) {
if (params.length>0) serialNumIn = (String)params[0];
if (params.length>1) serialCollCdIn = (BigDecimal)params[1];
if (params.length>2) maxRowsAllowed = (BigDecimal)params[2];
storeNewResultSet(qc,retrieveRefCursor(qc,serialNumIn,
serialCollCdIn,
maxRowsAllowed));
super.executeQueryForCollection(qc, params, numUserParams);
* Overridden framework method.
* Wipe out all traces of a built-in query for this VO
protected void create() {
getViewDef().setQuery(null);
getViewDef().setSelectClause(null);
setQuery(null);
* Overridden framework method.
* The role of this method is to "fetch", populate, and return a single row
* from the datasource by calling createNewRowForCollection() and populating
* its attributes using populateAttributeForRow().
protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs) {
* We ignore the JDBC ResultSet passed by the framework (null anyway) and
* use the resultset that we've stored in the query-collection-private
* user data storage
rs = getResultSet(qc);
* Create a new row to populate
ViewRowImpl r = createNewRowForCollection(qc);
try {
* Populate new row by attribute slot number for current row in Result Set
//AddedByRegisNum
populateAttributeForRow(r,0, nullOrNewNumber(rs.getBigDecimal(1)));
System.out.println("AddedByRegisNum :" + rs.getBigDecimal(1));
// OrigRegisNum
populateAttributeForRow(r,1, nullOrNewNumber(rs.getBigDecimal(2)));
System.out.println("OrigRegisNum :" + rs.getBigDecimal(2));
// SerialNum
populateAttributeForRow(r,2, rs.getString(3));
System.out.println("SerialNum :" + rs.getString(3));
// SerialNumDesc
populateAttributeForRow(r,3, rs.getString(4));
System.out.println("SerialNumDesc :" + rs.getString(4));
// FlagExactMatch
populateAttributeForRow(r,4, rs.getString(5));
System.out.println("FlagExactMatch :" + rs.getString(5));
// MessageCd
populateAttributeForRow(r,5, messageCd);
// TotalRows
populateAttributeForRow(r,6, totalRows);
catch (SQLException s) {
throw new JboException(s);
return r;
* Overridden framework method.
* Return true if the datasource has at least one more record to fetch.
protected boolean hasNextForCollection(Object qc) {
ResultSet rs = getResultSet(qc);
boolean nextOne = false;
try {
nextOne = rs.next();
* When were at the end of the result set, mark the query collection
* as "FetchComplete".
if (!nextOne) {
setFetchCompleteForCollection(qc, true);
* Close the result set, we're done with it
rs.close();
catch (SQLException s) {
throw new JboException(s);
return nextOne;
* Overridden framework method.
* The framework gives us a chance to clean up any resources related
* to the datasource when a query collection is done being used.
protected void releaseUserDataForCollection(Object qc, Object rs) {
* Ignore the ResultSet passed in since we've created our own.
* Fetch the ResultSet from the User-Data context instead
ResultSet userDataRS = getResultSet(qc);
if (userDataRS != null) {
try {
userDataRS.close();
catch (SQLException s) {
/* Ignore */
super.releaseUserDataForCollection(qc, rs);
* Overridden framework method
* Return the number of rows that would be returned by executing
* the query implied by the datasource. This gives the developer a
* chance to perform a fast count of the rows that would be retrieved
* if all rows were fetched from the database. In the default implementation
* the framework will perform a SELECT COUNT(*) FROM (...) wrapper query
* to let the database return the count. This count might only be an estimate
* depending on how resource-intensive it would be to actually count the rows.
public long getQueryHitCount(ViewRowSetImpl viewRowSet) {
Object[] params = viewRowSet.getParameters(true);
String serialNumIn = (String)params[0];
BigDecimal serialCollCdIn = (BigDecimal)params[1];
BigDecimal maxRowsAllowed = (BigDecimal)params[2];
CallableStatement st = null;
try {
st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
* Register the fourth bind parameter as our return value of type NUMERIC
st.registerOutParameter(4,Types.NUMERIC);
* Set the value of the 3 bind variables to pass as arguments
if (serialNumIn == null) st.setNull(1, Types.CHAR);
else st.setString(1,serialNumIn);
if (serialCollCdIn == null) st.setNull(2,Types.NUMERIC);
else st.setBigDecimal(2,serialCollCdIn);
if (maxRowsAllowed == null) st.setNull(3, Types.NUMERIC);
else st.setBigDecimal(3, maxRowsAllowed);
st.execute();
System.out.println("returning value of :" + st.getLong(4));
return st.getLong(4);
catch (SQLException s) {
throw new JboException(s);
finally {try {st.close();} catch (SQLException s) {}}
* Return a JDBC ResultSet representing the REF CURSOR return
* value from our stored package function.
private ResultSet retrieveRefCursor(Object qc,
String serialNum,
BigDecimal serialColCd,
BigDecimal maxRows) {
CallableStatement st = null;
try {
st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
* Set the value of the bind variables
System.out.println("SerialNumIn :" + serialNum);
if (serialNum == null) st.setNull(1,Types.CHAR);
else st.setString(1,serialNum);
if (serialColCd == null) st.setNull(2,Types.NUMERIC);
else st.setBigDecimal(2,serialColCd);
if (maxRows == null) st.setNull(3,Types.NUMERIC);
else st.setBigDecimal(3,maxRows);
st.registerOutParameter(1, Types.CHAR); // serialNum
st.registerOutParameter(2, Types.NUMERIC); // serialColCd
st.registerOutParameter(3, Types.NUMERIC); // maxRows
st.registerOutParameter(4, Types.NUMERIC); // totalRows
st.registerOutParameter(5, Types.CHAR); // messageCd
* Register the 6th bind parameter as our return value of type CURSOR
st.registerOutParameter(6,OracleTypes.CURSOR);
st.execute();
ResultSet rs = ((OracleCallableStatement)st).getCursor(6);
serialColCd = st.getBigDecimal(2);
System.out.println("SerialColCd= " + serialColCd);
maxRows = st.getBigDecimal(3);
System.out.println("maxRows= " + maxRows);
totalRows = st.getBigDecimal(4);
System.out.println("totalRows= " + totalRows);
messageCd = st.getString(5);
System.out.println("messageCd= " + messageCd);
* Make this result set use the fetch size from our View Object settings
rs.setFetchSize(getFetchSize());
return rs ;
catch (SQLException s) {
throw new JboException(s);
finally {try {st.close();} catch (SQLException s) {}}
* Store a new result set in the query-collection-private user-data context
private void storeNewResultSet(Object qc, ResultSet rs) {
ResultSet existingRs = getResultSet(qc);
// If this query collection is getting reused, close out any previous rowset
if (existingRs != null) {
try {existingRs.close();} catch (SQLException s) {}
setUserDataForCollection(qc,rs);
hasNextForCollection(qc); // Prime the pump with the first row.
* Retrieve the result set wrapper from the query-collection user-data
private ResultSet getResultSet(Object qc) {
return (ResultSet)getUserDataForCollection(qc);
* Return either null or a new oracle.jbo.domain.Number
private static oracle.jbo.domain.Number nullOrNewNumber(BigDecimal b) {
try {
return b != null ? new oracle.jbo.domain.Number(b) : null;
catch (SQLException s) { }
return null;
Natalie -
How to use a stored procedure as a datasource in Crystal Report for Eclipse
Hi All,
I've written a stored procedure in oracle 10g with few input parameters and one refcursor output parameter. I want to use this stored procedure as a data source for creating a report in "Crystal Report For Eclipse 3.6.0".
When I tried to add this stored procedure to the report using the connection explorer, I don't see any option to do this. But when I try to add any table, it shows options like "Add to the current report"....
Can anybody assist me how to use a stored procedure as a data source in "Crystal Report For Eclipse"?
Which driver should I use to connect to the oracle database? I tried using JDBC Driver for Oracle.
Thanks in advance.Did you solve your problem? How did you do?
-
Calling db2 stored procedures from wls 8.1 sp2
Hi,
We noticed strange behaviour when moving customers applications from wls 6.1 to 8.1 sp2. We have a use case where we call db2 stored procedure two times (same prcedure) to make inserts to a database. The first time when procedure is called, everything goes smoothly but at the second time db2 claims that statement is not prepared and gives us sql error sql0518n.
We do see this error only if we use wls prepared statement cache and without cache (size=0) everything seems to work. We also did some db2 level tracing and noticed that statement is not prepared when using wls cache and db2 cannot execute statement which is not prepared....
Why I'm asking this? because this is the first time I had disable wls cache. We have used it and even optimized software performance using prepared statement cache in several projects before this.
Procedure call is done from web container lavel and no EJBs is used. We have tested the use case using autommit option and also committed firts transaction manually and closed connection.
We are using DB2 8.2 fp7 as a database and IBM level 2 JDBC driver without XA support. Honor global transactions support is on at a datasource.
Is this normal behaviour? Db2 problem or maybe WLS problem?
Regards,
MikaI am getting the same exception about an assertion failed at weblogic.t3.srvr.T3Srvr.checkServerLock. Any ideas?
-
Beans using plsql stored procedures
Hi all
My question is: has jdeveloper any graphic tool or asistant to make something like use stored procedures that return multiple rows ( ref cursor ).
This is my problem, i'm student and have to build a web project that use beans, stored procedures and webservice.... i'm total noob in ejb, but i had worked with plsql some time.
Can anyone tell me pls where to start, some article to read or something that may help me in this task
VictorA Ref Cursor doesn't have any implicit structure, so it's not easy to automatically bind bean to it, however if you create database types like this, for example:
drop type dept_t_list;
drop type dept_t;
drop type emp_t_list;
drop type emp_t;
create type emp_t as object(
empno number(4),
ename varchar2(10),
job varchar2(9),
mgr number(4),
hiredate date,
sal number(7,2),
comm number(7,2),
deptno number(2),
terminated varchar(1)
create type emp_t_list as table of emp_t;
create type dept_t as object(
deptno number(2),
dname varchar2(14),
loc varchar2(13),
emps emp_t_list
create type dept_t_list as table of dept_t;
/Then you can create a pl/sql store procedure that works with this types and list types easily as beans and arrays of beans using the JPublisher tool.
If you visit my Not Yet Documented Examples page and see example 36, it contains the SQL scripts that create example types and a stored package to work with them. It also contains the JPublisher-created Java classes for working with those types and package.
http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html
Inside JDeveloper, if you visit the connection navigator, expand your database connection and expand the "Packages" node, you can right-mouse and generate java (using JPublisher under the covers for you) on any package. -
Converting DB2 stored procedure to Oracle?
I need a little help with a problem I ran across this week. I have an existing DB2 Stored procedure that calls a COBOL program. (See the procedure below). Now, I need to convert this DB2 to an Oracle Stored Procedure. I need the procedure to call the same COBOL program that this DB2 procedure does. Is it possible in Oracle? Do I need to write a Java wrapper class instead? Please help!!
CREATE PROCEDURE CO_CASEINFORMATION (
IN PARM1 CHAR(006) FOR SBCS DATA CCSID EBCDIC ,
IN PARM2 CHAR(018) FOR SBCS DATA CCSID EBCDIC ,
IN PARM3 CHAR(004) FOR SBCS DATA CCSID EBCDIC ,
IN PARM4 CHAR(008) FOR SBCS DATA CCSID EBCDIC ,
IN PARM5 CHAR(026) FOR SBCS DATA CCSID EBCDIC
LANGUAGE COBOL
EXTERNAL NAME COSP183
COLLID CACSDEV9
PARAMETER STYLE GENERAL
NOT DETERMINISTIC
MODIFIES SQL DATA
WLM ENVIRONMENT CACSDEV9
STAY RESIDENT YES
RESULT SETS 01
;Although I've never done that with COBOL, the documentation says it is possible to call an external COBOL procedure from within Oracle, without a Java wrapper class.
The way to do it is to rebuild your COBOL program with the Pro*COBOL pre-compiler.
Read the Pro*COBOL Programmer's Guide for more details. -
How do I call a DB2 Stored procedure?
I am having problems trying to call a DB2 stored procedure.
I am using the Service: Foundation -> JDBC 1.0 -> Call Stored Procedure.
Stored procedure I am calling is (with 4 input params):
CALL DB2D.SYSPROC.REGC1389(?, ?, ?, ?,
{$ /process_data/@Name_Full $},
{$ /process_data/@Name_Title $},
{$ /process_data/@Name_Last $},
{$ /process_data/@Name_Middle $},
{$ /process_data/@Name_First $},
{$ /process_data/@Name_Suffix $},
{$ /process_data/@Address_1 $},
{$ /process_data/@Address_2 $},
{$ /process_data/@Address_3 $},
{$ /process_data/@Address_City $},
{$ /process_data/@Address_State $},
{$ /process_data/@Address_Zip $},
{$ /process_data/@ex_Code $},
{$ /process_data/@Birthdate $},
{$ /process_data/@ID_TypeCode_1 $},
{$ /process_data/@ID_Number_1 $},
{$ /process_data/@ID_TypeCode_2 $},
{$ /process_data/@ID_Number_2 $},
{$ /process_data/@ID_TypeCode_5 $},
{$ /process_data/@ID_Number_5 $},
{$ /process_data/@ID_TypeCode_6 $},
{$ /process_data/@ID_Number_6 $},
{$ /process_data/@ID_TypeCode_7 $},
{$ /process_data/@ID_Number_7 $},
{$ /process_data/@ID_TypeCode_8 $},
{$ /process_data/@ID_Number_8 $},
{$ /process_data/@ID_TypeCode_9 $},
{$ /process_data/@ID_Number_9 $},
{$ /process_data/@ID_TypeCode_10 $},
{$ /process_data/@ID_Number_10 $},
{$ /process_data/@ID_TypeCode_11 $},
{$ /process_data/@ID_Number_11 $},
{$ /process_data/@ID_TypeCode_12 $},
{$ /process_data/@ID_Number_12 $},
{$ /process_data/@ID_TypeCode_13 $},
{$ /process_data/@ID_Number_13 $},
{$ /process_data/@ID_TypeCode_14 $},
{$ /process_data/@ID_Number_14 $},
{$ /process_data/@ID_TypeCode_15 $},
{$ /process_data/@ID_Number_15 $},
{$ /process_data/@ID_TypeCode_16 $},
{$ /process_data/@ID_Number_16 $},
{$ /process_data/@ID_TypeCode_17 $},
{$ /process_data/@ID_Number_17 $},
{$ /process_data/@ID_TypeCode_18 $},
{$ /process_data/@ID_Number_18 $},
{$ /process_data/@Return_Code $},
{$ /process_data/@SQL_RTNC $},
{$ /process_data/@SQL_StateCode $},
{$ /process_data/@SQL_Errmsg $});
(I can call this same stored proc in ColdFusion, so the procedure does work.)
The error message I get when I invoke it is:
=======================================
ALC-DSC-005-000: com.adobe.idp.dsc.DSCNotSerializableException: Not Serializable
Caused by: ALC-DSC-000-000: com.adobe.idp.dsc.DSCRuntimeException: Internal error.
at com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker.transientInvoke(WorkflowDSCInvoker. java:367)
at com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker.invoke(WorkflowDSCInvoker.java:157)
at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor. java:140)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(Transa ctionInterceptor.java:74)
at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.execute(EjbTr ansactionCMTAdapterBean.java:342)
at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.doRequiresNew (EjbTransactionCMTAdapterBean.java:284)
at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EJSLocalStatelessEjbTransactionCMTAdapter_ caf58c4f.doRequiresNew(Unknown Source)
at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvi der.java:143)
at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor.intercept(TransactionInt erceptor.java:72)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.InvocationStrategyInterceptor.intercept(InvocationStra tegyInterceptor.java:55)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.InvalidStateInterceptor.intercept(InvalidStateIntercep tor.java:37)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.AuthorizationInterceptor.intercept(AuthorizationInterc eptor.java:102)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.JMXInterceptor.intercept(JMXInterceptor.java:48)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.engine.impl.ServiceEngineImpl.invoke(ServiceEngineImpl.java:115)
at com.adobe.idp.dsc.routing.Router.routeRequest(Router.java:118)
at com.adobe.idp.dsc.provider.impl.base.AbstractMessageReceiver.invoke(AbstractMessageReceiv er.java:315)
at com.adobe.idp.dsc.provider.impl.soap.axis.sdk.SoapSdkEndpoint.invokeCall(SoapSdkEndpoint. java:138)
at com.adobe.idp.dsc.provider.impl.soap.axis.sdk.SoapSdkEndpoint.invoke(SoapSdkEndpoint.java :81)
at sun.reflect.GeneratedMethodAccessor171.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1096)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1037)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
at com.adobe.idp.dsc.provider.impl.soap.axis.InvocationFilter.doFilter(InvocationFilter.java :43)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java: 190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:832)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:679)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:566)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.jav a:90)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:748)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink .java:458)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink .java:387)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConn ectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitia lReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionLi stener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
Caused by: java.lang.RuntimeException: String Literal support for procedure calls to DB2/390 is disabled. Failing SQL text CALL DB2D.SYSPROC.REGC1389(?, ?, ?, ?,
at com.adobe.workflow.engine.PEUtil.invokeAction(PEUtil.java:837)
at com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker.transientInvoke(WorkflowDSCInvoker. java:346)
... 66 more
Caused by: java.lang.RuntimeException: String Literal support for procedure calls to DB2/390 is disabled. Failing SQL text CALL DB2D.SYSPROC.REGC1389(?, ?, ?, ?,
at com.adobe.idp.dsc.jdbc.helper.StoredProcedureHelper.callStoredProcedure(StoredProcedureHe lper.java:115)
at com.adobe.idp.dsc.jdbc.JDBCService.callStoredProcedure(JDBCService.java:660)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(DefaultPOJOInvokerImpl.jav a:118)
at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor. java:140)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(Transa ctionInterceptor.java:74)
at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionBMTAdapterBean.doBMT(EjbTran sactionBMTAdapterBean.java:197)
at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EJSLocalStatelessEjbTransactionBMTAdapter_ 3af08fdf.doBMT(Unknown Source)
at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvi der.java:95)
at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor.intercept(TransactionInt erceptor.java:72)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.InvocationStrategyInterceptor.intercept(InvocationStra tegyInterceptor.java:55)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.InvalidStateInterceptor.intercept(InvalidStateIntercep tor.java:37)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.AuthorizationInterceptor.intercept(AuthorizationInterc eptor.java:132)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.JMXInterceptor.intercept(JMXInterceptor.java:48)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)
at com.adobe.idp.dsc.engine.impl.ServiceEngineImpl.invoke(ServiceEngineImpl.java:115)
at com.adobe.idp.dsc.routing.Router.routeRequest(Router.java:118)
at com.adobe.idp.dsc.provider.impl.base.AbstractMessageReceiver.routeMessage(AbstractMessage Receiver.java:91)
at com.adobe.idp.dsc.provider.impl.vm.VMMessageDispatcher.doSend(VMMessageDispatcher.java:21 5)
at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(AbstractMessageDispat cher.java:57)
at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:208)
at com.adobe.workflow.engine.PEUtil.invokeAction(PEUtil.java:724)
... 67 more
Caused by: com.ibm.db2.jcc.c.SqlException: String Literal support for procedure calls to DB2/390 is disabled. Failing SQL text CALL DB2D.SYSPROC.REGC1389(?, ?, ?, ?,
at com.ibm.db2.jcc.c.ig.i(ig.java:2531)
at com.ibm.db2.jcc.c.jg.b(jg.java:292)
at com.ibm.db2.jcc.c.jg.<init>(jg.java:263)
at com.ibm.db2.jcc.c.kg.<init>(kg.java:72)
at com.ibm.db2.jcc.a.fc.<init>(fc.java:91)
at com.ibm.db2.jcc.a.b.b(b.java:1959)
at com.ibm.db2.jcc.c.p.a(p.java:2317)
at com.ibm.db2.jcc.c.p.prepareCall(p.java:1909)
at com.ibm.db2.jcc.c.nc.prepareCall(nc.java:246)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.pmiPrepareCall(WSJdbcConnection.java:1832)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareCall(WSJdbcConnection.java:1959)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareCall(WSJdbcConnection.java:1914)
at com.adobe.idp.dsc.jdbc.helper.StoredProcedureHelper.callStoredProcedure(StoredProcedureHe lper.java:105)
... 96 more
at com.adobe.idp.dsc.provider.impl.base.AbstractResponseHolder.handleException(AbstractRespo nseHolder.java:136)
at com.adobe.idp.dsc.provider.impl.soap.axis.sdk.SoapSdkBindingStubUtil.deSerializeResponse( SoapSdkBindingStubUtil.java:122)
at com.adobe.idp.dsc.provider.impl.soap.axis.sdk.SoapAxisDispatcher.doSend(SoapAxisDispatche r.java:128)
at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(AbstractMessageDispat cher.java:57)
at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:208)
at com.adobe.common.utils.invoke.InvokeWithProgressRunner.invokeServiceOperation(InvokeWithP rogressRunner.java:170)
at com.adobe.common.utils.invoke.InvokeWithProgressRunner.run(InvokeWithProgressRunner.java: 97)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
=======================================
I am using the JDBC Provider: DB2 Universal JDBC Provider
Implementation class name : com.ibm.db2.jcc.DB2ConnectionPoolDataSource
For the Data source : DB2D
Data store helper class name:Data store helper classes provided by WebSphere Application Server
This is my first attempt at calling a DB2 stored procedure, so any tips on how to make it work would be appreciated.
Thanks
JimJasmin,
Thanks for the "db2.jcc.supportZosSpLiterals=yes" configuration property suggestion.
I worked with our WebSphere support team to set this property. We set it as a Custom Property in the data source.
The DB2 driver version is higher then the APAR which supports this property, but it doesn't seem to recognize it.
[8/28/09 11:15:42:775 CDT] 0000003f DSConfigurati W DSRA8200W: DataSource Configuration: DSRA8020E: Warning: The property 'supportZosSpLiterals' does not exist on the DataSource class com.ibm.db2.jcc.DB2ConnectionPoolDataSource.
[8/28/09 11:15:43:337 CDT] 0000003f InternalDB2Un I DSRA8203I: Database product name : DB2
[8/28/09 11:15:43:353 CDT] 0000003f InternalDB2Un I DSRA8204I: Database product version : DSN08015
[8/28/09 11:15:43:353 CDT] 0000003f InternalDB2Un I DSRA8205I: JDBC driver name : IBM DB2 JDBC Universal Driver Architecture
[8/28/09 11:15:43:353 CDT] 0000003f InternalDB2Un I DSRA8206I: JDBC driver version : 2.11.24
[8/28/09 11:15:43:369 CDT] 0000003f InternalDB2Un I DSRA8212I: DataStoreHelper name is: [email protected]
[8/28/09 11:15:43:384 CDT] 0000003f WSRdbDataSour I DSRA8208I: JDBC driver type : 4
Are we setting the property in the right place? What version of the DB2 driver is needed for this property? Any other tips?
Thanks
Jim -
ORA-04030: out of process memory when using Java Stored Procedures
Hello,
I have a problem using Java Stored Procedures in Oracle 10g.
My Java application performs http posts to a webservice and the response is parsed in order to populate some DB tables.
There is a scheduled job which calls the Java Stored Procedure every x minutes.
No matter of the 'x minutes' values - after about 160 - 200 calls I get this error:
ORA-04030: out of process memory when trying to allocate 1048620 bytes (joxp heap,f:OldSpace)
ORA-04030: out of process memory when trying to allocate 2097196 bytes (joxp heap,f:OldSpace)
The job stops just while is posting the http request. The weird thing is that almost each time the first http post request I get this error:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:426)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(DashoA6275)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:130)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
and the second try works fine.
So, The out of process memory occured each time just before getting such an error, and I suspect to be a connection between these errors.
Tech details:
1. OS: WinXP
2. Oracle 10.1.0.2.0
3. To perform http post I use HttpClient 3.1 from Apache.
4. I checked the http connection to be closed each time, and this is done.
5. I checked the oracle statement and connection to be closed each time and this is done
6. The JVM error (logged in .trc files of Oracle) is:
java.lang.OutOfMemoryError
at java.lang.Thread.start(Native Method)
at sun.security.provider.SeedGenerator$ThreadedSeedGenerator.run(SeedGenerator.java:297)
DB Settings details:
Starting up ORACLE RDBMS Version: 10.1.0.2.0.
System parameters with non-default values:
processes = 200
sessions = 225
shared_pool_size = 159383552
large_pool_size = 8388608
java_pool_size = 104857600
nls_language = AMERICAN
control_files = C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL01.CTL, C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL02.CTL, C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL03.CTL
db_block_size = 8192
db_cache_size = 29360128
compatible = 10.1.0
fal_client = XXXXXX
fal_server = XXXXXXs
log_buffer = 524288
log_checkpoint_interval = 100000
db_files = 70
db_file_multiblock_read_count= 32
db_recovery_file_dest = C:\oracle\product\10.1.0\flash_recovery_area
db_recovery_file_dest_size= 2147483648
standby_file_management = AUTO
undo_management = AUTO
undo_tablespace = undotbs_01
undo_retention = 14400
remote_login_passwordfile= EXCLUSIVE
db_domain =
dispatchers = (PROTOCOL=TCP) (SERVICE=XXXXXXXDB)
remote_dependencies_mode = SIGNATURE
job_queue_processes = 4
parallel_max_servers = 5
background_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\BDUMP
user_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\UDUMP
max_dump_file_size = 10240
core_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\CDUMP
sort_area_size = 1048576
sort_area_retained_size = 1048576
db_name = XXXXXX
open_cursors = 500
optimizer_mode = FIRST_ROWS
pga_aggregate_target = 25165824
Any help would be appreciated. Thanks.
Can be a problem with JVM threading under Oracle ?The server prcess failed to allocate more memory for large objects ( in Oldspace).
If you Google ORA-04030, you will see several recommendations to work around this.
The Java VM in the database already has HttpClient, i don't know why you are loading the Apache HttpClient but this might not be the surce of the problem.
Kuassi http://db360.blogspot.com -
Looking for some help with using Oracle stored procedures in vb2010
First off thank you to whoever lends me a hand with my problem. A little background first I am in a software development class and we are currently building our program using VB (I have no experience in this), and Oracle(currently in a Oracle class so I know how to use Oracle itself just not with VB).
I am using vb2010 express edition if that helps. Currently I have a stored procedure that takes a 4char "ID" that returns a position (ie, salesperson,manager ect). I want to use the position returned to determine what vb form is displayed (this is acting as a login as you dont want a salesperson accessing the accountants page for payroll ect).
Here is the code I have currently on the login page of my VB form
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Public Class Login
Dim conn As New OracleConnection
Private Sub empID_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles empID.Click
End Sub
Private Sub LoginBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginBtn.Click
conn.ConnectionString = "User ID = Auto" & _
";Password = ********" & _
";Data Source = XE"
conn.Open()
Dim sq1 As String = "Return_Position" 'name of procedure
Dim cmd As New OracleCommand(sq1, conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New OracleParameter("I_EmpID", OracleDbType.Char, 4)).Value = Emp_ID.Text
Dim dataReader As OracleDataReader = cmd.ExecuteReader
dataReader.Read()
Dim position As New ListBox
position.Items.Add(dataReader.GetString(0)) 'were I am getting an error, I also tried using the dataReader.getstring(0) to store its value in a string but its a no go
If position.FindStringExact("MANAGER") = "MANAGER" Then
Me.Hide()
Dim CallMenu As New Menu()
CallMenu.ShowDialog()
End If
LoginBtn.Enabled = False
End Sub
I have read the oracle.net developer guide for using oracle in vb2010 and have successfully gotten through the document however they never use a stored procedure, since the teacher wants this program to user a layered architecture I cannot directly store sql queries like the document does, thus the reason I want to use stored procedures.
This is getting frustrating getting stuck with this having no background in VB, I could easily do this in c++ using file i/o even through it would be a pain in the rear....Hello,
I am calling Oracle 11g stored procedures from VB.Net 2010. Here is a code sample (based on your code) you should be able to successfully implement in your application.
Please note that you may have to modify your stored procedure to include an OUT parameter (the employee position) if it doesn't have it yet.
Private Sub LoginBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginBtn.Click
Dim sProcedureName As String = "Return_Position" 'name of stored procedure
Dim ORConn as OracleConnection, sConn as String
Dim sPosition as String, sDataSource as String, sSchema as String, sPWD as String
Dim cmd As OracleCommand
'please provide below sDataSource, sSchema and sPWD in order to connect to your Oracle DB
sConn = "Data Source=" & sDataSource & ";User Id=" & sSchema & ";Password=" & sPWD & ";"
ORConn = New OracleConnection(sConn)
ORConn.Open()
cmd = New OracleCommand(sProcedureName, ORConn)
With cmd
.CommandType = Data.CommandType.StoredProcedure
'input parameter in your stored procedure is EmpId
.Parameters.Add("EmpID", OracleDbType.Varchar2).Value = Emp_ID.Text
.Parameters.Item("EmpID").Direction = ParameterDirection.Input
'output parameter in your stored procedure is Emp_Position
.Parameters.Add("Emp_Position", OracleDbType.Varchar2).Direction = ParameterDirection.Output
.Parameters.Item("Emp_Position").Size = 50 'max number of characters for employee position
Try
.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
Exit sub
End Try
End With
sPosition = cmd.Parameters.Item("Emp_Position").Value.ToString
'close Oracle command
If Not Cmd Is Nothing Then Cmd.Dispose()
Cmd = Nothing
'close Oracle connection
If Not ORConn Is Nothing Then
If not ORConn.State = 0 Then
ORConn.Close()
End If
ORConn.Dispose()
End If
ORConn = Nothing
If UCase(sPosition) = "MANAGER" Then
Me.Hide()
Dim CallMenu As New Menu()
CallMenu.ShowDialog()
End If
LoginBtn.Enabled = False
End Sub
If you need further assistance with the code, please let me know.
Regards,
M. R.
Maybe you are looking for
-
This is a pile of Junk - How do I return back to the older version?
Running Window 7 Cannot save a pdf file. The menus just flicker and you cannot access them. The books marks wont stay open. Cannot dual screen. How do I return to the older version?
-
Cfqueryparam behaving really strange
Hi! I have the following scenario. CFMX 7.0 MS SQL 2005 Col1 and Col3 are nvarchar and Col 2 is an int Working sql: (returns all rows matching clause) SELECT * FROM table WHERE col1 = <cfqueryparam cfsqltype="cf_sql_varchar" value="#var1#"> AND col2
-
Finder does not open when a file passes over (mac os X 10.8.3)
Just installed mac os 10.8.3 mountain lion. As such, it seems with this OS X version the "finder" does not open when a file passes over (in order to move it from desktop). The screen dims a little and nothing else happens. How can I recover the "find
-
Precompiling JSPs in batch?
My sysadmins are getting worried about leaving the JDK on servers as they see it as a potential security risk - somehow someone could remotely compile an exploitation tool or something... The problem is we have a webserver that serves JSP's so their
-
I started editing my project in Final Cut Pro trial, then purchased the full app. Now I can't find my project. What gives?