Lookup in Stored Procedure

Hi Guys,
I'm facing the following problem.
I would like to write a stored procedure which insert into a table. What I want is that if I run again the procedure I'd like to write only the new records and update the existing records.
Does anyone has an idea, how I can do it? or anyone has an example?
Thanks
Adam

Look at the MERGE statement.
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_915a.htm#2080942

Similar Messages

  • Calling a Stored Procedure with Parameter using an UDF

    Hi All,
      I have a requirement where I need to use database lookup. In that I am calling the Stored Procedure using UDF. For example sp_flow ., for this I have to pass<INTID> and <USDERID> to get the response.
    I am using the below code to excute this.
    Channel channel = null;                                                   
    Map rowMap = null;                                                        
    DataBaseAccessor accessor = null;                                         
    DataBaseResult resultSet = null;                                          
    String Query = null;   
    //Query ="EXECUTE dbo.sp_flow <INTID> <USERID>;                                                 
    Query = "EXECUTE dbo.sp_flow  \'304\' ,  \'shankar\'  " ;       
      try{                                                                               
    //Determine a channel, as created in the Configuration                    
    channel =                                                                 
    LookupService.getChanne"BS_XXX","CC_XXX_JDBC_Rcv");                                                                               
    //Get a system accessor for the channel. As the call is being made to an  
    DB, an DatabaseAccessor is obtained.                                      
    accessor = LookupService.getDataBaseAccessor(channel);                                                                               
    //Execute Query and get the values in resultset                           
    resultSet = accessor.execute(Query);                                                                               
    for(Iterator rows = resultSet.getRows();rows.hasNext();){                 
    rowMap = (Map)rows.next();                                                                               
    result.addValue((String)rowMap.get("FLOW_ID"));                       
    I am getting the error "Error when calling an adapter by using the communication channel CC_NWLS_TLA_JDBC_Rcv (Party: , Service: BS_MICROSOFT_SQLWLS20DEV_D, Object ID: d30aace599de3cd69548bf145d0724b7) XI AF API call failed. Module exception: (No information available). Cause Exception: 'Error processing request in sax parser: Error when executing statement for table/stored proc. 'table' (structure 'statement'): com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set."
    let me know how do this.
    Regards
    shankar
    Edited by: Shankar on Jun 9, 2009 2:51 PM
    Edited by: Shankar on Jun 9, 2009 3:02 PM

    first of all calling a SP via the lookup API, there is a workaround but it is not at all recommended
    FYI
    /people/arpil.gupta/blog/2008/11/03/workaround-for-jdbc-scenarios - DB Lookup via Stored procedure
    http://help.sap.com/javadocs/NW04S/current/pi/com/sap/aii/mapping/lookup/DataBaseAccessor.html
    The accessor does not support transactional behaviour. Therefore, the method should not be used to execute insert or update statements on the database which can lead to inconsistencies. The accessor should only be used to read data from a database table.

  • Displaying Stored Procedure (SQL) in Report (INFORMATION_SCHEMA.ROUTINES.ROUTINE_DEFINITION)

    We have processes that call numerous stored procedures.  We are trying to create a SSRS report for our IT department to use so they can easily lookup the stored procedure definition.  Some end users do not have access to SQL Server Management Studio.
    The dataset query uses a System View... INFORMATION_SCHEMA.ROUTINES.  We are joining on the
    ROUTINE_NAME.  When running the SQL, it works perfect.  We are able to get all the columns we need.  The primary column in the INFORMATION_SCHEMA.ROUTINES we need is ROUTINE_DEFINITION (the sql/text of the stored procedure).
    In SSRS, we copy/paste the same SQL into the DataSet query.  When I test the query in the DataSet window (using red
    ! button), it pulls back the data just fine.
    I then drop all the queried columns on the report (see query below).  When I run the report all data is display except the ROUTINE_DEFINITION column.  Why is this?  Is it because it's SQL and SSRS won't display SQL content?  How
    can I get the ROUTINE_DEFINITION column data on the report?
    Here is example query I'm using in the SSRS dataset:
    SELECT SPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAME,
    ROUTINE_TYPE, CREATED, LAST_ALTERED,
    ROUTINE_DEFINITION
    FROM INFORMATION_SCHEMA.ROUTINES
    WHERE ROUTINE_NAME = @StoredProcedureName
    Andy Kreider | Principal Financial Group | Des Moines, IA, USA

    I have created a new report with the query.  When I run the query, you can see I get results for all columns (as expected).
    I'm using a tablix report and just dropping the columns on the report.  No other editing or customization of the report.  I confirmed (twice) that the Field Name and Field Source are present within the
    Dataset Properties > Fields page. 
    ROUTINE_DEFINITION is list as the Field Name AND Field Source.
    When I run the report through Report Builder, this is what I see...
    As you can see, the ROUTINE_DEFINITION column has no data.  I also ran this same report outside of Report Builder editor by just clicking on the report to open it in a browser window.  Same results... data for all columns except ROUTINE_DEFINITION.
    Seems like this would be something between Report Builder and SQL Server when being displayed.  Or could it be a permissions issue?
    Andy Kreider | Principal Financial Group | Des Moines, IA, USA
    Just out of curiosity did you try using same query on a reporting services report and see if there's any change?
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • EJB from stored procedure lookup problem

    We are running a test case with in an EJB deployed to Oracle 8.1.6, accessing it from a Java stored procedure. It works okay if the stored procedure is called a limited number of times from a single client (client is non-Java). However, for performance testing, we are trying to run it several hundred times in sequence to better simulate the eventual production environment. Consistently on the 216th call, it fails with a NamingException from the InitialContext lookup. We can restart the client again and it will fail on the same call.
    Sounds like something memory related to me. Does anyone have any ideas? I'm using standard EJB client code in my stored procedure, instantiating an InitialContext, performing a lookup on the EJB, performing a home interface create, then accessing an EJB method.
    Thinking it might be that my test was too fast for whatever garbage collection is being done on the server, I tried a 2 second delay between invocations--same problem occurs, however. Should I be making a call to remove my EJBs when my stored procedure ends? If so, how would I do that?
    I did try making the handle to my EJB a static variable within the stored procedure and only "creating" the EJB once. That works okay with a single client, but if I run 2 clients simultaneously, 1 will work for awhile and then eventually die trying to call the EJB method--while the other client continues to run successfully.
    I'm stumped. Any insight or guidance will be greatly appreciated. Thanks.

    My DBA bumped up the large_pool_size and java_pool_size settings and the problem went away. I couldn't convince him to bump the settings one at a time, so am not sure which one was at the root of the problem.
    As I looked at the trace logs on the server, I also noticed that we were getting intermittent "peer disconnected socket" messages during the testing. That appears to have gone away with the pool size increases, also--in case that helps out anyone else.

  • Can Stored procedure with IN and OUT Paramter can be used in JDBC LOOKUP?

    can Stored procedure with IN and OUT Paramter can be used in JDBC LOOKUP?

    Checking online help, I do not see any possibility.
    "Queries a data base by the given SQL statement."
    http://help.sap.com/javadocs/pi/pi711sp03/com/sap/aii/mapping/lookup/DataBaseAccessor.html
    -> execute

  • Stored Procedure using JDBC lookup.

    Did anyone tried this?
    does the DataBaseAccessor supports this type of call?
    cheers.
    Nimrod.g

    Hi,
    DatabaseAccessor does not support Stored Procedure...
    Have a look:
    http://help.sap.com/javadocs/NW04/current/pi/com/sap/aii/mapping/lookup/DataBaseAccessor.html
    It say's: The accessor does not support transactional behaviour. Therefore, the method should not be used to execute insert or update statements on the database which can lead to inconsistencies. The accessor should only be used to read data from a database table.
    Regards

  • Stored procedure to identify column names from a lookup table

    I have a working PL/SQL stored proc as below:
    CREATE OR REPLACE PROCEDURE PROC_TEST IS
    CURSOR GET_TEST_VALUES IS
    SELECT
    MF_master.comp_service_b,MF_master.normal_form_amount_b, MF_master.plan_id_b, MF_master.plan_percentage_b, MF_master.plan_service_b,MF_master.autoid,     ORA_master.comp_service_v, ORA_master.normal_form_amount_v,
    ORA_master.plan_id_v, ORA_master.plan_percentage_v,
    ORA_master.plan_service_v, ORA_master.autoid,     ORA_master.test_var     FROM MF_master, ORA_master
    WHERE ((MF_master.autoid = ORA_master.autoid));
    BEGIN
    FOR REC IN GET_TEST_VALUES LOOP
    begin
    if rec.test_var='SVC' then
    if (to_number(rec.plan_service_b) = to_number(rec.plan_service_v) ) and
    (to_number(rec.comp_service_b) = to_number(rec.comp_service_v) ) then
    update ORA_master set status_v = 'COMPLETE',last_updt_user_v = 'PROCEDURE',last_updt_date_v = SYSTIMESTAMP where autoid = rec.autoid;
    else
    update ORA_master set status_v = 'INCOMPLETE',last_updt_user_v = 'PROCEDURE',last_updt_date_v = SYSTIMESTAMP where autoid = rec.autoid;
    end if;
    end if;
    if rec.test_var = 'TERM' then
    if (to_number(rec.plan_percentage_b) = to_number(rec.plan_percentage_v) ) and
    (to_number(rec.normal_form_amount_b) = to_number(rec.normal_form_amount_v) )
    then
    update ORA_master set status_v = 'COMPLETE',last_updt_user_v = 'PROCEDURE',last_updt_date_v = SYSTIMESTAMP where autoid = rec.autoid;
    else
    update ORA_master set status_v = 'INCOMPLETE',last_updt_user_v = 'PROCEDURE',last_updt_date_v = SYSTIMESTAMP where autoid = rec.autoid;
    end if;
    end if;
         end;
         END LOOP;
         COMMIT;
    END;
    What I am doing here is, if test_var = 'SVC', I am comparing 2 columns, plan_service_b and comp_service_b(with plan_service_v and
    comp_service_v)
    Similarly, for test_var = 'TERM', it is plan_percentage_b and normal_form_amount_b(with plan_percentage_v and normal_form_amount_v)
    The above works fine as of now, but I am looking for a way to make this design more dynamic. In other words, these comparison columns may change from time
    to time and each time something changes, I will have to change this code. Rather, I am looking for a way to have the comparison columns in a
    lookup table that I can query to get what needs to be compared.
    My thought is :
    CREATE TABLE COMPARISON_COL_LOOKUP
    (test_var VARCHAR2(10),
    MF_column VARCHAR2(30),
    ORA_column VARCHAR2(30) );
    And then, insert
    INSERT INTO COMPARISON_COL_LOOKUP ('SVC','PLAN_SERVICE_B','PLAN_SERVICE_V');
    INSERT INTO COMPARISON_COL_LOOKUP ('SVC','COMP_SERVICE_B','COMP_SERVICE_V');
    INSERT INTO COMPARISON_COL_LOOKUP ('TERM','PLAN_PERCENTAGE_B','PLAN_PERCENTAGE_V');
    INSERT INTO COMPARISON_COL_LOOKUP ('TERM','NORMAL_FORM_AMOUNT_B','NORMAL_FORM_AMOUNT_V');
    commit;
    In this way, when tomorrow, when something changes - like new columns need to be compared for SVC or TERM, OR, if any comparisons need to
    be removed, all I need to do is to change the data in this lookup table !
    Now here's my question --- If I have this lookup table, how best can I update my above stored procedure to use this lookup table so that I don't need to
    hard-code the column names for comparison ?
    Any thoughts/suggestions are appreciated.

    While it is certainly technically possible to use dynamic SQL here, I would suggest that you make absolutely certain that you're not making things unnecessarily complicated...
    Dynamic SQL is generally substantially harder to write, debug, and maintain than equivalent static SQL. In addition, it takes a lot more work to ensure that dynamic SQL performs as well as static SQL (i.e. you now have to explicitly use bind variables) and that you're not introducing security holes via SQL injection.
    If your comparisons are likely to change infrequently, and particularly as those changes would imply changes to the underlying requirements, I would tend to be biased toward keeping the working procedure and just planning on making code changes periodically.
    Of course, not knowing your particular requirements, I certainly can't be certain that dynamic SQL would be inappropriate here, but I have seen lots of folks unnecessarily complicate their systems by building overly flexible systems that were painful to support and extend.
    Justin

  • Why Dynamic Parameter is not working, when i create report using stored procedure ?

    Post Author: Shashi Kant
    CA Forum: General
    Hi all
    Why Dynamic Parameter is not working, when i create report XI using stored procedure ?
    Only i shaw those parameters which i used in my stored procedure, the parameter which i create dynamic using stored procedure
    is not shown to me when i referesh the report for viewing the results.
    I have used the same procedure which i mention below but can not seen the last screen which is shown in this .
    ============================================================================================
    1. Select View > Field Explorer2. Right-click on Parameter Fields and select New from the right-click menu.3. Enter u201CCustomer Nameu201D as the name for your parameter4. Under u201CList of Valuesu201D select u201CDynamicu201D5. Under the Value column, click where is says u201Cclick here to add itemu201D and select Customer Name from the drop-down list. The dialog shown now look like the one shown below in Figure 1. Click OK to return to your report design.
    Dynamic Parameter Setup6. Next, select Report > Select Expert, select the Customer Name field and click OK.7. Using the drop-down list beside select u201CIs Equal Tou201D and using the drop-down list, select your parameter field (it should be the first field). 8. Click OK to return to your report design and see the parameter dialog.The parameter dialog will appear and show you a dynamic list of values that is updated each time your run your report. It couldnu2019t be easier! In our next tutorial, we will be looking at how to use this feature to create cascading parameter fields, where the values are filtered by the preceding selection.
    Dynamic Parameters in Action
    My question is that whether dynamic parameter is working with storedprocedure or not.
    When i added one table and try to fetch records using dyanmic prameters. after that i am not be able to find the dynamic parameter option when i referesh my report.
    One more thing when i try the static parameter for my report, the option i see when i referesh the screen.
    Please reply soon , it's urgent
    Regards
    shashi kant

    Hi Kishore,
    I have tested the issue step by step by following you description, while the first issue works well in my local environment. Based on my research, this can be caused by the lookup expression or it indeed return Male value based on the logic. If you use the
    expression below, it will indeed only return the Male record. So please try to double-check the record in the two datasets and the expression in your environment:
    =lookup(first(Fields!ProgramID.Value,"DataSet1"),Fields!ProgramID.Value,Fields!Gender.Value,"DataSet2")
    As to the second issue, please try to use the following expression:
    =Count(Lookup(fields!ProgramID.value,fields!ProgramID.value,fields!Gender.value,"DataSet2"))
    Besides, if this issue still exist, in order to trouble shoot this issue more efficiently, could you please post both the .rdl  file with all the size properties to us by the following E-mail address?  It is benefit for us to do further analysis.
    E-mail: [email protected]
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How do I get data to the from in a form based on a stored procedure

    I would like to create a form based on a stored procedure. I have bound LOV's that lookup the ID of the data that is to be displayed on the form. Then I have a button that reads the database and populates the fields on the form. This is our current UI standard on our portal site, and I need to copy that UI exactly in order to mix HTML DB code with our current portal code because we can not afford to re-write all our code in portal to HTML DB. Can this be done, and how can it be done? Thanks

    We are developing an entire HR system for our organization using portal forms. I am trying to prototype in HTML DB to see if we can switch our future development to this new product. However, we already have 50 or so forms that follow a certain user interface look and feel in portal. I am trying to create this interface look and feel in HTML DB. What we are doing in Portal is have a lookup section at the top of each form where you find the record you want to update with LOV's, sometimes 2 or 3 bound together, and then have a lookup button that does PL/SQL to read the database and populate the fields on the form. Then there is an Update button at the end of the form that takes the fields off the form and passes them to a stored procedure. I can not figure out how to do the Lookup button type of code to read information and bring it to the form when doing a form based on a stored procedure.

  • Calling a DB2 stored procedure from SAP MSSQL environment (linkedserver)

    Hi All
    We are strugling to call 'stored procedures' on DB2 via linkedserver. We are running db MSSQL.
    When performing regular lookups on DB2 tables we have no problems - but when executing stored procedures - we are getting no answer - what so ever back. Not even an error.
    Should this not be possible?
    Appreciate your help.
    /Bo
    Message was edited by:
            Bo Moeller

    closing

  • DB Adapter calling stored procedure in MS SQL Server.

    Hi
    i am calling a stored procedure in a MS SQL Server.
    I configured a Datasource for MS SQL Server driver as Oracle's MS SQL Server Driver(Type 4) Versions: 7.0 and later and provide all db details of sql server. I tested the data source and was getting success message. My BPEL code is just talking with input parameter and then calling the stored procedure in sql server. I was able to compile the code in jdeveloper and deploy to weblogic. But when i am testing the code. i am getting an error.
    <env:Fault>
    <faultcode>env:Server</faultcode>
    <faultstring>Exception occured when binding was invoked.
    Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'IDMService' failed due to: JCA Binding Component connection issue.
    JCA Binding Component is unable to create an outbound JCA (CCI) connection.
    Test:IDMService [ IDMService_ptt::IDMService(InputParameters,OutputParameters) ] : The JCA Binding Component was unable to establish an outbound JCA CCI connection due to the following issue: javax.resource.spi.IllegalStateException: [Connector:199176]Unable to execute allocateConnection(...) on ConnectionManager. A stale Connection Factory or Connection Handle may be used. The connection pool associated with it has already been destroyed. Try to re-lookup Connection Factory eis/sql/idm from JNDI and get a new Connection Handle.
    Please make sure that the JCA connection factory and any dependent connection factories have been configured with a sufficient limit for max connections. Please also make sure that the physical connection to the backend EIS is available and the backend itself is accepting connections.
    The invoked JCA adapter raised a resource exception.
    Please examine the above error message carefully to determine a resolution.</faultstring>
    <faultactor/>
    <detail>
    <exception>[Connector:199176]Unable to execute allocateConnection(...) on ConnectionManager. A stale Connection Factory or Connection Handle may be used. The connection pool associated with it has already been destroyed. Try to re-lookup Connection Factory eis/sql/idm from JNDI and get a new Connection Handle.</exception>
    </detail>
    </env:Fault>
    What is the problem with connection . How cna i rectify it.
    Thanks,
    Venu Raja

    followed the steps mentioned in meatalnk..
         JCA-12563 - Unable to Establish an Outbound JCA CCI Connection [ID 1235943.1]
    Metalink ID - 1235943.1

  • Call stored procedure with OUT parameter

    Hello,
    I have created a short-lived process. Within this process I am using the "FOUNDATION > JDBC > Call Stored Procedure" operation to call an Oracle procedure. This procedure has 3 parameters, 2 IN and 1 OUT parameter.
    The procedure is being executed correctly. Both IN parameters receive the correct values but I am unable to get the OUT parameter's value in my process.
    Rewriting the procedure as a function gives me an ORA-01460 since one of the parameters contains XML (>32K) so this is not option...
    Has someone been able to call a stored procedure with an OUT parameter?
    Regards,
    Nico

    Object is Foundation, Execute Script
    This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
    import javax.naming.InitialContext;
    import javax.sql.DataSource;
    import java.sql.*;
    PreparedStatement stmt = null;
    Connection conn = null;
    ResultSet rs = null;
    try {
    InitialContext ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
    conn = ds.getConnection();
    stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
    stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
    rs = stmt.executeQuery();
    rs.next();
    patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
    } finally {
    try {
    rs.close();
    } catch (Exception rse) {}
    try {
    stmt.close();
    } catch (Exception sse) {}
    try {
    conn.close();
    } catch (Exception cse) {}

  • Prob. in Executing dynamic stored procedure inside a function where S.P....

    Hi,
    My Stored Procedure is
    create or replace procedure concatname(a varchar2,
    b varchar2,
    c out varchar2)
    as
    begin
    c := a || b;
    end;
    My Function is
    create or replace function ex(sp varchar2)
    return varchar2 as
    v varchar2(100);
    begin
    execute immediate 'begin '||sp||'(''test'','' procedure'',:o); end;'
    using out v;
    return v;
    end;
    Iam using PowerBuilder 8 as a FRONT END Tool ( connecting to ORACLE db - 10gR2 through ODBC driver) for executing the above function where i will pass the stored procedure name ( CONCATNAME ) as an argument.
    The function is executing fine when i execute through ISQL interface.
    While executing this function from the front end tool( POWER BUILDER ) iam getting the following error.
    ORA-03113: end-of-file on communication channel.
    I dont know, why this error is coming ? As the function is executing fine
    through ISQL ?
    I think this error will come if you execute the above function from any front
    end tool( like .Net etc. ).
    Can anybody help me ? How to avoid this error ( ORA-03113 ) ?
    For Your Information: All other simple functions are executing fine through POWER BUILDER in my application.

    ORA-03113: end-of-file on communication channel is a client driver error. It is a symptom of a problem - it is not the problem itself.
    This error message simply says that your client was still talking to the database service process servicing your client session, when that (TCP/IP socket) connection was unexpectedly torn down by the server.
    This is often caused by that database service process crashing due to an internal (ORA-0600) error - and taking the TCP/IP connection down with it.
    You need to ask your DBA to have a look at the alert log file for the Oracle instance. The crash will be recorded there. In addition a trace file should have been created.
    Using the 1st parameter of the ORA-0600 message for the crash in the alert log file, the DBA should lookup the possible causes of the crash on Metalink note 153788.1

  • Problems with java stored procedure.

    I have a java stored procedure that uses a package called RmiJdbc
    which allows calling remote JDBC data sources from any java capable
    machine.
    I've loaded the RmiJdbc classes into oracle via the loadjava
    command and everything seems to come up valid.
    The stored procedure does a Class.forName() to get the driver
    registered, than attempts to connect to the remote RMI driver.
    The particular line it dies on is this (see the error below):
    c = DriverManager.getConnection("jdbc:rmi:" + rmiHost + "/" + url);
    A mangled version of this (minus the Oracle specific stuff) works
    from the command line correctly. Can somebody point me in a
    direction to figure out what's going on here?
    THanks,
    Eric
    Oracle9i Enterprise Edition Release 9.0.1.3.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.0.1.3.0 - Production
    ORACLE_HOME = /oracle/v901ee
    System name: HP-UX
    Node name: athena
    Release: B.11.00
    Version: A
    Machine: 9000/889
    Instance name: PASDB2
    Redo thread mounted by this instance: 1
    Oracle process number: 13
    Unix process pid: 7839, image: oracle@athena (TNS V1-V3)
    *** SESSION ID:(8.547) 2002-08-15 15:41:27.221
    java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
    java.lang.NullPointerException
    java.lang.NullPointerException
    at sun.rmi.server.LoaderHandler$LoaderKey.<init>(LoaderHandler.java)
    at sun.rmi.server.LoaderHandler.lookupLoader(LoaderHandler.java)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java)
    at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java)
    at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
    at java.io.ObjectInputStream.inputArray(ObjectInputStream.java)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
    at java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java)
    at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java)
    at java.io.ObjectInputStream.inputObject(ObjectInputStream.java)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java)
    at sun.rmi.registry.RegistryImpl_Stub.lookup
    at org.objectweb.rmijdbc.RJConnection.<init>(RJConnection:83)
    at org.objectweb.rmijdbc.Driver.connect(Driver:135)
    at java.sql.DriverManager.getConnection(DriverManager.java)
    at java.sql.DriverManager.getConnection(DriverManager.java)
    at TurnoverInfoPlusInterface.insertInterfaceRecords(TurnoverInfoPlusInterface:53)
    java.sql.SQLException: Error unmarshaling return; nested exception is:
    java.lang.NullPointerException
    at org.objectweb.rmijdbc.Driver.connect(Driver:140)
    at java.sql.DriverManager.getConnection(DriverManager.java)
    at java.sql.DriverManager.getConnection(DriverManager.java)
    at TurnoverInfoPlusInterface.insertInterfaceRecords(TurnoverInfoPlusInterface:53)

    More info...I'm also seeing "ORA-03113: end-of-file on communication channel". I checked the user trace file and didn't get much help...it indicated an "exception signal: 11" and core-dump type stuff that had no meaning to me.

  • Deserialization permissions error in CLR stored procedure

    Environment: SQL Server 2008 R2 standard edition and VS2010, .Net Framework 3.5
    I've got a table with a varbinary column that contains a serialized Hashtable. I'm writing a CLR stored procedure that, given the contents of such a field from a row in the table, does a lookup on a key in the Hashtable. and returns the element's value.
    To get the Hashtable, I need to deserialize it, and it appears that the BinaryFormatter's Deserialize function requires certain permissions that I don't know how to grant.
    This SQL Server instance runs on my own development machine, and was installed pretty much with all defaults. I'm the owner.
    Any help on solving this? I should point out while I write a fair amount of SQL and a LOT of VB, I'm far from a SQL Server expert, so if you have suggestions I'd appreciate it if you'd spell things out clearly for me.
    Thanks in advance for any help,
    Tom
    Here's a fragment from the VB source:
        ' the bytes variable is defined as Byte()
        Dim ms As MemoryStream = New MemoryStream()
        ms.Write(bytes, 0, bytes.Length)
        ms.Seek(0, 0)
        Dim formatter As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter()
        Dim oHT As Object = formatter.Deserialize(ms)    'hurls here
    The CREATE ASSEMBLY statement had WITH PERMISSION_SET = SAFE. I tried it with UNSAFE, and got this error:
    CREATE ASSEMBLY for assembly 'ddmi.deep.data.sqlserver' failed because assembly 'ddmi.deep.data.sqlserver' is not authorized for PERMISSION_SET = UNSAFE.  The assembly is authorized when either of the following is true: the database owner (DBO) has
    UNSAFE ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with UNSAFE ASSEMBLY permission.
    Here's an SQL script that runs it:
    declare
        @id int
      , @raw_req_bin varbinary(1500)
      , @value nvarchar(max)
    set @id = 327
    set @raw_req_bin = (select raw_req_bin from dp_payment where transaction_id = @id)
    set @value = dbo.dp_fx_hash_table_lookup(@raw_req_bin, 'first_name')
    and here's what I get when I run the script:
    SecurityExceptionSystem.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
       at System.Security.CodeAccessSecurityEngine.SpecialDemand(PermissionType whatPermission, StackCrawlMark& stackMark)
       at System.Security.CodeAccessPermission.DemandInternal(PermissionType permissionType)
       at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
       at ddmi.deep.data.sqlserver.UserDefinedFunctions.AsHashTable(Byte[] bytes, String& phase)
    The action that failed was:
    Demand
    The type of the first permission that failed was:
    System.Security.Permissions.SecurityPermission
    The Zone of the assembly that failed was:
    MyComputer

    Set the database (in a test system) to trustworthy (ALTER DATABSE foo SET TRUSTWORTHY ON) for testing. If this works, look into code signing (sign an assembly and catalog the cert/asymmetric key to master) for production. If you have problems with
    "native" serialization, you might get better results using XML serializers.
    Re: XML serializers. SQLCLR will not load dynamically generated serializers. So you need to pregenerate XML serializers with sgen.exe.
    Your specific error message (the permission error) might be fixed by cataloging the SQLCLR assembly as UNSAFE. If that doesn't work, you might attempt to change the .NET permission configuration on your machine using either of the tools described here:
    http://msdn.microsoft.com/en-us/library/7c9c2y1w(v=vs.90).aspx
    Hope this helps, Cheers, Bob

Maybe you are looking for

  • Bugreport: intelligent playlists don't work, if mediatype is used

    I found the following bug with intelligent playlists and ipod classic: If I use "Medienart" (i guess media type in English) as a criteria for an intelligent playlist, it is no longer intelligent on my ipod classics (80GB and 160GB).

  • Can we Restore a Dropped Package in oracle 10g

    Hello, I have dropped a pl/sql package accidantly.The database is Oracle 10g R2. Is there any way to recover it.? Thanx.

  • Female to femal adapter for external iSight?

    I have a 2011 mini and an external iSight connected by a 6pin - 9pin cable that I got with a hard drive. It works fine but I cannot use the apple mounts because they only work with the apple 6 pin cable. I know I can use a 6 pin to 9 pin adapter on t

  • Migrating from OLAP to relational

    Hi, I am supposed to work on an assignment that needs to migrate the data model from OLAP to relational. Generally the industry is moving the other way, i.e. from Relational to OLAP. In my current assignment I have to re-rengineer an existing reporti

  • ICM not running

    Hi, I have a problem with my WDA application / ICM. I tried to open my WDA application today but it didn't work I looked to transaction: SMICM to see if a port is correctly configured. I got the message: ICM042 - Communication error with ICM - check