Hoe to pass object as a parameter thru webSerive
I need to pass Object as a parameter to web service:
example:
public calss returnCodes{
int ret_code;
String ret_string;
public retrunCodes(int ret_code, String ret_string){
this.ret_code = ret_code;
this.ret_string = ret_string;
public int getret_code()
return this.ret_code;
public String getret_string {
return this,ret_string
and other repc holder class to hold returnCodes
public class retrunCodesHolder implents javax.xml.rpc.Holder
returnCode value;
pubic returnCodesHolder(){
public returnCodesHolder(returnCodes value) {
this.value = value;
In Webservice I use returnCodesHolder as parameter.
WebService getReturnCodesWs I have
returnCodes retCodes = new returnCodes(04,"Good return code)
returnCodesHolder retholder = new returnCodesHolder(retCodes)
return myString;
When I am calling above webService in servlet I have code:
org.test.mytest.returnCodesHolder retHolder = new org.test.mytest.returnCodesHolder();
String result = port.getReturnCodesWs(retHolder);
How to I access /get values of returnCodes class in my calling servlet?
I am using Tomcat v 6.0
I believe (although have never used, so if I'm wrong,
correct me please!) you can do it with implicit
dynamic cursors, such as:
For rec in 'select col1, col2 from table 1 '||lstr
loop
Not really:
michaels> declare
lstr varchar2 (30) := ' where empno = 7788';
begin
for rec in 'select * from emp e ' || lstr
loop
null;
end loop;
end;
Error at line 1
ORA-06550: line 5, column 4:
PLS-00103: Encountered the symbol "LOOP" when expecting one of the following:
. ( * @ % & - + / at mod remainder rem .. <an exponent (**)>
||
Similar Messages
-
Passing object as a parameter to a method while dragging it to UI
Hi
I am using webservice datacontrol to invoke "Secured webservice". Dragged a method from datacontrol and dropped it into UI, it passes a object(i.e., SOAHeader object) as input parameter and returns "String" as a output. So, here I have created a java class and passing it as an object to the method. When i deployed the app into Android emulator, while clicking that method as a button, its throwing me an error message *"HTTPStatusCode 500: Server encountered an unexpected condition which prevented it from fulfilling the request"*. I tried to configure debugger to get log for remote deployment, after that the application itself not opening in emulator. Then how can i find the exact reason for this error message?
Here I got few doubts,
1) Is this the correct way of passing the object as a method input parameter?
2) How can i invoke secured web service through "Webservice datacontrol" in ADF Mobile. I searched in google and got a link by andrejus "http://andrejusb.blogspot.be/2012/11/adf-mobile-secured-web-service-access.html", but not understanding about "*adfCredentialStoreKey*", what is it? and how can i use it?. I set the security policies as mentioned, is it enough to invoke the secured webservices without giving username/password?. Bit confused, can anyone please tell me more about accessing secured webservices from webservice datacontrol.
3) I tried to configure debug option(as mentioned in developer's guide) to get log of remote deployment. I changed *"java.debug.enabled=true"* in cvm.properties. After that configuration, unable to open that mobile app through emulator. What could be the reason?
Regards
RajThank you Shay.. you have posted new demo's regarding this for people like us(Newbies in ADF), awesome :) Please keep continuing.. This demo & Andrejus sample helps me a lot to do sample authentication using "**Remote login server**".
Small doubt, Is it possible to inject user credentials with webservice request without creating *"regular" web ADF application, securing it, and deploying it on a server* . I read it in mobile document that,
For secured web services, the user credentials are dynamically injected using ADF Mobile uses Oracle Web Services Manager (OWSM) Lite Mobile ADF Application Agent to create and configure proxies, as well as to request services through the proxies. The user credentials are injected into the OWSM enforcement context when proxies are configured.
I am new with this OWSM, can you please give me some hints like how to proceed further for implementing authentication using OWSM lite mobile ADF Application Agent.
Thanks in advance -
Passing a Vector object as a parameter to a method
Hi,
How can I pass a Vector object as a parameter to a method?
void buttonAdd_actionPerformed(ActionEvent e) {
Vector studentHobbies = new Vector();
String[] items = listHobbies.getSelectedItems();
for (int i=0; i<items.length; i++) {
studentHobbies.addElement(items);
newStudent = new Student(Name,StudentNumber,studentHobbies);
studentenlist.addTo(newStudent);
So I want to pass the Vector object 'studentHobbies' to a method.
Would I do something like this :import java.util.Vector;
public Student(String Name, int StudentenNumber, Vector studentHobbies){
this.Name = Name;
this.StudentNumber = StudentNumber;
this.studentHobbies = StudentenHobbies;yes, thats how you do it.
maybe you should first try your idea and then ask people questions?
also, use ArrayList instead of Vector, its better - google as to why if you care. -
How to pass an object as a parameter
how do you pass an object as a parameter? (what type should it be ?)
Well you can use a [url http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html]String
Or you can take a [url http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Double.html]Double
And you can pass [url http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Event.html]Events
and get yourself in trouble
and you can use a [url http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Frame.html]Frame
or maybe take a [url http://java.sun.com/j2se/1.4.2/docs/api/java/util/List.html]List
but some will use [url http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collection.html]Collection
depends you your direction
so if you need to know
if you should use a [url http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.html]Map
then this is what to do
just browse the [url http://java.sun.com/j2se/1.4.2/docs/api/]API -
How to pass class object as in parameter in call to pl/sql procedure ?
hi,
i have to call pl/sql proecedure through java. In pl/sql procedure as "In" parameter i have created "user defined record type" and i am passing class object as "In" parameter in call to pl/sql procedure. but it is giving error.
so, anyone can please tell me how i can pass class object as "In" parameter in call to pl/sql procedure ?
its urgent ...
pls help me...793059 wrote:
I want to pass a cursor to a procedure as IN parameter.You can use the PL/SQL type called sys_refcursor - and open a ref cursor and pass that to the procedure as input parameter.
Note that the SQL projection of the cursor is unknown at compilation time - and thus cannot be checked. As this checking only happens at run-time, you may get errors attempting to fetch columns from the ref cursor that does not exist in its projection.
You also need to ask yourself whether this approach is a logical and robust one - it usually is not. The typical cursor processing template in PL/SQL looks as follows:
begin
open cursorVariable;
loop
fetch cursorVariable bulk collect into bufferVariable limit MAX_ROWS_FETCH;
for i in 1..bufferVariable.Count
loop
MyProcedure( buffer(i) ); --// <-- Pass a row structure to your procedure and not a cursor
end loop;
..etc..
exit when cursorVariable%not_found;
end loop;
close cursorVariable;
end; -
Passing connection object as EJB parameter
I am working on a legacy website which uses stateless session EJB's and runs on
WebLogic 6.1 using JDK 1.3 and Oracle 8.1.6, I am working on upgrading this
application to WebLogic 9.2, JDK 1.5 and Oracle 10.2.
I configured a datasource in WebLogic using the Oracle thin XA driver.
When attempting to run the application I got an error message stating that an
object which is not serializable is being passed as an EJB parameter. I found that
several EJB methods are passing open database connections as parameters so to fix this
issue we should change the code. However, I am reluctant to change the code since I
believe that the reason for passing the connection objects is that the developers
wished to preserve transactions and so any changes might result in many issues in
the application. I have the following questions:
- The code is doing something which is not allowed. So why was this okay in WebLogic
6.1 using the older Oracle oci driver?
- One way to get around this would be to convert the EJB's to POJOS. There are no
container based properties and the only EJB's are stateless session EJB's. The
high water mark for concurrant usage is 40. There is only a single server (no clustering)
What kind of issues would such a
conversion bring?
- Would it be better to convert the EJB's to local interfaces? What kind of issues would
this bring?
Any other suggestions would be very much appreciated.Salma Saad wrote:
Thanks Joe,
Converting to POPJOS from EJB or to local EJB's is changing the code but it limits changes to the logic of the application which could result in unforseen issues.
There is only 1 server and 1 jvm but I get a not serlializable exception which I did not get when running this code on WebLogic 6.2 or 8.1 using Oracle 8.1.6 and 9i .I am getting it now that I am using WL 9.2 and Oracle 10.2.
I looked through all the parameters and everything is a string except for Connection which does not implement serializable. There is a Vector but all the contained objects are strings. Let me know if you have any ideas what I can do to get rid of this, and also why is it happenning in the newer version of WL when it didn't happen before?
weblogic.utils.AssertionError: ***** ASSERTION FAILED *****
at weblogic.rmi.internal.CBVWrapper.copy(CBVWrapper.java:57)
at com.isr.applications.isrinteractive.ejb.sessionbean.user.UserBean_x07h56_EOImpl_CBV.validateLogin(Unknown Source)
at jsp_servlet._admin.__validatelogin._jspService(__validatelogin.java:187)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)Hi. I looked at the code throwing this exception, and
it's in a whole 'nother area of the server, nothing to
do with JDBC or EJBs as such. It's odd too, because it
seems to have already verified that whatever object
it's dealing with is a serializable object...
I recommend you're opening an official support case
about this exception, and maybe they'll want help
reproducing it...
Joe
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:391)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:309)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at com.isr.applications.isrinteractive.servlets.reports.SessionFilter.doFilter(Unknown Source)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3212)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1983)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1890)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1344)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Caused by: java.io.NotSerializableException: java.lang.Object
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at weblogic.rmi.extensions.server.CBVOutputStream.writeObject(CBVOutputStream.java:84)
at weblogic.rmi.internal.CBVWrapper.copy(CBVWrapper.java:49)
... 20 more -
Hi All,
I have a procedure that takes IN an object as the parameter. I'm using SQL Developer , and also have SQL*plus.
The type is
create or replace
TYPE TY_RAILROAD_OPERATOR AS OBJECT
RRX_RAILROAD_OPERATOR_CD VARCHAR2(6 BYTE),
RRX_RAILROAD_OPERATOR_NM VARCHAR2(60 BYTE) ,
RRX_RAILROAD_OPERATOR_DSC VARCHAR2(2000 BYTE),
STATUS CHAR(1 BYTE),
LAST_UPDATE_DT DATE,
LAST_UPDATE_USER VARCHAR2(60))
procedure set_Railroad_Operator(p_TY_Railroad_Operator IN TY_Railroad_Operator, p_Railroad_Operator_Id OUT NUMBER) IS
v_Railroad_Operator_Id NUMBER;
BEGIN
I have to execute the procedure. How should I pass the parameters?
I would like to test the procedure, and I have no idea how to test it.
Any help is appreciated.
Thanks in advance
Nsample:
SQL> CREATE OR REPLACE TYPE ty_railroad_operator AS OBJECT(
2 rrx_railroad_operator_cd VARCHAR2(6 BYTE),
3 rrx_railroad_operator_nm VARCHAR2(60 BYTE),
4 rrx_railroad_operator_dsc VARCHAR2(2000 BYTE),
5 status CHAR(1 BYTE),
6 last_update_dt DATE,
7 last_update_user VARCHAR2(60)
8 );
9 /
Type created.
SQL> CREATE OR REPLACE PROCEDURE set_railroad_operator(
2 p_ty_railroad_operator IN ty_railroad_operator,
3 p_railroad_operator_id OUT NUMBER
4 )
5 IS
6 v_railroad_operator_id NUMBER := 10;
7 BEGIN
8 DBMS_OUTPUT.put_line(p_ty_railroad_operator.rrx_railroad_operator_cd);
9 DBMS_OUTPUT.put_line(p_ty_railroad_operator.rrx_railroad_operator_nm);
10 DBMS_OUTPUT.put_line(p_ty_railroad_operator.rrx_railroad_operator_dsc);
11 DBMS_OUTPUT.put_line(p_ty_railroad_operator.status);
12 DBMS_OUTPUT.put_line(p_ty_railroad_operator.last_update_dt);
13 DBMS_OUTPUT.put_line(p_ty_railroad_operator.last_update_user);
14 END;
15 /
Procedure created.
SQL>
SQL> DECLARE
2 v_ty_railroad_operator ty_railroad_operator
3 := ty_railroad_operator('OP_CD', 'OP CODE NAME', 'OP CODE DESC', 'S',
4 SYSDATE, 'OP CODE USER');
5 a NUMBER(10);
6 BEGIN
7 set_railroad_operator(p_ty_railroad_operator => v_ty_railroad_operator,
8 p_railroad_operator_id => a);
9 END;
10 /
OP_CD
OP CODE NAME
OP CODE DESC
S
15-JUN-10
OP CODE USER
PL/SQL procedure successfully completed.
SQL> -
Will passing object as parameter increase memory usage?
Hi,
Will passing an object as a parameter increase the mmory usage? will it affect the performance of the application any means. Please share your view.
Regards,
A.Ananth.durai wrote:
Hi ,
Just to precise my question, suppose i have an object called Student.I want to pass the Student Object to a method called addStudent().Now rather than passing Student Object, i am passing it's super class "Object". (i.e)
addStudent(Object object) instead of addStudent(Student student)will it make any difference in performance?Those are declarations, not method passing. You'd still be passing the same thing, if it's just a question about how you declare the method.
And it will make no difference in performance, except when you start getting bugs. You might start getting bugs because you declared the parameter with a more general type than is really necessary. If the method takes a Student, then declare it as taking a Student. Making it say it takes an Object will just make things worse.
But as per Cogniac,
when you pass a parameter or use an accessor function (get() function) or something of that sort, it's actually just passing a pointer that points to the memory location of the Object you want, not actually passing the Object itself to you, nor is it instantiating a new instance of the Object for your use.if i pass Object itself instead of Student,which memory address it will point out?That question makes no sense. You pass what you pass. If it's a Student object, then the reference the method gets will point to that object, regardless of whether the method knows that it's a Student or just an Object generally. -
Passing object as parameter in JSF using h:commandLink tag
Hi ,
I have a scenario in which i need to pass objects from one jsp to another using h:commandLink. i read balusC article "Communication in JSF" and found a basic idea of achieving it. Thanks to BalusC for the wonderful article. But i am not fully clear on the concepts and the code is giving some error. The code i have is
My JSP:
This commandlink is inside a <h:column> tag of <h:dataTable>
<h:commandLink id="ol3"action="ManageAccount" actionListener="#{admincontroller.action}" >
<f:param id="ag" name="account" value="#{admincontroller.account}" />
<h:outputText id="ot3" value="Manage Account" rendered="#{adminbean.productList!=null}" />
</h:commandLink>
Also a binding in h:dataTable tag with the binding="#{admincontroller.dataTable}"
My Backing Bean:
public class CompanyAdminController {
private HtmlDataTable dataTable;
private Account account=new Account();
public HtmlDataTable getDataTable() {
return dataTable;
public Account getAccount() {
return this.account;
public void setAccount(Account account) {
this.account = account;
public void action(){
account= (Account)this.getDataTable().getRowData();
} faces-config.xml
<navigation-rule>
<from-view-id>/compadmin.jsp</from-view-id>
<navigation-case>
<from-outcome>ManageAccount</from-outcome>
<to-view-id>/manageAccount.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>admincontroller</managed-bean-name>
<managed-bean-class>com.forrester.AdminController</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>account</property-name>
<property-class>com.model.Account</property-class>
<value>#{param.account}</value>
</managed-property>
</managed-bean>My account object:
public class Account {
string name;
public String getName()
return this.name;
public void setName(String name)
this.name=name;
}I need to display #{admincontroller.account.name} in my forwarded jsp. But I am not sure whether the code i wrote in commandlink is correct. I get an error if i use <f:setActionListener> . No tag "setPropertyActionListener" defined in tag library imported with prefix "f"
Please advise.
Edited by: twisai on Oct 18, 2009 11:46 AM
Edited by: twisai on Oct 18, 2009 11:47 AM
Edited by: twisai on Oct 18, 2009 11:48 AMYes.. iam removed the managedproperty from faces-config. But still i get the null pointer exception on main jsp itself and i am taken to second jsp manageaccount.jsp. Did you find anything wrong in my navigation case in the action method??
public String loadAccount(){
Account account = (Account)this.getDataTable().getRowData();
return "ManageAcct";And also can you please answer this question i have
The AdminController is the backing bean of 1st JSP and manageAccontController is the backing bean of forwarded JSP .
Can i put this action method and dataTable binding in a 2nd manageAccontController backing bean instead of AdminController. But if i do that way dataList binding in h:dataTable tag will be in first JSP backing bean and dataTable binding to 2nd JSP. Not sure how to deal with this.
{ -
Is possible to pass array/list as parameter in TopLink StoredProcedureCall?
Hi, We need to pass an array/List/Vector of values (each value is a 10 character string) into TopLink's StoredProcedureCall. The maximum number of elements on the list is 3,000 (3,000 * 10 = 30,000 characters).
This exposed two questions:
1. Is it possible to pass a Vector as a parameter in TopLink's StoredProcedureCall, such as
StoredProcedureCall call = new StoredProcedureCall();
call.setProcedureName("STORED_PROCEDURE_NAME");
call.addNamedArgument("PERSON_CODE");
Vector strVect = new Vector(3000);
strVect.add(“ab-gthhjko”);
strVect.add(“cd-gthhjko”);
strVect.add(“ef-gthhjko”);
Vector parameters = new Vector();
parameters.addElement(strVect);
session.executeQuery(query,parameters);
2. If the answer on previous question is yes:
- How this parameter has to be defined in Oracle’s Stored Procedure?
- What is the maximum number of elements/bytes that can be passed into the vector?
The best way that we have found so far was to use single string as a parameter. The individual values would be delimited by comma, such as "ab-gthhjko,cd-gthhjko,ef-gthhjko..."
However, in this case concern is the size that can be 3,000 * 11 = 33, 000 characters. The maximum size of VARCHAR2 is 4000, so we would need to break calls in chunks (max 9 chunks).
Is there any other/more optimal way to do this?
Thanks for your help!
ZoranHello,
No, you cannot currently pass a vector of objects as a parameter to a stored procedure. JDBC will not take a vector as an argument unless you want it to serialize it (ie a blob) .
The Oracle database though does have support for struct types and varray types. So you could define a stored procedure to take a VARRAY of strings/varchar, and use that stored procedure through TopLink. For instance:
StoredProcedureCall call = new StoredProcedureCall();
call.setProcedureName("STORED_PROCEDURE_NAME");
call.addNamedArgument("PERSON_CODE");
oracle.sql.ArrayDescriptor descriptor = new oracle.sql.ArrayDescriptor("ARRAYTYPE_NAME", dbconnection);
oracle.sql.ARRAY dbarray = new oracle.sql.ARRAY(descriptor, dbconnection, dataArray);
Vector parameters = new Vector();
parameters.addElement(dbarray);
session.executeQuery(query,parameters);This will work for any values as long as you are not going to pass in null as a value as the driver can determine the type from the object.
dataArray is an Object array consisting of your String objects.
For output or inoutput parameters you need to set the type and typename as well:
sqlcall.addUnamedInOutputArgument("PERSON_CODE", "PERSON_CODE", Types.ARRAY, "ARRAYTYPE_NAME"); which will take a VARRAY and return a VARRAY type object.
The next major release of TopLink will support taking in a vector of strings and performing the conversion to a VARRAY for you, as well as returning a vector instead of a VARRAY for out arguments.
Check out thread
Using VARRAYs as parameters to a Stored Procedure
showing an example on how to get the conection to create the varray, as well as
http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/varray/index.html on using Varrays in Oracle, though I'm sure the database docs might have more information.
Best Regards,
Chris -
How to pass more than one parameter using common...
Hi,
I am using ODP.NET with my 2005 VB
I want to create function from where I can pass more than one parameter to execute SP, or query just like i created for SQL SERVER as below
Public shared Function CreateParameter(ByVal paramname As String, ByVal paramvalue As Object) As DbParameter
Dim param As DbParameter
param = New SqlParameter
param.ParameterName = paramname
param.Value = paramvalue
Return param
End Function
Public Shared Function ExecuteQuery(ByVal sql As String, ByVal commtype As CommandType, ByVal ParamArray parameter As DbParameter())
Dim cmd As DbCommand = New SqlCommand()
cmd.Connection = OpenConnection()
cmd.CommandType = commtype
cmd.CommandText = sql
cmd.Parameters.AddRange(parameter)
Dim RetVal As Integer = cmd.ExecuteNonQuery()
Return RetVal
End Function
specially part is in bold to be converted
I tried like but oracleCommand.parameters doesnt support AddRange
please help me out
RegardsHello,
I used the following way:
pCommand.CommandText = "Update " + sDataTable + " set "
+ sColumnName + " = :1 ";
pCommand.Parameters.Add("ValueToDb",
this.DefaultDbType,
this.m_Value,
System.Data.ParameterDirection.Input);
Of course, you can add :2,... to your command text, too.
The way back is:
sEndOfTheClause += " RETURNING " + sDataTable + "." + sColName + " INTO :iNewValue";
pCommand.CommandText = ... + sEndOfTheClause;
pCommand.Parameters.Add("iNewValue", this.DefaultDbType,
ParameterDirection.Output);
bool bReturn = (pCommand.ExecuteNonQuery() != 0);
if ((bReturn == true) && (pCommand.Parameters.Count > 0))
this.Value = DataService.Convert<DATA_TYPE>(pCommand.Parameters[0].Value);
.... -
Passing Objects to Stored Procedures in SQL Queries: UNREF(REF(o))
To me it seems that passing an object (type) to stored procedure in a SQL query is quite laborious. See:
I created the following simple type:
TYPE LAST AS OBJECT (
id NUMBER
defined a function:
FUNCTION "CHECKLAST" (l LAST)
RETURN NUMBER
AS LANGUAGE JAVA
NAME 'Checker.checkLast(Last) return int';
created a typed table:
CREATE TABLE lastTable OF Last;
inserted some objects:
INSERT INTO lastTable VALUES (1003);
NOW! If want to use the StoredFunction I have to use the following syntax:
SELECT checkLast(DEREF(REF(o)))
FROM lasttable o;
That's not very elegant.
I would expect the follwing to be working:
SELECT checkLast(o)
FROM lasttable o;
Did I do something wrong? Or did Oracle forget to implement the simple syntax?
Even worse, the DEREF(REF(o)) trick does not work for member functions...
Regards,
AndréI did some experiments and can now (partly) answer my own question:
Indeed, it is possible to declare a function with a parameter passed as reference:
CREATE OR REPLACE TYPE Point AS OBJECT
ID INT,
MEMBER FUNCTION distance(q IN REF Point) RETURN NUMBER
Unfortunately, it is not possible to use the REF in PL/SQL directly:
CREATE OR REPLACE TYPE BODY Point is
MEMBER FUNCTION distance(q IN REF Point) RETURN NUMBER
AS
BEGIN
RETURN q.ID - SELF.ID; --Error(5,14): PLS-00536: No navigation through REF
END;
end;
So, for testing purposes I decided to implement a very simple PL/SQL member function:
CREATE OR REPLACE TYPE BODY Point is
MEMBER FUNCTION distance(q IN REF Point) RETURN NUMBER
AS
BEGIN
RETURN -1;
END;
end;
BUT: The SQL query without VALUE is still not possible. The query
SELECT *
FROM PointTable d, PointTable e
WHERE d.distance(e) > 0
renders ORA-00904: "E": invalid identifier
Somehow the 'e' seems to be misinterpreted completely.
Illogically, the following query works fine:
SELECT *
FROM PointTable d, PointTable e
WHERE d.distance(REF(e)) > 0
The illogical thing is that, now 'E' seems to refer to a VALUE and not to REF (because we can use the REF function), whereas in Gaverill's post 'O' seems to refer to a REF (because we can use the VALUE function).
My intent is to avoid both the VALUE(o) from Gaverill's example and the REF(e) from my example, because both is not intuitive for end users...
Maybe I have to define a VIEW holding the object values... But then the end user has to use it in the FROM part.
All in all, there seems to be no elegant solution for passing objects as parameters to functions...
Regards,
André -
Completely avoid passing of Oracle user informations thru http
Hi friends,
I am using Oracle 10g Application Server & Oracle 10g Forms & Report services. But I have to pass all the parameters thru a query String. So the problem is all the endusers can view the Database details by taking the properties.
#) I want to set the Database Logon information some where in any confiruration file and this should read when calling forms. so that i can avoid passing of Database user informations. Is there any way to configure like this?
#) Multiple applications are running on Oracle AS and each applications are using defferent schema. How can I set the different User Informations in the configuration file.
I want to completely avoid passing of Oracle user informations thru http.
thanks & regards
LakmalHello Lakmal,
As I said, you can edit formsweb.cfg and a user parameter section. For example, lets take yur sample url:
add this section to formsweb.cfg:
[change]
userid=lakmal/mabil@ewis
form=change.fmx
note:
it is better to make the edit at EM console itself.
Then when you will run the form use this url:
http://dunhinda.com/forms90/f90servlet?config=change
The url has been shortened and your username and password is hidden.
and if your user would run diffeent forms, you can drop the form=change.fmx and speficify form name in the url like
section in formsweb.cfg
[lakmal]
userid=lakmal/mabil@ewis
then the url will now be:
http://dunhinda.com/forms90/f90servlet?config=change&form=formname.fmx
Regards -
How to pass a LogicalSchema as parameter
Hi all,
is there a way to pass the LSchema to a package?
I try to explain my situation.
I have a source with 3 different schema (one for each company) with the same table structure.
I have a target with 3 different schema (one for each company) with the same table structure.
I have done a package that load 1 table in the first schema pair.
To load this table I have created a procedure that make a "create table as" statement (using KM I have poor performance, any suggest for performance KM is appreciated).
Inside procedure command I have to write the logical Schema, but in this way I can't reuse the package, cause I have to create another package equal to the first and modify the logical schema inside the procedure command.
I believe this is not the right way.
Is there a way to reuse code passing logical schema like parameter?
Thanks in advanceHi CTS,
I have followed your suggestion, but probably I'm missing something.
I have created 3 context (1 enviroment (test) for 3 customer) and mapped the logicl schema with the physical.
Then I have deleted the logical schema "cabled" and left it blank in my procedure command.
Then I have executed the procedure with one of the new context created, but i receive an error (seems can't retrieve the LSCHEMANAME, why, if I have mapped the L and P schema to the context?):
java.lang.Exception: Internal error: object ConnectConnection
ColConnectId:null
ColContextCode:ODS_TEST
ColConName:null
ColIndCommit:null
ColIsolLevel:null
ColLschemaName:null
ColPlanComp:null
ColTechIntName:null
DefConnectId:null
DefContextCode:ODS_TEST
DefConName:null
DefIndCommit:null
DefIsolLevel:null
DefLschemaName:null
DefPlanComp:null
DefTechIntName:ORACLE
ExeChannel:J
IndErr:1
IndLogMethod:null
IndLogNb:null
LogLevDet:3
Nno:1
OrdTrt:0
ScenTaskNo:1
SessNo:396001
TaskName1:Procedure
TaskName2:Create_Table_As
TaskName3:Drop_target_table
TaskType:S
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execStdOrders(Unknown Source)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(Unknown Source)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(Unknown Source)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(Unknown Source)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(Unknown Source)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(Unknown Source)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(Unknown Source)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(Unknown Source)
at com.sunopsis.dwg.cmd.e.i(Unknown Source)
at com.sunopsis.dwg.cmd.h.y(Unknown Source)
at com.sunopsis.dwg.cmd.e.run(Unknown Source)
at java.lang.Thread.run(Unknown Source) -
Passing objects to a servlet - session or as byte[]
Hi
I'm creating my first servlet and I want opinions on my design. I plan to sue my servlet to generate an image. So in my jsp page I have an image tag with the following
<img src="/Servlet/GenerateImage">But my servlet requires data in an ArrayList from my JSP page. How can I pass the ArrayList to my servlet? I've done some research and been looking aorund the forums, and I noticed people either convert the object to byte[] or pass the object using the session. I've tried doing the byte[] method but I don't know how to pass the byte[] to my servlet. I tried passing it as a parameter using a query string, get the parameter as a string, and convert it to byte[] again, but it didn't work. I can't seem to get this approach to work.
I'm worried that if I use the session, and a large number of people access my page which runs the servlet, my server will be bogged down.
What is the best approach in doing this? It'd be great if some sample code or links are supplied
Thanks for all the help!My servlet requires data in an ArrayList from my
JSP page. How can I pass the ArrayList to my servlet?
I've done some research and been looking aorund the
forums, and I noticed people either convert the object
to byte[] or pass the object using the session. If the ArrayList is derived in the JSP and is required in the servlet, then saving it as a session attribute is the best bet. I guess it would be possible to send all the data from the ArrayList to the client in a cookie, but that seems messy and inefficient.
I'm worried that if I use the session, and a large
number of people access my page which runs the
servlet, my server will be bogged down.The session attribute only contains a reference to the ArrayList and so in itself does not cause a performance problem. If you're concerned that the ArrayList is very large, you could consider saving the info to a disk file. Alternatively, could the ArrayList be derived in the servlet instead of, or as well as, the JSP? Does the servlet need all the Arraylist entries, or just a subset? If a subset, save that as a session attribute and dereference the ArrayList in the JSP. Also, think about when the ArrayList reference can safely be removed from the session.
What is the best approach in doing this? It'd be great
if some sample code or links are suppliedJSP
<jsp:useBean id="myArrayList" class="java.util.ArrayList" scope="session"/>Servlet
HttpSession session = request.getSession();
ArrayList al = (ArrayList) session.getAttribute("myArrayList");
.
Maybe you are looking for
-
How can I enable the standard ctrl-n/ctrl-p shortcuts to navigate dropdowns in Mac OSX?
In OSX, ctrl-n/ctrl-p are are generally accepted as substitutes for up/down, and those keyboard shortcuts can be used to move the selection up/down in a dropdown menu. Safari and Chrome properly move the dropdown selection, but Firefox does not. Fire
-
How to run report in background, save output to word or excel
Hello all, I have a huge report that needs to be run in background and I need the report in word. When running in Dialog it takes too long and SAP times out. How do you get something to run in background and have the output in excel. I know you can g
-
Problem:Multiple instances of the same applet on a webpage...
I have an applet which connects to a server to read an XML-file. I use Doucument to parse the XML-file like this: String xmlurl="http://www.somesite.com/somexmlpage.php"; Document d =DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(xml
-
Class with interface, extends Sprite, but get compile error accessing "visible"
Here is the situation: - Class MyLoader extends Sprite implements ILoader The class extends Sprite and works perfectly. var _loader:DisplayObject = new MyLoader(); _loader.visible = true; Works perfectly. var _loader:ILoader = new MyLoader(); _loader
-
8gb (2x4gb) modules in early Mac Pro showing up as 4GB...
Old Mac Pro 1.1 Just bought 2 x 4GB modules and put them in the top rise in 1 and 2. They usually show up in About This Mac correctly but I've just noticed they're occaisonally showing up as 4GB total and 2 x 2GB... A little weird. Is this because it