Exception handler is not working

Hi fellas,
My function works fine when the entered username and password are correct. I'm trying to figure out why my exception handler is not displaying the contents of the DBMS_OUTPUT.PUT_LINE when the username or password are not correct. Any ideas?
Thanks,
Mat
VARIABLE g_output VARCHAR2(30)
VARIABLE g_username VARCHAR2(8)
VARIABLE g_password VARCHAR2(8)
VARIABLE g_ck CHAR
BEGIN
:g_username := 'gma1';
:g_password := 'gofy';
:g_ck := 'N';
END;
CREATE OR REPLACE PACKAGE login_pkg IS
FUNCTION log_in_pf
(p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_ck IN OUT CHAR)
RETURN CHAR;
END;
CREATE OR REPLACE PACKAGE BODY login_pkg IS
FUNCTION log_in_pf
(p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_ck IN OUT CHAR)
RETURN CHAR
IS
lv_username_txt bb_shopper.username %TYPE;
lv_password_txt bb_shopper.password%TYPE;
BEGIN
SELECT username, password
INTO lv_username_txt, lv_password_txt
FROM bb_shopper
WHERE username = p_username
AND password = p_password;
IF lv_username_txt||lv_password_txt = p_username||p_password THEN
p_ck := 'Y';
ELSE p_ck := 'N';
END IF;
RETURN p_ck;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('Invalid username or password');
END log_in_pf;
END;
BEGIN
:g_output := login_pkg.log_in_pf(:g_username, :g_password, :g_ck);
END;
BEGIN
ERROR at line 1:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "SCOTT.LOGIN_PKG", line 23
ORA-06512: at line 2
Edited by: Mathew2 on Jul 20, 2009 3:20 AM

Change your package defination too::
CREATE OR REPLACE PACKAGE BODY login_pkg
IS
   FUNCTION log_in_pf (
      p_username   IN       VARCHAR2,
      p_password   IN       VARCHAR2,
      p_ck         IN OUT   CHAR
      RETURN CHAR
   IS
      lv_username_txt   bb_shopper.username%TYPE;
      lv_password_txt   bb_shopper.PASSWORD%TYPE;
   BEGIN
      SELECT username, PASSWORD
        INTO lv_username_txt, lv_password_txt
        FROM bb_shopper
       WHERE username = p_username AND PASSWORD = p_password;
      IF lv_username_txt || lv_password_txt = p_username || p_password
      THEN
         p_ck := 'Y';
      ELSE
         p_ck := 'N';
      END IF;
      RETURN p_ck;
   EXCEPTION
      WHEN NO_DATA_FOUND
      THEN
         DBMS_OUTPUT.put_line ('Invalid username or password');
        return 'N' ;   --Added return statement as also mentioned in other post.
   END log_in_pf;
END;

Similar Messages

  • Exception handling is not working in GCC compile shared object

    Hello,
    I am facing very strange issue on Solaris x86_64 platform with C++ code compiled usging gcc.3.4.3.
    I have compiled shared object that load into web server process space while initialization. Whenever any exception generate in code base, it is not being caught by exception handler. Even though exception handlers are there. Same code is working fine since long time but on Solaris x86, Sparc arch, Linux platform
    With Dbx, I am getting following stack trace.
    Stack trace is
    dbx: internal error: reference through NULL pointer at line 973 in file symbol.cc
    [1] 0x11335(0x1, 0x1, 0x474e5543432b2b00, 0x59cb60, 0xfffffd7fffdff2b0, 0x11335), at 0x11335
    ---- hidden frames, use 'where -h' to see them all ----
    =>[4] __cxa_throw(obj = (nil), tinfo = (nil), dest = (nil), , line 75 in "eh_throw.cc"
    [5] OBWebGate_Authent(r = 0xfffffd7fff3fb300), line 86 in "apache.cpp"
    [6] ap_run_post_config(0x0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x444624
    [7] main(0x0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x42c39a
    I am using following link options.
    Compile option is
    /usr/sfw/bin/g++ -c -I/scratch/ashishas/view_storage/build/coreid1014/palantir/apache22/solaris-x86_64/include -m64 -fPIC -D_REENTRANT -Wall -g -o apache.o apache.cpp
    Link option is
    /usr/sfw/bin/g++ -shared -m64 -o apache.so apache.o -lsocket -lnsl -ldl -lpthread -lthread
    At line 86, we are just throwing simple exception which have catch handlers in place. Also we do have catch(...) handler as well.
    Surpursing things are..same issue didn't observe if we make it as executable.
    Issue only comes if this is shared object loaded on webserver. If this is plain shared object, opened by anyother exe, it works fine.
    Can someone help me out. This is completly blocking issue for us. Using Solaris Sun Studio compiler is no option as of now.

    shared object that load into web server process space
    ... same issue didn't observe if we make it as executable.When you "inject" your shared object into some other process a well-being of your exception handling depends on that other process.
    Mechanics of x64 stack traversing (unwind) performed when you throw the exception is quite complicated,
    particularly involving a "nearly-standartized" Unwind interface (say, Unwind_RaiseException).
    When we are talking about g++ on Solaris there are two implementations of unwind interface, one in libc and one in libgcc_s.so.
    When you g++-compile the executable you get it directly linked with libgcc_s.so and Unwind stuff resolves into libgccs.
    When g++-compiled shared object is loaded into non-g++-compiled executable's process _Unwind calls are most likely already resolved into Solaris libc.
    Thats why you might see the difference.
    Now, what exactly causes this difference can vary, I can only speculate.
    All that would not be a problem if _Unwind interface was completely standartized and properly implemented.
    However there are two issues currently:
    * gcc (libstdc++ in particular) happens to use additional non-standard _Unwind calls which are not present in Solaris libc
    naturally, implementation details of Unwind implementation in libc differs to that of libgccs, so when all the standard _Unwind
    routines are resolved into Solaris version and one non-standard _Unwind routine is resolved into gcc version you get a problem
    (most likely that is what happens with you)
    * libc Unwind sometimes is unable to decipher the code generated by gcc.
    However that is likely to happen with modern gcc (say, 4.4+) and not that likely with 3.4.3
    Btw, you can check your call frame to see where _Unwind calls come from:
    where -h -lIf you indeed stomped on "mixed _Unwind" problem then the only chance for you is to play with linker
    so it binds Unwind stuff from your library directly into libgccs.
    Not tried it myself though.
    regards,
    __Fedor.

  • Windows XP file/folder handling does not work? (RSP Rules!)

    Sorry if this has been asked many times before, but a forum search on "folder" does not return anything ??? (amazing)
    I am trying to make sense out of where and when to use folders and collections and I wish there would be more info in the help/manual.
    Lesson learned so far: you can spend an awful lot of time flagging images as rejected and then delete them from a quick collection, only to find out that they are only removed from the (logical) quick collection, not from the (physical) folder on the file system. @!x$
    Now, it seams that any folder action does either not work at all or only works partially:
    - I cannot import an empty folder, to put images in later
    - I cannot drag and drop more than one file at a time to a folder
    - When I create a new folder, I never get to see it or name it in Lightroom. It gets created on the file system however, as "new folder (x)".
    Why are there no settings under "preference" where to put libraries, back-ups of libraries, which library to use at startup, where and how to create/store previews and their lifetime and so on?
    Also, there should be a much more convenient way in the handling of multiple computers and creating/restoring backups!
    Reading some of the endless complaints about file corruptions and file losses, I think I will return to RawShooter Premium untill I finally get the feeling that my images and the work on them are safe within Lightroom. RSP is also WAY more snappy and responsive (except for the slide show)!

    Jeff: You truly offered some amazing insight here! I really thought that Adobe bought Pixmantec for their technology and for the wizzards that drove that technology. Now you made it clear that all that is limited to "inspiration". Wow! So, why DID Adobe buy Pixmantec? Market share? Take the most brilliant and cheap competitor off the market? Some other reason???
    Apart from that: I DO know that writing software is not easy. It must be really unpleasant for the hard working "scary brilliant" experts with a serious track history to hear people complain about issues like file handling on a particular operating system instead of admiring their brilliant ideas and concepts.
    Alas, this is life: if you would buy a car you would bring it back to the garage to complain about the lock in the trunk that opens at awkward times leading you to loose your groceries instead of talking to those people about how magnificent that particular car takes you trough corners at 100 mph.
    And I still believe that the RSP folks did a better job with their version 1 than Adobe did with LR, knowing that Lightroom is more complicated than RSP and taking into consideration that the Adobe people have a much longer history and experience with Photoshop/Album/Bridge. So I would say Adobe can learn a lot from the RSP boys. Just do it!
    Tim: as I'm planning to move from RSP to LR (maybe wait until 1.1), the most important starting information I'm looking for right now is how to set up my filesystem and the LR database for the most efficient way of working and for the "most" data security. Neither the LuLa tutorial nor the help file/manual seem to offer much information on this -I believe extremely important- topic.
    All this aside from what seems like Windows file handling bugs to me, hopefully adressed in version 1.1

  • Duplicate Handling in not working fot FTP and working for NFS in PI 7.31 SP06

    Hi Experts,
      To handle the duplicate files and I enabled the check box (Enable Duplicate Handling) in Sender File adapter , but this is working in case of NFS option and  it's not working for FTP protocol.
    What I observed is if the same file received second time from FTP server and File date and time is current file created date and time in FTP server.
    But in case of NFS file time is last file modified date and time.
    As per SAP help duplicate file is working based on last file modified date and time stamp - but this is not same for duplicate file in case of FTP.
    I am testing this in PI 7.31 SP06.
    Please help if you tested this option in PI 7.31 using sender FTP.
    Because our scenario we might received from sender FTP duplicate files and this I wanted fix using our standard check box option.
    Appreciate your help.
    Regards,
    Venu.

    May be have a look at the below blogs if it helps..
    http://scn.sap.com/people/sandeep.jaiswal/blog/2008/05/13/adapter-module-to-stop-processing-of-duplicate-file-ftp-location
    http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/06/05/how-to-handle-duplicate-files-sender-file-adapter-scenarios-in-process-integration

  • Exception handling branch not executing in BPM

    Hi all,
    We have a problem with exception handling in BPMs.
    We have created an exception branch in a block and a transformation step in it.  However, the branch doesn't get executed in case of exceptions.
    Any ideas?  Is this a known problem?
    Many thanks,
    Aldo

    Hi VJ,
    The exception name can only be selected from a list.  There is no chance of mistaking/misspelling in there.
    That is fine as it is.  I am quite sure about it.
    Any other ideas?
    I found SAP note 1039330 but we are already on patch 12 and that correction was released on patch 12.
    Thanks, regards,
    Aldo

  • Empty-Message Handling is not working in receievr File Adapter

    Hi All,
    I have selected "Empty-Message Handling" = 'Ignore'in Receiver File adapter, but still empty files are creating in target directory.
    Message mapping generates output based on the conditon, if the condition is 'false' mapping will generate empty file (no data is being mapped).
    Why Receiver file adapter is processing empty fiels even i set 'ignore' empty fiels in configuration (ID)?
    Hoe can i manage not to place empty fiels in target directory?
    File type is '.txt'
    Your help would be appreiciated greatly.
    Thanks,
    Rajesh

    Not sure why is it not working. Make sure the channel is activated and cache is refreshed properly. But as a workaround you may use OS script checking for size of message and deleting it or configure a BPM to avoid the file creation. Or else an adapter module as shown
    /people/gowtham.kuchipudi2/blog/2006/01/13/stop-creation-of-an-empty-file-from-file-adapter-using-module
    Regards,
    Prateek

  • PDF Preview Handler does not work

    Hello,
    We installed Outlook 2010 on a new Windows 7 32bit machine with Acrobat Reader X.
    The preview handler for PDF files does not work in Outlook 2010.  Reader works fine by itself.
    If I uninstall Reader X and install verison 9.3 then the Preview Handler works fine.  Any suggestioers?  I have run the repoair on Office and reinstalled Reader X again but to no avail.
    - Neil

    No i didnt check for office updates.. however i did locate a fix.  I am not usually keen to try random fixes so i tested it solo first to confirm it was legitimate.  worked fine.      http://www.pretentiousname.com/adobe_pdf_x64_fix/
    Thank you for attempting to help me though.
    Regards,
    Will

  • JRE7: Exception Handler no longer works

    Hello Folks,
    in a large-scale Swing App (usually started via JWS) we used to define a global event handler by setting the "sun.awt.exception.handler" environment variable. This used to work under JRE6, but it doesn't work under JRE7 anymore. What is the replacement?
    Regards from Germany,
    Thomas Nagel

    http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.UncaughtExceptionHandler.html
    ?

  • GP Exception handling doesn't work

    I had implemented the GP Exception handling scenario described in [Configuring Exception Handling|http://help.sap.com/saphelp_nw2004s/helpdata/en/44/10bd4029450d1be10000000a114a6b/frameset.htm].
    But when I start the process and input a wrong user id, the exception handling action doesn't start and the process keep in running status. When I check the Background Action Processor Queue, the queue entry of action "Retrieve User Details" retry executing continously.
    And when I check the background callable object, it report that "Obsolete process exception: E_NO_USER_FOUND  " in section Process Exceptions Check .
    Is it a system bug or Is something wrong in system configuration?
    BTW: The environment is NW7.0 SP13 Java Stack

    Reposting

  • Navigation Handler is not working in jspx page..

    Hi,
    I have written a sample application with 3 pages.
    - one.jpsx
    - two.jspx
    - error.jspx
    In one.jspx page a scriptlet is written to forward the page to error.jspx. But it is not working. Any help or suggestions would be appreciated.
    pages:
    one.jspx_
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <jsp:directive.page import="javax.faces.context.FacesContext"/>
    <jsp:scriptlet>
    FacesContext fc = FacesContext.getCurrentInstance();
         fc.getApplication().getNavigationHandler().handleNavigation(fc,"","error");
    </jsp:scriptlet>
    <f:view>
    <af:document>
    <af:form>
    <af:outputText value="This is first page"/>
    <af:commandButton text="Click on" action="two"/>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    error.jspx_
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <af:document>
    <af:form>
    <af:outputText value="This is error page.."/>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    two.jspx_
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <af:document>
    <af:form>
    <af:outputText value="This is second page"/>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    adfc-config.xml_
    <?xml version="1.0" encoding="windows-1252" ?>
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
    <view id="one">
    <page>/one.jspx</page>
    </view>
    <view id="two">
    <page>/two.jspx</page>
    </view>
    <view id="error">
    <page>/error.jspx</page>
    </view>
    <control-flow-rule>
    <from-activity-id>one</from-activity-id>
    <control-flow-case>
    <from-outcome>two</from-outcome>
    <to-activity-id>two</to-activity-id>
    </control-flow-case>
    </control-flow-rule>
    </adfc-config>
    Thanks
    Sukumar

    What's the reason you think the JSP <jsp:scriptlet> tags works in JSF?
    CM.

  • Navigation Handling does not work !!!!

    hi every body
    i have two pages Login.jsp and page1.jsp, i want to prevent direct access to page1.jsp unless the user first go to login page and redirected to page1.jsp.. so if the user paste the pathe of page1.jsp immedatily , the application will redirect him to login page.
    i used the following code in pre-render method:
    FacesContext context=FacesContext.getCurrentInstance();
    Application application=context.getApplication();
    NavigationHandler navigator=application.getNavigationHandler();
    navigator.handleNavigation(context,null, "insecure");-----
    but unfortunately it does not work ,
    can any one please help me ?
    thanks in advance
    Mohammed

    Dude,
    Why not use a filter? It will save you having to add code to every page that requires a user to be logged in.
    Try http://securityfilter.sourceforge.net/ for something comprehensive. Or if you just want something that just intercepts a request and checks if a user is logged in (e.g. if the username property in SessionBean1 is set) and redirects the user to the login page if not... it's pretty easy if you've worked with filters before.
    Try it out and ask again if you want pointers.
    Cheers,
    Dave

  • Application Exception using @Application not working

    I'm trying to create 2 business application exception using the @Application annotation on my 2 java exception class. The first exception is a StarException class that extends java.lang.Exception (per ejb 3.0 spec). Below is snippet of the class.
    @ApplicationException(rollback=true)
    public class StarException extends Exception {...}.
    As you can tell that this is a check exception and will rollback transaction when it occurred. I have another exception class called StarRuntimeException that extends java.lang.RuntimeException. This is also mention on ejb 3.0 spec and is useful if you don't want to catch the exception on the server side and just throw it and the client will receive such application exception class. Below is a snippet of the class ...
    @ApplicationException(rollback=false)
    public class StarRuntimeException extends RuntimeException {...}.
    By the way I'm using this exception in my wls 10.3 webservices stateless beans (jax-rpc 1.1). Some of the methods throws these 2 exceptions.
    There are 2 problems with this application exception during runtime on the client side.
    1. Regarding StarException, the client can catch this exception when the webservice method throws this exception. The problem is that the error messages is null. Tried both getMesssage() and getLocalizedMessage() are all null.
    2. Regarding StarRuntimeException, the generated client stubs and artifacts does not even throw this exception, therefore it will not the caught. This exception is wrapped inside RemoteException instead.
    Your help are needed. Thanks

    Ok. I figured it out. The url rewrite was missing in the config. Put it there and its working now.

  • IO or FileNotFound Exception catch does not work for getRequestDispatcher

    Hi,
    I am trying to catch IOException / FileNotFoundException in my servlet for the call to getRequestDispatcher().forward(request, response) and than throw user define exception from that catch. I am using JDeveloper 10.1.3. Some how the control is not going to catch block when the file does not exist to forward. But instead JDeveloper is throwing its own exception with error mesg
    NOTIFICATION J2EE JSP0008 Unable to dispatch JSP Page : java.io.FileNotFoundException:
    and browser shows standard 404 File Not Found error page. I would rather have want to display appropriate error page. Here is my code:
    try
    System.out.println("in try");
    context.getRequestDispatcher("/" + currentScreen).forward(request, response);
    System.out.println("after try");
    catch(java.io.IOException fileNotFoundEx)
    System.out.println("runtime exception");
    logger.error(CLASS_OBJECT, "f n f "+RootException.getStackTraceString(fileNotFoundEx));
    throw new RequestHandlerException("requestHandlerError", fileNotFoundEx);
    Here is the output on console:
    06/08/01 10:35:18 in try
    2006-08-01 10:35:18.921 NOTIFICATION J2EE JSP0008 Unable to dispatch JSP Page : java.io.FileNotFoundException: F:\JavaProjects\WorkspaceDev\CorAssessment\web\jsp\assessment_multi_view1.jsp (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileInputStream.<init>(FileInputStream.java:66)
    at oracle.jsp.provider.JspFilesystemResource.fromStream(JspFilesystemResource.java:150)
    at oracle.jsp.parse.XMLUtil.getFromStream(XMLUtil.java:228)
    at oracle.jsp.runtimev2.JspPageCompiler.compilePage(JspPageCompiler.java:341)
    at oracle.jsp.runtimev2.JspPageInfo.compileAndLoad(JspPageInfo.java:610)
    at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:634)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:370)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
    at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:270)
    at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:42)
    at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:204)
    at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
    at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:209)
    at com.nexcom.cor.manager.ViewManager.forwardToNextScreen(ViewManager.java:142)
    at com.nexcom.cor.controller.FrontController.doProcess(FrontController.java:85)
    at com.nexcom.cor.controller.FrontController.doGet(FrontController.java:59)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
    at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
    at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    at java.lang.Thread.run(Thread.java:534)
    06/08/01 10:35:18 after try
    It does not goto catch block and not printing message from System.out.

    You can map error codes to a specific jsp in your web.xml file, and add a parameter to the jsp that will display the message you intend to display back to the user.
    Example:
    <error-page>
    <error-code>404</error-code>
    <location>/index.html</location>
    </error-page>
    You can also trap specific exceptions by doing the following:
    <error-page>
    <exception-type> java.lang.Exception </exception-type>
    <location>/ErrorPage.jsp</location>
    </error-page>

  • Multiple SQL_HANDLE_DBC handles do not work on Linux

    Hello,
    I am seeing the following error from the SQL Server Driver For Linux when I attempt to execute a query on a SECOND connection within my application:
    SQLSTATE: IM001
    Native Error Code: 0
    Message: [unixODBC][Driver Manager]Driver does not support this function
    I have compiled/run the test case I have on Windows and the code executes without issue.
    Here is my test case:
    // SQLGetData.cpp
    // g++ -M64 -I$ODBC/include -L$ODBC/lib -g -lodbc sqlgetdata.cpp
    // cl sqlgetdata2.cpp odbc32.lib
    // CREATE TABLE tstDFRBLB(col1 varbinary(max))
    #if defined(_WIN32)
    #include <windows.h>
    #endif
    #include <stdlib.h>
    #include <stdio.h>
    #include <sql.h>
    #include <sqlext.h>
    void checkError ( SQLRETURN rc, const char *cstr )
    if( rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO ) {
    return ;
    } else if( rc == SQL_INVALID_HANDLE ) {
    fprintf( stderr, "Error: invalid handle: %s.\n", cstr ) ;
    } else {
    fprintf( stderr, "Unknown Error occured in %s: code %d.\n", cstr, rc ) ;
    void checkStmtError( SQLRETURN rc, SQLHSTMT stmth )
    if(rc != SQL_SUCCESS) {
    int i = 1 ;
    SQLSMALLINT length;
    SQLINTEGER sqlcode;
    SQLCHAR *sqlstate = (SQLCHAR *) malloc(100 * sizeof(SQLCHAR));
    SQLCHAR *message = (SQLCHAR *) malloc(1000 * sizeof(SQLCHAR));
    while ( SQLGetDiagRec( SQL_HANDLE_STMT, stmth, i, sqlstate, &sqlcode,
    message, 1000, &length ) == SQL_SUCCESS ) {
    printf( "\nSQLSTATE: %s\n", sqlstate ) ;
    printf( "Native Error Code: %ld\n", sqlcode ) ;
    printf( "Message: %s\n", message ) ;
    i++ ;
    delete sqlstate;
    delete message;
    int main( int ac, char **av )
    SQLHENV envh ;
    SQLHDBC dbch ;
    SQLHDBC dbch2 ;
    SQLRETURN rc ;
    SQLHSTMT stmth ;
    const char *select_stmt = "SELECT * FROM tstDFRBLB" ;
    /* Allocate a environment handl */
    rc = SQLAllocHandle( SQL_HANDLE_ENV, // Handle type
    SQL_NULL_HANDLE,
    &envh // SQLHENV handle (environment)
    checkError( rc, "SQLAllocHandle - SQL_HANDLE_ENV" ) ;
    /* Set environment attributes */
    rc = SQLSetEnvAttr( envh, // Environment handle
    SQL_ATTR_ODBC_VERSION, // Attribute to set
    (SQLPOINTER) SQL_OV_ODBC3,// New attribute
    SQL_NTS // SQL_NTS (null terminated)
    checkError( rc, "SQLSetEnvAttr" ) ;
    /* Allocate a database connection handle */
    rc = SQLAllocHandle( SQL_HANDLE_DBC, // Handle Type
    envh, // Where to attatch the new handle
    &dbch // Pointer to new handle
    checkError( rc, "SQLAllocHandle - SQL_HANDLE_DBC" ) ;
    /* Establish a connection */
    SQLCHAR outStr[1024];
    SQLSMALLINT outSize;
    rc = SQLDriverConnect(dbch, NULL,
    #if defined(_WIN32)
    (SQLCHAR*)"DSN=MSSQL_2012_NC_64;UID=*****;PWD=*****;DATABASE=qe1;", 57,
    #else
    (SQLCHAR*)"DSN=mssql-2012-md_64;UID=*****;PWD=*****;DATABASE=qe1;", 57,
    #endif
    outStr, sizeof(outStr), &outSize, SQL_DRIVER_NOPROMPT);
    /* Allocate a second database connection handle */
    rc = SQLAllocHandle( SQL_HANDLE_DBC, // Handle Type
    envh, // Where to attatch the new handle
    &dbch2 // Pointer to new handle
    checkError( rc, "SQLAllocHandle - SQL_HANDLE_DBC" ) ;
    rc = SQLSetConnectAttr(dbch2,
    SQL_ODBC_CURSORS,
    (SQLPOINTER)SQL_CUR_USE_DRIVER,
    (SQLINTEGER)NULL); // this value is ignored
    checkError( rc, "SQLSetConnectAttr - SQL_ODBC_CURSORS" ) ;
    rc = SQLDriverConnect(dbch2, NULL,
    #if defined(_WIN32)
    (SQLCHAR*)"DSN=MSSQL_2012_NC_64;UID=*****;PWD=*****;DATABASE=qe1;", 57,
    #else
    (SQLCHAR*)"DSN=mssql-2012-md_64;UID=*****;PWD=*****;DATABASE=qe1;", 57,
    #endif
    outStr, sizeof(outStr), &outSize, SQL_DRIVER_NOPROMPT);
    rc = SQLAllocHandle( SQL_HANDLE_STMT, dbch2, &stmth ) ;
    checkError( rc, "SQLAllocHandle - SQL_HANDLE_STMT" ) ;
    ** Read the value back
    rc = SQLExecDirect( stmth, (SQLCHAR*)select_stmt, SQL_NTS ) ;
    checkStmtError( rc, stmth );
    char outWData[168000];
    SQLLEN outInd = 0;
    while ( SQLFetch( stmth ) == SQL_SUCCESS )
    rc = SQLGetData( stmth, 1, SQL_C_BINARY, outWData, sizeof(outWData), &outInd );
    checkStmtError( rc, stmth );
    if(outInd == SQL_NULL_DATA) {
    printf("Data Returned: NULL\n");
    else {
    printf("Data Returned Length %d\n", outInd);
    rc = SQLMoreResults(stmth);
    checkStmtError( rc, stmth );
    /* Disconnect from the database */
    rc = SQLDisconnect( dbch2 ) ;
    checkError( rc, "SQLDisconnect" ) ;
    /* Free connection and environment handles */
    rc = SQLFreeHandle( SQL_HANDLE_DBC, dbch2 ) ;
    checkError( rc, "SQLDisconnect" ) ;
    /* Disconnect from the database */
    rc = SQLDisconnect( dbch ) ;
    checkError( rc, "SQLDisconnect" ) ;
    /* Free connection and environment handles */
    rc = SQLFreeHandle( SQL_HANDLE_DBC, dbch ) ;
    checkError( rc, "SQLDisconnect" ) ;
    SQLFreeHandle( SQL_HANDLE_ENV, envh ) ;
    checkError( rc, "SQLDisconnect" ) ;
    return EXIT_SUCCESS ;
    Thank you for any help/advice.
    Dave
    David Ritter

    Hi David,
    According to your description, the code running smoothly in windows, and getting this problem when using SQL Server driver for linux.
    So, what's the version of your SQL Server driver for linux?
    As per the error message, the function is not supported, so could you please check the configuration of the driver or there are some limitation in the driver you used?
    Please follow these links to have a check:
    The ODBC Driver 11 for SQL Server on 64-bit Red Hat Enterprise Linux 5 and 64-bit Red Hat Enterprise Linux 6.
    You can download the ODBC driver for Red Hat at
    Microsoft ODBC Driver for SQL Server.
    The ODBC Driver 11 for SQL Server on 64-bit SUSE Linux Enterprise 11 Service Pack 2. This driver is currently available as a Community Technology Preview (CTP).
    You can download the ODBC driver for SUSE Linux at
    Microsoft ODBC Driver 11 for SQL Server on SUSE Linux.
    If you have any feedback on our support, please click
    here.
    Iric Wen
    TechNet Community Support

  • How do I reduce an image size? Metrics and using the box handle do not work

                

    You have not said exactly what it is you are doing or where, but clicking on an image should produce the Edit Mask slider.
    There are 2 parts to what you see. The Mask which contains and crops the Image which is the picture itself and may extend beyond the mask or cover only part of the Mask. You can edjust both the position and scale of each independently.
    1. Sliding the scale will enlarge or reduce the image within the mask
    2. Clicking on the Edit Mask will highlight the Mask box with adjustment handles with the masked image appearing outside the mask faded back. You can pull at the Mask handles to adjust them.
    3. Clicking on the faded part of the Image lets you click inside the Image to move it relative to the mask, or on its handles to scale it
    4. Clicking inside the Mask lets you grab the Mask handles to rescale the Mask with the existing cropping
    5. If the image is inline (part of the text) you can click inside it and only the right and bottom handles are highlighted and draggable. You can again click on the Edit Mask to reposition and rescale the Image as above.
    Peter

Maybe you are looking for

  • N70 No Longer Works With PC Suite

    Hiya When I first got my N70, it worked pretty well with PC Suite buth at work and on my home PC. I then upgraded to the latest version at the time. All of a sudden it no longer works. It sometimes recognises the phone but won't go into the messages

  • Question about networking iMac and streaming video to TV

    I have the 24" iMac 2.66GHz with 4 G ram. Currently using Motorola SBG900 (Docsis 2) cable modem & router to stream Comcast through house (another PC, iPhones, LG Blu Ray player/digital video streamer). Recently acquired a Netgear Rangemax 3700 which

  • Is flash 8 pro or flash cs3 better

    I am about to buy either flash 8 or cs3 so can some one help me. Now i have used both trials and noticed flash cs3 had better grapics design but flash 8 i mainly used action script and noticed it had a bar to the side that told what each script did a

  • How do I get an app to request access to photos?

    I have a USMLE world App which requires access to my photos in order to work.  However, when I access Settings >privacy>photos, the app is not listed as requesting access.  It is also not listed as an app under "settings".

  • How to use the function module ....

    hi how to use the function module ssf_function_module_name in smartforms