Application call to ODBC SQLSetEnvAttr function throw HY011 exception

Hi All,
      I try to use odbc driver manager in my .Net Application.first My .Net runtime is 3.5, odbc function calls(unmanaged functions are  imported to .Net application by dllimport attribute)can work well.but when .Net runtime is upgraded
to 4.0,SetEnvAttr function calls
return SQL-ERROR and I call SQLGetDiagRec function  get this error information:Operation invalid at this time.sqlstate value is HY011.
below is my code fragment:
[DllImport("odbc32.dll")]
extern static short SQLSetEnvAttr(
IntPtr envHandle,
ushort attribute,
IntPtr attrValue,
int stringLength);
[DllImport("odbc32.dll")]
extern static short SQLAllocHandle(
ushort HandleType,
int InputHandle,
out IntPtr OutputHandle);
try
rc = SQLAllocHandle(SQL_HANDLE_ENV, 0, out sql_env_handle);
if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO))
throw new Exception("SQLAllocHandle: failed to allocate SQL_HANDLE_ENV");
rc = SQLSetEnvAttr(sql_env_handle, SQL_ATTR_ODBC_VERSION, (IntPtr)SQL_OV_ODBC3, 0);
//if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO))
// throw new Exception("SQLSetEnvAttr: failed to set SQL_ATTR_ODBC_VERSION");
if((rc == SQL_SUCCESS_WITH_INFO)||(rc == SQL_ERROR))
short i=1;
short rc2;
StringBuilder sqlstate=new StringBuilder();
int NativeErrorPtr=0;
StringBuilder MessageText=new StringBuilder();
short BufferLength=256;
short TextLengthPtr=0;
while ((rc2 = SQLGetDiagRec((short)SQL_HANDLE_ENV,sql_env_handle,i,sqlstate,
ref NativeErrorPtr,MessageText,BufferLength,ref TextLengthPtr))!= SQL_NO_DATA)
i++;
my operation system is win7 64bit. Could someone help me? thanks

I already fixed this problem.
[DllImport("odbc32.dll")]
extern static short SQLAllocHandle(
long HandleType,
int InputHandle,
out IntPtr OutputHandle);
I replace ushort datatype with long datatype.So it works well

Similar Messages

  • Application calling GLX 1.3 function when not supported.

    Hey there. First off, thanks for any help you might give. I've been working at this for days and I've yet to find a solution.
    Here's the deal: I'm trying to get compiz-fusion to work on my fresh gnome desktop. I've finally managed to get 3D acceleration working on my ATI radeon 4850 HD card, by following this guide http://bbs.archlinux.org/viewtopic.php?id=79509&p=1 And by customizing a new 2.6.32 kernel, complete with KMS.
    That solved my old problem of having a white screen when trying to start compiz. Now, though, it spits out an error, stating:
    WARNING: Application calling GLX 1.3 function "glxCreatePixmap" when GLX 1.3 is not supported! This is an application bug!
    So, if anyone has any insight, I'd love your help. Thanks!

    Yes, that's the only warning. And from what I can tell, this Warning isn't known to cause failure in Compiz-Fusion as it is in my machine. But when I try to start compiz, it spits out that warning and disables metacity, but doesn't get to enabling emerald.

  • JNI Application running in ms-dos but throws an exception in applet

    Hi! I have a java application which calls a DLL using the JNI. This works perfect if I execute the java program from my command line (in ms-dos) But when I try to do it in an applet, it indeed runs and do everything ok, but at the end of the execution I get a EXECUTION_EXCEPTION.
    This is how is working:
    1.- jnidllmyclass, this is where I call the native method of my DLL
    2.- intermediate DLL which writes to files to c:\temporal and it calls several functions from other DLL
    3.- other DLL which writes more files (among other things)
    4.- applet class with a call to jnidllmyclass
    Now the DLL what does is to open a connection to a usb scanner, then send commands to it to scann somethings, save front and back images to c:\temporal (obviously, all of this is done in the user system, using certificates) and write other file and close the connection. This works! it write the images well and write everything... but after that the exception arises... I have doubt of what is it, because if it does all, what is causing the exception?
    Thanks for your help!

    Hi! Applet can access the DLL. The scanners works, but the C DLL throws an exception. Nevertheless, I've managed to see what was going on. When you click a JButton in a GUI, it enters only one to the actionlistener, but if this is done in an Applet, enters twice, so... the first time worked fine, but the second no because there was nothing to scann.
    This theme is a bit creepy, if you want help just ask! I give snippets, not just advices... I hate those people, so fell free to ask.
    Greetings!

  • How to call statement's execute function to execute procedure in Oracle?

    I made a very simple procedure in oracle logged as internal user.
    the procedure as the following:
    create or replace procedure temptest
    as
    begin
    insert into indextab(idx) values(100);
    commit;
    end temptest;
    in Java program,I use Oracle's jdbc driver to connect database, still connect as internal user.
    I can call statement.executeUpdate("insert into indextab(idx) values(100)"). and 100 row was added in database.
    then,I delete this row, try to run procedure in java,
    but the call of statement.execute("temptest") throw a exception
    the error message is:"java.sql.SQLException: ORA-00900: invalid SQL statement"
    then, I write the same procedure in sql server.
    all things work right.( I use jdbc-odbc bridge connect to sql server database)
    who can tell me what's the reason?
    I'm so urgent, please help me as soon as fast, thank you very much

    Instead of a Statement object, use a CallableStatement. CallableStatement is the JDBC wrapper for a stored proc. JDBC requires that the vendor specific call be wrapped in a {CALL ....}.
    So, your code would look like the following:
    Connection con = some connection;
    CallableStatement cs = con.prepareCall("{CALL temptest}");
    cs.execute();
    Take a look at the Javadoc. You can set both IN and OUT parameters using a CallableStatement.

  • Custom XSLT Functions Throw Exception

    Hi,
    I have following requirement-
    1. I have defined and configured some custom XSLT functions in Jdev and BPEL, which throw exception in case of an error.
    2. Now I want to catch that exception in my BPEL process
    3. In My BPEL process I have defined transformation step ( which is using those Custom XSLT functions) in a scope and added a catch branch to that
    4. But even XSLT java function throw an exception , it is not being catch by catch branch.
    Could you please help me regarding this and tell me any other way to catch an exception in BPEL process thrown by Custom XSLT function within transformation step?
    Thanks.

    Hi,
    Its the problem with the date. In the configuration file i used dateTime for java.util.Date, because of this i cant see "User Defined" option in Jdeveloper component pallete. I checked at XML data types i had seen dateTime for java.util.Date Class, but its not working.
    Do anyone created a custom xslt function which has date as parameter or return type?, If so wht they had used as data type for xml and java.
    Thanks,
    RR

  • Report Generation Toolkit producing error -2147417842, "The application called an interface that was marshalled for a different thread."

    Hi everybody,
    I've got an application that logs data to an Excel spreadsheet using the Report Generation Toolkit.  My VI's have worked fine in the past using Excel XP, but since I've upgraded to Excel 2007, I am getting COM errors like this one:
    "Error -2147417842 occurred at The application called an interface that was marshalled for a different thread. in Excel_Insert_Text.vi"  That is the exact wording, even with the weird punctuation and capitalization.
    The first occurrence of the error is not determinate.  Sometimes, up to 10 logging sessions, involving a new .xls file, can occur before this error pops up.  Once this error occurs, I must quit LabVIEW to resolve it.  If I try to do anything with Excel, I always get this error, although sometimes it comes out of different source VIs.  Excel_Open.vi is another.
    These logging VIs have worked just fine until upgrading to Excel 2007.  I checked, and I was using a really old version of the Report Generation Toolkit, v1.0.1.  I read the documentation and had a big sigh of relief when I realized I needed to upgraded to v1.1.2 to get Excel 2007 support.  However, even after upgrading, I'm still getting the same errors.  I'm using LabVIEW 8.0.1, and I'm also building these VIs into an application.   The error occurs both in the LabVIEW IDE and in the built application.  Does anybody out there have any idea what I can do to fix this?  I googled a little, and discovered this is a COM error, but I can't find any references to the Report Generation Toolkit specifically.
    Thanks,
    Phil
    Solved!
    Go to Solution.

    Hi Christian,
    I do not see that exact option listed, do you mean "user interface"?  I recognize the "Run in UI Thread" option, it's on the Call Library Function Node.
    I checked, and my top-level VI has "same as caller" set, and I believe all my VIs are set to "same as caller".  Are you suggesting I change my top-level VI preferred execution environment to "user interface", or just the logging sub-VIs that use the Report Generation Toolkit?
    Thanks,
    Phil
    Attachments:
    VI_properties.png ‏15 KB

  • Is it possible to call the Print Quote functionality from Custom ADF page

    Hi,
    We are researching if it is possible to call the Print Quote functionality from the Custom ADF application.
    Goal is to pop up the PDF report upon clicking the Print Quote button on the custom page. Is it possible ?
    Atleast advice on the direction to go forward is appreciated.
    Thanks
    Sai

    Hi ,
    Please check following thread on forum -
    Re: ADF: Calling OAF Page from ADF page
    Check this may also be useful-
    https://blogs.oracle.com/shay/entry/to_adf_or_oaf_or
    I have not tried yet but Steven Chan (Sr. Director OATG) suggest following methodolgy for this-
    https://blogs.oracle.com/stevenChan/entry/appsdatasource_jaas_ebs
    Thanks,
    Ashish

  • For each row of a table call a pl/sql function

    Hi,
    i have a search form in adf like this:
    parameter1:___
    parameter2:____
    buttonSearch
    Table with results
    field1 field2 field3
    row1 ------ --------- -------
    row2 ------ --------- -------
    row3 ------ --------- -------
    The user inputs the parameters 1 and 2 then press buttonSearch and the query execute and returns rows 1 to 3.
    What i need is for each row call pl/sql function and passed the parameter 1 and 2 and field 1 to 3 (plsql function recives 5 parameters (parameter1, parameter2, field1 , field2 and field3) )
    my buttonSearch call a java class that execute ExecuteWithParamters method.
    I create the call to my plsql function on Application module class and then export as a java interface.
    So i have the function to use in the viewcontroller layer, but i don't know where to use it, and how to pass the paramters: the parameter 1 and 2 that user inputs and the row fields.....
    any ideas....
    thanks!!

    Hi,
    for this you need to call the PLSQL function upon table rendering, which means that you need a field in the table referencing a managed bean. In the managed bean you can use #{row} and resolve it using a ValueExpression. #{row} gives you access to the current rendered row (this is why you need to do it when the table renders) and thus allows you to call getAttribute(name) to get the values of field 1 - 3. The search field value you should get through the bindings reference (assuming the search form uses ADF). Then you create an operation binding for the executeWithParameters and call operationBindingName.getParamsMap().put(argname, argvalue); on it.
    Frank
    Ps.: I am concerned about the performance you get and wonder if it isn't possible to create a transient attribute that executes the function and displays the results. As I understand, the search parameters are only to filter the result set, which you still can do

  • PDFLPrintDoc function throw exception on Mac in PDF Lib 10

    Hi,
    Currently I'm doing the work of upgrading a xcode project on Mac from PDF lib from 8.1 to 10.
    After change to use PDF lib 10 framework, and build project, I found it throw an exception when calling function PDFLPrintDoc to print PS type, error message saying An internal error occured.
    However, on Win platform, it is ok.
    I read from release note that since PDF lib 9,  
    PDFLPrintDoc() honors only default values for tilingMode (kPDNoTiling)
    In the previous code, the  flattenInfo variable in PDPrintParams is a null porinter, so I manuall add code to set PDFlattenTilingMode to be kPDNoTiling.
    But the problem is, now when running ,it still throw exception saying "An internal error occured" , nothing changed.
    Has anybody here encountered such problem?
    Please give me an answer, thanks~

    Since this is PDFL, you have a license from either Adobe or Datalogics.  Please contact their support directly.

  • Without calling stored procedure or functions from database

    Hi,
    I am using Jdeveloper 11.1.1.5.0.
    =>How to do PL/SQL procedures and functions in ADF without calling stored procedure or function from DB?

    S, PL/SQL procedures and functions are done in Application Module class or in managed bean..By calling the stored procedures or functions from DB.
    But I am asking how to do if DB doesn't have any procedures,triggers and functions.

  • How to call plsql procedure or function and getting back the string?

    Hi Everyone,
    i am using Jdev 11.1.1.5.0.
    i have a requirement to call plsql procedure or function from my backing bean java file and get back the returned value from the procedure or function.
    what piece of simple code i need to write in my backing bean?
    please suggest.
    Thanks.

    As always you write the method to call he pl/sql in the application module, expose this method to the client (so you see it in the datacontroll) then create a operation binding to the method and call this operation from the bean. The result you get by operation.getResult();
    You should never call pl/sql from the bean directly!
    The doc shows how to call the procedure from an application module: http://docs.oracle.com/cd/E21764_01/web.1111/b31974/bcadvgen.htm#sm0297
    Timo

  • Need to obtain updateable ResultSet via call to PL/SQL function

    I'm using JDBC and the Oracle JDBC driver to call a PL/SQL function that returns a SYS_REFCURSOR. I do this via a CallableStatement object and then cast the output parameter to a ResultSet object. However, I want this ResultSet object I end up with to be updateable. The following code throws an exception stating "Invalid operation for read only resultset: updateString ":
    cstmt2 = con.prepareCall("{? = call get_upload_entry_for_update(?)}",
                             ResultSet.TYPE_FORWARD_ONLY,
                             ResultSet.CONCUR_UPDATABLE);
    cstmt2.registerOutParameter(1, OracleTypes.CURSOR);
    cstmt2.setInt(2, newUploadId);
    cstmt2.execute();
    rs = (ResultSet) cstmt2.getObject(1);
    rs.next();
    rs.updateString("UPLOAD_FILENAME", fileName);
    // . . .So even though, I create the CallableStatement such that ResultSets should be updateable, it's not allowing me to do any updates. Also, in case you're wondering, inside the PL/SQL function, the query on which the cursor is based is a select statement which does specify "for update" at the end.
    I can get it to work as follows using a Statement object that executes the SELECT statement directly instead of a CallableStatement that executes a PL/SQL function:
    Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
    rs = stmt.executeQuery("select UPLOAD_FILENAME, UPLOAD_FILE from rf_upload where upload_id = "+newUploadId+" for update");
    rs.next();
    rs.updateString("UPLOAD_FILENAME", fileName);
    //. . . Although this works, the project I'm working has a goal to encapsulate all SQL into Functions and Stored Procedures so I'd like to get it working that way instead.
    So the bottom-line question is: Using the Oracle JDBC driver, how can I call a PL/SQL function in such a way that I can obtain an updateable ResultSet object?
    Thanks for any suggestions. I'd be happy to clarify anything that's unclear.

    Hmmm...
    I'm still scratching my head about this one, just not sure it's doable, but I'll point out something, maybe it will give you a clue...
    In your code, you have:
    cstmt2 = con.prepareCall("{? = call get_upload_entry_for_update(?)}",
                             ResultSet.TYPE_FORWARD_ONLY,
                             ResultSet.CONCUR_UPDATABLE);I don't think the ResultSet parameters do anything towards your goal of getting an updatable result set via the returned cursor, those parameters affect the result set produced if you were to call:
    ResultSet rs2 = cstmt2.executeQuery();and not the result set generated by:
    rs = (ResultSet) cstmt2.getObject(1);Futhermore, while the "FOR UPDATE" is almost certainly something you want to do, it also doesn't affect the cursor (I think) but merely locks the affected rows in the DB.
    You might try calling rs.getType() and rs.getConcurrency() on the ResultSet you get from getObject, though I suspect they'll merely confirm the bad news that the cursor your getting back isn't right...
    You also might try the Oracle-specific getCursor call:
    rs = ((OracleCallableStatement)cstmt2).getCursor (1)instead of getObject, though I don't think it will help...
    I've been curious enough to dig around through most of my handy references and Oracle's docs and MetaLink and come up mostly empty, although almost 5 years ago Oracle Support said:
    " Reference Cursors from a pl/sql stored procedure are not updateable in any language."

  • How to call a remote capable function module?

    Hi all,
    I want to call a bapi from a R/3 that is not available in the current system were i have my WebDynpro Abap application.
    So, i called the wizard "Service Call".
    In the Select Service step i have to input the destination and Function Module and
    Before i specified an RFC destination .
    The wizard cannot find the function.
    I read the Note:
    The function module must exist in the current system! The wizard does not support to call a remote capable function module that does not exist in the current system.
    The question is :
    How can i call remote capable function module?
    Thanks,
    Ari

    Hi,
    this link might help you : <a href="http://help.sap.com/saphelp_erp2005vp/helpdata/en/22/0424ba488911d189490000e829fbbd/frameset.htm">rfc in abap</a>
    grtz
    Koen

  • An error occurred when attempting to call the providers register function.

    Hi
    I am getting the following error while registering the Portlet to a WSRP portal.
    ]An error occurred when attempting to call the providers register function. (WWC-43134)
    An error occured during the call to the WSRP Provider: Java stack trace from root exception:
    java.rmi.ServerException: Internal Server Error (caught exception while handling request: oracle.webdb.wsrp.server.ContainerRuntimeException: An internal error has occurred in method <init>)
    at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.java:384)
    at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:245)
    at oracle.webdb.wsrp.WSRP_v1_Registration_PortType_Stub.register(WSRP_v1_Registration_PortType_Stub.java:183)
    at oracle.webdb.wsrp.client.design.v1.OraWSRP_v1_Registration_PortType.register(Unknown Source)
    . (WWC-43273)
    I have done all the required configuration which includes the following.
    1. Installation of Infrastructure.
    2. Installtion of Portal.
    3. Created OC4J_WSRP instance on Portal_Home, configured DAD which is UP.
    4. Deployed the application which URL while registering giving me the above year.
    Can anybody give me an Instant Solution.

    I am receiving the same error messages under the same conditions.
    I have not not added any .jar files to the database and do have invalid 'java class' objects in my 'user_objects' table/view.
    A 'Troubleshooting Pdk Services for Java' article (search OTN for WWC-43134) mentions
    'recompiling the invalid objects'. How does one do this?

  • LDAP call using a stored function

    I am trying to use one of our stored function with the HMTLDB database (like LDAP_GET_FIRST_NAME) within an HTMLDB application. When I issue the following command within SQLPLUS
    select cw_ldap_get_first_name('<my_ldap_name>', '<my_password>') from dual;
    my first name is displayed by SQLPLUS.
    My question is how do I get the my password with HTMLDB?
    Do I need to capture it as login time?
    Is there a global variable?
    Does anyone have any sample code that I can use that will help me run a stored function with HTMLDB and return it into an page ITEM or global ITEM?
    Thanks,
    Alan

    Chet and Scott,
    Thank you both. You both help out. It works and I am very greatful, I can not move forward.
    Scott you comments reminded me that I was want authenticating using LDAP. My HTMLDB account is the same as my LDAP but with a different password to login as a developer.
    Chet you comments helped with things that I was not aware of (like the clearing of the cache after login). So what I did was create an Afte Submit PL/SQL anonymous block in Page Processing Process section after the Get Username Cookie and before the Login. This way I was able to populate the Page 2 page ITEMS.
    The After Submit processes were section looks like this:
    10 Set Username Cookie
    15 Ldap Info
    20 Login
    30 Clear
    Thanks again ... Great Job ... Great Support
    Alan
    Posts: 108
    From: Gainesville, FL
    Registered: 1/24/02
    Re: LDAP call using a stored function
    Posted: Sep 13, 2005 4:50 PM in response to: alanhauptman Reply
    If you are using the default login page, which it looks like you are, you won't have access to those page items on page 2. There is a clear cache process that runs after login which...clears the cache on page 101. If you remove it, you should have access to those items on page 2. I would only use this for testing purposes because :P101_PASSWORD is still hanging around.
    That looks right to me. I am sure you know this, but you don't have to explicitly declare the variables (I am guessing you are at your wit's end trying to figure it out).
    Could you try a SELECT INTO from the table you are trying to get the first name from (as opposed to the function call)? That might help to narrow down the problem...
    chet
    sspadafo
    Posts: 3,490
    Registered: 1/10/01
    Re: LDAP call using a stored function
    Posted: Sep 13, 2005 5:23 PM in response to: Chet Justice Reply
    Alan - You must be using LDAP authentication in the application...
    You might look into using an LDAP utility that does an anonymous bind so that no password is required for simple lookups.
    Scott

Maybe you are looking for

  • Green & Blue pixels of death  -  Hotfix

    Occasionally my screen will boot swarming with green & blue pixel sized dots. If I take a screenshot, and look at that screenshot on another computer, they are not visible. I used to reboot until they disappeared, and then started putting the display

  • Workflow condition question

    Whenever a new opportunity is being added, If the ExternalSystemId field is blank then go ahead and fire off the workflow action. If it's NOT blank then do not fire off the workflow In the workflow condition, I have this len(Field_Value('<ExternalSys

  • BEA-149505  -The administration server was unable to establish JMX Connect.

    hello Getting the following error, trying to access the weblogic admin server ( Linux x86-64 RHL50) after a fresh install. BEA-149505 The administration server was unable to establish JMX Connectivity with the managedServer at the JMX Service URL of

  • Lost my instruments when upgraded to GB 2.0?

    I had purchased the old Garageband for iPad some time ago and I don't use it too terribly often, but somewhere between the upgrades to GB 2.0 and IOS 7, most of the instruments have been greyed out.  I know for new GB users they can get the app free

  • Lumia 925 - Advertised as 32GB Storage?

    Hello, I have reviewed the specifications of the new Lumia 925 (http://www.nokia.com/gb-en/phones/phone/lumia925/specifications/) where it states Mass Memory as 32 GB, however that appears to be extremely misleading as currently only Vodafone are off