MS SQL - sql type for Cursor

Hello,
Please help. I am using weblogic 8.1 and MS SQL Server 2000. Using JDBC. I have am calling a stored procedure which outputs a CURSOR. I haveing problems specifying the right java.sql.Type for this. I tried java.sql.Type.OTHER but it fails. The code is as follows
I am planning to return more cursors from the Stored Procedures.
====
Connection conn = null;
CallableStatement stmt = null;
String sqlProc = "{ call GetDocumentDetails(?,?) }";
try {
conn = this.getConnection();               
stmt = conn.prepareCall(sqlProc);
stmt.setInt(1, docId);
stmt.registerOutParameter(2,Types.OTHER);
stmt.execute();
ResultSet rs = (ResultSet) stmt.getObject(2);
while(rs.next()) {
The exception that I get is
java.sql.SQLException: [BEA][SQLServer JDBC Driver]The specified SQL type is not supported by this driver.
     at weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)
PLEASE HELP.

Hello,
Please help. I am using weblogic 8.1 and MS SQL Server 2000. Using JDBC. I have am calling a stored procedure which outputs a CURSOR. I haveing problems specifying the right java.sql.Type for this. I tried java.sql.Type.OTHER but it fails. The code is as follows
I am planning to return more cursors from the Stored Procedures.
====
Connection conn = null;
CallableStatement stmt = null;
String sqlProc = "{ call GetDocumentDetails(?,?) }";
try {
conn = this.getConnection();               
stmt = conn.prepareCall(sqlProc);
stmt.setInt(1, docId);
stmt.registerOutParameter(2,Types.OTHER);
stmt.execute();
ResultSet rs = (ResultSet) stmt.getObject(2);
while(rs.next()) {
The exception that I get is
java.sql.SQLException: [BEA][SQLServer JDBC Driver]The specified SQL type is not supported by this driver.
     at weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)
PLEASE HELP.

Similar Messages

  • Possible Bug? SQL query changing the Cursor Type from Scrollable to non Scrollable in a ResultSet

    Hi all,
    I've been beating my head against this for a few days now, and while
    there is a workaround, I haven't found out what's causing this to
    happen.
    Every other SQL query except for this one particular query works fine
    and returns a scrollable result set. That one query on the other hand,
    returns a non-scrollable result set.
    Here's the code which is calling the query:
    sqlStatement = getSQLFromFile();
    debug("SQL statment = " + sqlStatement);
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    debug(sqlStatement);
    rst = stmt.executeQuery(sqlStatement);
    debug("The type is " + rst.getType());
    rst.last();
    For most queries, the output is "The type is 1004" - which means the
    resultset is scrollable - as it should be.
    For one particular query, the output is "The type is 1003" which means
    that the result set is of type forward-only.
    Of course, calling rst.last() fails in the second case.
    If the difference between the queries was drastic, I might have
    something to go on. I've tested this out with different size queries,
    but the switch between having the type incorrectly changed is the
    deletion of a 0x0a 0x0d on the first line.
    I.E. this means the failing query reads :
    "select
    from........."
    and the query which works reads
    "select *
    from........."
    I've looked at the failing query in it's binary format, and that's the
    only difference I can discern.
    To further confuse things, there are other queries which have a
    similar format - and which work.
    I've read about a bug in Weblogic 5.1 SP9 which ignores the setting of
    the Statement to return a ResultSet with a scrollable cursor, and
    while this seems to be a bug, it doesn't seem the same bug at all -
    besides, I'm using Weblogic 6.0 with SP1 on a W2K system.
    Does anyone have any ideas as to what might be causing this? I'm
    stumped..

    Ryan D'Silva wrote:
    Hi Joe,
    I'm using the Oracle thin driver -
    oracle.jdbc.driver.OracleDriver - version #8.1.6.0.0
    and the DBMS is
    "Oracle9i Enterprise Edition Release 9.2.0.2.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.2.0 - Production"
    Does that help?Yes. Two things: TYou should probably upgrade the oracle thin
    driver, by downloading the latest appropriate one from their site,
    and make sure it's ahead of all weblogic jars in the classpath the
    server builds for itself. Also, let's see how simple we can make the
    problem. Would you please repeat the JDBC that demonstrated the problem,
    in a small standalone java program that uses a direct thin driver connection,
    getting weblogic out of the picture? (The problem does sound like
    and oracle driver issue).
    Joe
    >
    >
    Thanks,
    - ryan
    You don't say what DBMS and what JDBC driver you're using for the pool.
    That is likely to be the issue. Let me know.
    Joe
    Here's the code which is calling the query:
    sqlStatement = getSQLFromFile();
    debug("SQL statment = " + sqlStatement);
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    debug(sqlStatement);
    rst = stmt.executeQuery(sqlStatement);
    debug("The type is " + rst.getType());
    rst.last();
    For most queries, the output is "The type is 1004" - which means the
    resultset is scrollable - as it should be.
    For one particular query, the output is "The type is 1003" which means
    that the result set is of type forward-only.
    Of course, calling rst.last() fails in the second case.
    If the difference between the queries was drastic, I might have
    something to go on. I've tested this out with different size queries,
    but the switch between having the type incorrectly changed is the
    deletion of a 0x0a 0x0d on the first line.
    I.E. this means the failing query reads :
    "select
    from........."
    and the query which works reads
    "select *
    from........."
    I've looked at the failing query in it's binary format, and that's the
    only difference I can discern.
    To further confuse things, there are other queries which have a
    similar format - and which work.
    I've read about a bug in Weblogic 5.1 SP9 which ignores the setting of
    the Statement to return a ResultSet with a scrollable cursor, and
    while this seems to be a bug, it doesn't seem the same bug at all -
    besides, I'm using Weblogic 6.0 with SP1 on a W2K system.
    Does anyone have any ideas as to what might be causing this? I'm
    stumped..

  • Can you confirm for me please? - jdbc to pl/sql record types

    Hi, I was hoping somebody could confirm the following please? I've been researching this in the Oracle JDBC docs and the Internet, but would feel more comfortable if somebody would confirm my findings.
    I have a 10g database pl/sql procedure that takes a pl/sql record type as both IN and OUT parameter. I'm not allowed to modify this legacy procedure, though I may create new supporting code.
    My research shows there is no inherit support in JDBC for Oracle pl/sql record types as per the Oracle JDBC docs.
    As a solution, if the procedure only returned a record type, my understanding is I could create a ref cursor in pl/sql, as well as a wrapper procedure that calls my original procedure, and returns the record type through the ref cursor. This could then be used by my JDBC code as JDBC supports ref cursors as a return type.
    However in my case, as the record type is both an IN and OUT parameter of my procedure, my research so far says JDBC support for ref cursors does not allow the writing of value to the ref cursor to be submitted back to the database. Is this correct?
    If this limitation exists, as such the better (and only?) solution is to create a shadow pl/sql procedure that takes all the record elements as separate IN OUT parameters and then create a private record based on the record type and pass it to the original procedure.
    Is my research here correct? Any help appreciated.
    Thanks & regards,
    CM.

    Chris,
    As far as I know, PL/SQL record types are not supported in JDBC.
    I believe you may be able to use TopLink.
    I think Kuassi Mensah may have some examples in his book Oracle Database Programming.
    Alternatively, you could use an Oracle object instead of a PL/SQL record.
    This would be similar to what you are suggesting except that instead of a ref cursor, you would transfer the PL/SQL record to an Oracle object.
    Good Luck,
    Avi.

  • How to type cast PL/SQL table to REF cursor?

    any one knows how to CAST PL/SQl table to Ref cursor?
    eg
    procedure some_name(r_out out sys_refcurosr)
    IS
    type t is table of tab%ROWTYPE;
    my_type t;
    begin
    select * bulk collect into my_type from tab;
    r_out := my_type; -- need help here..
    end;
    it's 10g

    ref cursor is pointer to result set. You can not cast to PL/SQL table.
    1 create or replace procedure some_name(r_out out sys_refcursor)
    2 IS
    3 begin
    4 OPEN r_out for select * from emp;
    5* end;
    SQL> /
    Procedure created.
    SQL> var mycursor refcursor;
    SQL> exec some_name(:mycursor);
    PL/SQL procedure successfully completed.
    SQL> set linesize 2000
    SQL> print :mycursor;
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7369 SMITH CLERK 7902 12/17/80 00:00:00 800 20
    7499 ALLEN SALESMAN 7698 02/20/81 00:00:00 1600 300 30
    7521 WARD SALESMAN 7698 02/22/81 00:00:00 1250 500 30
    7566 JONES MANAGER 7839 04/02/81 00:00:00 2975 20
    7654 MARTIN SALESMAN 7698 09/28/81 00:00:00 1250 1400 30
    7698 BLAKE MANAGER 7839 05/01/81 00:00:00 2850 30
    7782 CLARK MANAGER 7839 06/09/81 00:00:00 2450 10
    7788 SCOTT ANALYST 7566 04/19/87 00:00:00 3000 20
    7839 KING PRESIDENT 11/17/81 00:00:00 5000 10
    7844 TURNER SALESMAN 7698 09/08/81 00:00:00 1500 0 30
    7876 ADAMS CLERK 7788 05/23/87 00:00:00 1100 20
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7900 JAMES CLERK 7698 12/03/81 00:00:00 950 30
    7902 FORD ANALYST 7566 12/03/81 00:00:00 3000 20
    7934 MILLER CLERK 7782 01/23/82 00:00:00 1300 10
    14 rows selected.

  • Creating tabs for a single SQL report type region

    I would like to find a way to use tabs in a single SQL report type region. The problem I have is that there are too many columns to be displayed so the report looks very cluttered. I would like to find a way to assign say columns 1 - 5 to tab 1, 6-10 to tab 2 etc so the user can find the columns they need by simply clicking on the various tabs without having to execute the query again.
    I have looked at JQuery tabs but that seems to only be applicable to more or less unrelated regions. I tried to create different regions using the same query with different columns and that kind of works, but the regions don't stay in sync if say the user change the order for column 2 in tab 1, when they click on tab 2 everything displays in a different order.
    Another wrinkle is that this is an updatable report so some of the columns are updatable.
    I also looked at the hide / display column solution which is described in a few threads and that may also sort of work, but it is also not quite what I am looking for.
    Any help is greatly appreciated

    Does anybody know if this can be accomplished using APEX? What I am really looking for is very similar to an old fashioned client / server screen developed using say Oracle Forms. Consider an order line screen where say columns line number, SKU and SKU description is to the left of the tabs so these columns are visible no matter which tab is active. Then the first tab has say pricing information including UOM, quantity, list price, unit selling price, price list. The next tab has say customer information including customer number, name, bill to and ship to addresses. the next tab has say shipping information with say the warehouse, shipping instructions and shipping method.

  • Can I change the default 'File Type' for PL/SQL Source File to '*.prc' ?

    Want to change the 'default' extension for PL/SQL source to '*.prc'
    When navigating 'File' / 'Save As', and selecting the 'File Type' list box,
    The default 'File Type' for PL/SQL Source File is '*.pls'.
    Can I change the default 'File Type' for PL/SQL Source File to '*.prc' ?
    I have followed , 'Tools', 'Preferences' , 'File Types' and added '.prc' as 'Sql Script' file type, because (PL/SQL Source) is not present in the list.

    You can certainly overwrite the 'Save As' extension as you are saving the file. I have added an ER for more control over this functionality.
    sue

  • Alternative for Cursor in SQL Server 2012

    Hi all,
      I keen to know Alternative for Cursor in SQL Server 2012. Why everyone telling Cursor have performance impact. Any other alternative for row by row comparison like Array in SQL 2012 ?
    Thanks

    It is not the cursor that kills you - it is the loop as such. I've seen more than one example of a poor man's cursor, where they have selected TOP 1 from a #temp ORDER BY, and several operations on the temp table - which is completely void of indexes,
    making the operations for the loop control the slowest in the batch. So you use cursor when you need to iterate.
    But in many cases, you should work and think set-based instead.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • T-SQL and CLR types for return value do not match

    Hi I am trying to create a CLR function to call a webservice, the CLR function return data type is double, whether I try
    to create this as a table valued funcion or a scalar to return a distance travelled value I am receiving the error below. I've tried changing data types around in the CLR side and the SQL side but keep receiving the same error message, any help would be appreciated,
    Thank you,
    [Microsoft.SqlServer.Server.SqlFunction(Name = "DistanceCalc")]
    public static Double DistanceCalc(Double SrcLat, Double SrcLong,
    Double DestLat, Double DestLong)
    MileageWS ws = new MileageWS();
    ws.Url = "http://test.isp.ca/Distance.asmx";
    int intUom = 0; // 0 = Mile, 1 = KM
    RouteType RouteMethod = RouteType.Practical;
    Requester RequestedFrom = Requester.LinkRoute;
    Double distance;
    distance = ws.GetDistanceInfoForLonLat(SrcLat, SrcLong, DestLat, DestLong, intUom, RouteMethod, RequestedFrom);
    return distance;
    CREATE FUNCTION DistanceCalc
    @SrcLat as float, @SrcLong as float,
    @DestLat as float, @DestLong as float
    RETURNS TABLE (Distance float)
    External NAME CLRfunctions.RIFunctions.DistanceCalc
    GO
    Error received when try to Create function ...
    1, Level 16, State 2, Procedure pcMiler, Line 6
    CREATE FUNCTION for "pcMiler" failed because T-SQL and CLR types for return value do not match.

    You defined at table-valued CLR function, but I think you meant to define a scalar CLR function. That might be the cause of the error.
    RETURNS TABLE (Distance float)
    should be
    RETURNS (Distance float)

  • Portal URL for file v. text v. PL/SQL item types?

    I am using Portal 10.1.2.2.0. From the Portal OWA logger data, how can I tell a file item type from a text item type from a PL/SQL item type?
    The OWA_LOGGER_DOC view iis looking for url like '%/docs/%', but all the document URLs are '%/ITEM/%'. The URLs to text items also appear to be '%/ITEM/%'.
    How can I tell that a Portal URL is pointing to a document?

    OK, I figured out a way to do this in my environment (Oracle Portal Version: 10.1.2.0.2 (Build: 150) ). Your mileage may vary.
    I created a procedure which includes the following:
        p_headingText IN VARCHAR2,
        p_fileName IN VARCHAR2,
        p_descriptionText IN VARCHAR2)
    is
        l_portalGuid VARCHAR2(50);
    begin
        select GUID into l_portalGuid from portal.wwv_things where ID = p_fileName;
        htp.p('<p class="PortletText1"><a href="http://[HOSTNAME]/pls/portal/url/item/' || l_portalGuid || '">' || p_headingText || '</a> ' || p_descriptionText || '</p>');
    end;This seems to work for me. (Sorry about the long line.) p_headingText, p_filename, and p_description are passed from the custom item type. Good luck!

  • SQL text for cursor

    Hi,
      I can see DECLARE_CUSROR < name>  in monSysSQLText but unable to see SQL Test used for declare cursor ? Is there any way to trace it ? I am using ASE 12.5.3 .
    regards
    Manoj

    I have this solved. I needed to turn the implicit cursors inside my procedure into explicit cursors:

  • Data size SQL Exception registering item types for UWL (patch 29)

    Hi,
    we have installed UWL without KM as described in note 688830. We tried this at our initial patch level with success (ep60 sp2 patch2). However now we are on patch 29 and things are not going that well. The installation works fine but when we perform the step "Register Item Types for New Systems Only" we get the following exception: "uwlExceptionID: 1107851895419 (Database):java.sql.SQLException:Data size bigger than max size for this type: 48699". We used the SDA from CM patch 29.
    Does anyone have a clue on how to solve this?
    Thanks,

    Hi Erik,
    do you have the workplace plugin WP-PI installed in your backend R/3? UWL needs this plugin to work, I think it also contains the function template which is missing.
    -Mikko

  • Java.sql.SQLException: Invalid SQL type for column

    Hi guys!
    We are migrating from TOMCAT to WebLogic and we are getting the following error:
    java.sql.SQLException: Invalid SQL type for column
         at javax.sql.rowset.RowSetMetaDataImpl.checkColType(RowSetMetaDataImpl.java:94)
         at javax.sql.rowset.RowSetMetaDataImpl.setColumnType(RowSetMetaDataImpl.java:439)
         at      .initMetaData(CachedRowSetImpl.java:743)
         at com.sun.rowset.CachedRowSetImpl.populate(CachedRowSetImpl.java:621)
    In TOMCAT environment rowset.jar is in common/endorsed directory. Need I to put rowset.jar at any specific location?
    Thanks.
    Best regards

    Hi!
    We are using WebLogic 11g (10.3.2). We know about datasource configuration, but for now we are justing migrating from Tomcat to WebLogic without change the application source code.
    Is there any option to solve this problem?
    Thanks a lot!
    Best Regards

  • Using sql type with cursor in plsql block

    I wanted to bulk collect columns in a table into a sqltype .I cannot use plsql type here since I am using it with table function in a merge statement.
    Sample code is like this
    create type t_type as object(empno number);
    create type tab_type as table of t_type;
    1 declare
    2  t1 tab_type;
    3 begin
    4  select empno bulk collect into t1 from emp;
    5 end;
    /I get an error like
    ERROR at line 4:
    ORA-06550: line 4, column 8:
    PL/SQL: ORA-00932: inconsistent datatypes: expected UDT got NUMBER
    ORA-06550: line 4, column 1:
    PL/SQL: SQL Statement ignored
    Pls suggest some alternative

    Hi,
    You cannot bulk collect into a table of objects like this.
    Are you going to use some DML operations on this SQL collections. If yes then you need SQL collections and objects. Otherwise simple PL/SQL objects and collections will do.
    Anyway, to give an alternative.
    This is one way of doing things;
    create table emp(emp_no number(10),emp_name varchar2(100));
    INSERT INTO EMP ( EMP_NO, EMP_NAME ) VALUES (
    1, 'A');
    INSERT INTO EMP ( EMP_NO, EMP_NAME ) VALUES (
    2, 'B');
    INSERT INTO EMP ( EMP_NO, EMP_NAME ) VALUES (
    3, 'C');
    commit;
    create type t_type as object(empno number(10),empname varchar2(100));
    create type n_type as table of number(10);
    create type v_type as table of varchar2(100);
    create type tab_type as table of t_type;
    declare
    t1 tab_type := tab_type();
    t2 n_type := n_type();
    t3 v_type := v_type();
    begin
    select emp_no,emp_name bulk collect into t2,t3 from emp;
    t1.extend(t2.count);
    for cnt in t2.first..t2.last
    loop
    t1(cnt):=t_type(t2(cnt),t3(cnt));
    end loop;
    for cnt in t1.first..t1.last
    loop
    dbms_output.put_line(t1(cnt).empno||'---'||t1(cnt).empname);
    end loop;
    end;
    Now if you do not require the DML operations then you can do the following;
    declare
    type n_type is table of number(10);
    type v_type is table of varchar2(100);
    type rec_type is record(empno n_type,empname v_type);
    t1 rec_type;
    begin
    select emp_no,emp_name bulk collect into t1.empno,t1.empname from emp;
    for cnt in t1.empno.first..t1.empno.last
    loop
    dbms_output.put_line(t1.empno(cnt)||'---'||t1.empname(cnt));
    end loop;
    end;
    regards,
    Dipankar.

  • ORA-06504: PL/SQL: Return types of Result Set variables or query do not mat

    Hello.
    I am trying to assign a weak type ref cursor to a strong type ref cursor. I call a procedure that executes a query using a SYS_REFCURSOR passed in as an IN OUT argument. After the procedure executes, I assign the passed in ref cursor to a strong type ref cursor in the calling procedure. I have found that if I use a static SQL statement in the procedure, the process works, but if I use a dynamic SQL statement in the procedure, I get the error message noted in the subject.
    I am running Oracle 9i on Solaris.
    Thanks for any thoughts on the matter.

    Thanks Bob,
    The Package spec part was created successfully.
    I am still confused about fetching records though.
    You said that 'Select Statement will populate the ref cursor.'
    But I do not have
    OPEN FOR
    SELECT
    INTO
    FROM
    I simply open o_cur_var
    select from several tables where........
    and then I am using FETCH statement.
    What's a better approach?
    How should I fetch values of o_cur_var?
    If I use SELECT INTO, should I use records that I declared in the package o_cur_type (..........)?

  • Invalid SQL error using REF CURSOR

    I'm getting an "invalid SQL statement" in my function that is returning a REF CURSOR. I have tested this function in SQL*Plus and it works fine.
    -- package level variable
    TYPE t_cursor IS REF CURSOR;
    Function find_patient
         p_ssan IN varchar2,
         p_patient_details OUT t_cursor
         RETURN t_cursor
         IS
         v_cursor t_cursor;
         BEGIN
         OPEN v_cursor FOR
         SELECT name,sex,pay_grade,
              FLOOR(MONTHS_BETWEEN(sysdate,birthdate) / 12) AS age,
              patient_num
         FROM patient
         WHERE ssan = p_ssan;
         p_patient_details := v_cursor;
         RETURN p_patient_details;
         END find_patient;
    -- C# code
    OracleParameter ssan_in = new OracleParameter("p_ssan",OracleDbType.Varchar2);
    OracleParameter cursor_out = new OracleParameter("p_patient_details",OracleDbType.RefCursor);
    cmd.Parameters.Add(ssan_in).Direction = ParameterDirection.Input;
    cmd.Parameters.Add(cursor_out).Direction = ParameterDirection.Output;
    ssan_in.Value = "555555555";
    OracleRefCursor cur = (OracleRefCursor) cursor_out.Value;
    try
    dbconn.Open();
                        OracleDataReader dr = cmd.ExecuteReader();
                        while (dr.Read())
                             pat_name.Text = dr["NAME"].ToString();
                             age.Text = dr["AGE"].ToString();
                             rank.Text = dr["PAY_GRADE"].ToString();
                             gender.Text = dr["SEX"].ToString();
                             pat_num.Text = dr["PATIENT_NUM"].ToString();
    Any suggestions?

    First, you have an output parameter of type ref cursor and a return value. You shouldn't have both.
    Second, try CommandType.Text and a CommandText like:
    "begin :rc := find_patient(:ssan); end;"
    It's easier to see how to bind the parameters like that. Bind first a OracleRefCursor output parameter, then an ssan%type InputParameter.
    David

Maybe you are looking for

  • Visually impaired - multi-monitor system

    Hi, I know you can have 2 monitors that are mirrored to show the same image on both displays. Is there software to have one monitor zoomed in on the cursor?

  • Heat issue with airport extreme

    The top gets hot but the sides stay only warm. The temperature on the top is around 110 F. The unit works very well and I have had no problem with it.I'm worried the high operating temperature will shorten its life.

  • Username or Password is incorrect when logging into 2008r2 standard RDS sessions host

    Hello there TechNet forums, I recently finished setting up a Windows 2008r2 RDS sessions host.  The licensing server is a Windows Server 2012 server with 5 per user 2012 RDS licenses.  The Windows 2008r2 server is pointed to the 2012 server correctly

  • Spark.core.ContentCache with AIR 3.7 on iOS not working

    I've been trying to migrate a large Flex 4.6 mobile project from AIR 3.5 to AIR 3.7 for several days with no luck. The issue that kills me is Error #3747: Multiple application domains are not supported on this operating system. This happens only on i

  • Freezing after overheat/start-up freezing... major issues

    Hi guys, Quick back-story is that my G5 runs my Pro Tools HD system. I left the control room for a while and forgot to turn the AC on. Yep, stupid. The room got very hot, but keep in mind... I have NO idea if this was part of the problem or just coin