Empty Strings - Help!!

I'm a new JSP developer, but this issue seems like it should be an easy one to solve. I just can't do it!!
I'm executing a query against a table that allows nulls in most columns. I'm doing a select against all rows, and putting the data into Strings. I need to test certain strings, to see if they are empty, so I can continue with my logic.
But, I can't seem to get it to work...I keep getting the generic WebSpherer Error 500 with no useful info in the log.
Here's what I'm using:
String valueText = "";
valueText = CustomBean.getColumnValue("valueText");
if (valueText.equals("null")||valueText.equals("")){
out.println("its empty!!");
}else{
out.println("its not");
This works if i query against a non existent recordID, but a real record with no value for valueText results in an error every time.
Please help me!

Try:
String valueText = "";
valueText = CustomBean.getColumnValue("valueText");
if (valueText==null || valueText.equals("")){
   out.println("its empty!!");
}else{
   out.println("its not");
}If valueText is null you need to use the == operator not the equals method because that will give you a NullPointerException.

Similar Messages

  • BaseFileName cannot be nothing or an empty String during Test Connection

    Dear All,
    I have FDM+Foundation+HSF 11.1.2 installed
    I have stacked with the following problem:
    when I try to Test Connection (Authentication Provider Window) during Load Balance Configuration I am getting
    +“BaseFileName cannot be nothing or an empty String+
    Parameter name: value”
    Can somebody help me with it?
    Best Regards,
    Siarhei

    same error i faced, i restarted the APP server and it worked then.

  • What happens when a OUT parameter of a web-service returns an empty string

    Hi,
    Any idea on how to deal with the situation when a web-service returns an empty string
    I get the following System Exception:-
    Caused by: java.lang.AssertionError: Attempt to set empty javaType to ticketResponse(out,0) :: fuego.type.FuegoClass$LazyRef@6770f2. It must be null or a valid java type.
    It therefore either expects a null value or a valid java type...
    Since it goes into a system exception, the activity is not completed and nothing is inserted into the web-service..
    How do we resolve this error inside of BPM?

    Thanks Ben for your replies.
    Before I attempt changing a VI that was written by a client and make a total mess of it, there's something I'd like to point out.
    I tried the re-entrant VI approach and that didn't go any further than the VIT approach, and probably for the same reason(s).
    The interesting part is that (with the VIT approach) the same VIT is called by another process and it works fine.  It is just for the process that has it appear within 2 sub-panels.  So the issue is related to having either having two instances spawn at once of the same VIT or it is related to the sub-panels.  I think it is the two instances (or copies of the VIT) that causes LV to caugh...
    So you are trying to tell me that the above description is accurate and it is because of the private methods...??...
    How would I "wrap" those private methods into public ones?  The seems to be a piece of this puzzle that I am not yet grasping..
    Thanks for your patience and help.
    RayR

  • SQLLDR - how to set a default value for an empty string

    I'm using SQLLDR to load data from a flat file on Oracle 10g 10.2.0.4 EE, Linux RHEL 4 update 6. Seems like my question is simple, but darned if I can't find the solution.
    My source file (comma delimited extracted form a different RDBMS) has some (not all) rows where the output for a string is "", and not NULL. How do I check for empty string and add a default value in the control file? The target column is non-nullable
    Here's my current control file - however, the column attributeName where sometimes the source record is "" does not get evaluated as NULL.
    load data
    infile 'mydata.del'
    badfile 'mydata.bad'
    discardfile 'mydata.dsc'
    into table mydata
    fields terminated by "," optionally enclosed by '"'
       TRAILING NULLCOLS           
    (l_metadata,
    company,
    className,
    attributeName "decode(:vc_attributeName,null, 'none')",
    attributeDefault)
    {code}
    When I tried decode with "", I received the following error:
    {code}SQL*Loader-350: Syntax error at line 11.
    Expecting "," or ")", found ", 'none')".
    attributeName "decode(:vc_attributeName,"", 'none')", {code}
    This does not work either:
    {code}
    load data
    infile 'mydata.del'
    badfile 'mydata.bad'
    discardfile 'mydata.dsc'
    into table mydata
    fields terminated by "," optionally enclosed by '"'
       TRAILING NULLCOLS           
    (l_metadata,
    company,
    className,
    attributeName NULLIF attributeName = BLANKS ,"decode(:vc_attributeName,null, 'none')",
    attributeDefault) I get the following in the log:
    Table COMPANYMETADATA, loaded from every logical record.
    Insert option in effect for this table: INSERT
    TRAILING NULLCOLS option in effect
       Column Name                  Position   Len  Term Encl Datatype
    L_METADATA                          FIRST     *   ,  O(") CHARACTER
    COMPANY                            NEXT     *   ,  O(") CHARACTER
    CLASSNAME                         NEXT     *   ,  O(") CHARACTER
    ATTRIBUTENAME                     NEXT     *   ,  O(") CHARACTER
        NULL if ATTRIBUTENAME = BLANKS
        SQL string for column : "decode(:attributeName,null, 'none')"
    ATTRIBUTEDEFAULT                  NEXT     *   ,  O(") CHARACTER
    Record 1: Rejected - Error on table COMPANYMETADATA, column ATTRIBUTENAME.
    ORA-01400: cannot insert NULL into ("SRV5"."COMPANYMETADATA"."ATTRIBUTENAME")
    {code}
    Any help is appreciated -
    Edited by: kpw on Feb 9, 2009 11:10 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hello,
    I just loaded following data successfully in my_data table using the same control file I posted. Yes it will evaluate "" as null and replace with none, remember in control file you have this option, "optionally enclosed by '"'.
    #my_data.dat
    "myname1", "attribname1"
    "myname2", "attribname2"
    "myname3", "attribname3"
    "myname4", ""
    #my_data.ctl
    load data
    into table my_data
    fields terminated by "," optionally enclosed by '"'
    TRAILING NULLCOLS           
    my_name char(30),
    vc_attributeName "decode(:vc_attributeName,null, 'none', :vc_attributeName)"
    {code}
    Here is the output log file
    {code}
    Control File:   my_data.ctl
    Data File:      mydata.dat
      Bad File:     mydata.bad
      Discard File:  none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array:     64 rows, maximum of 256000 bytes
    Continuation:    none specified
    Path used:      Conventional
    Table MY_DATA, loaded from every logical record.
    Insert option in effect for this table: INSERT
    TRAILING NULLCOLS option in effect
       Column Name                  Position   Len  Term Encl Datatype
    MY_NAME                             FIRST    30   ,  O(") CHARACTER           
    VC_ATTRIBUTENAME                     NEXT     *   ,  O(") CHARACTER           
        SQL string for column : "decode(:vc_attributeName,null, 'none', :vc_attributeName)"
    Table MY_DATA:
      4 Rows successfully loaded.
      0 Rows not loaded due to data errors.
      0 Rows not loaded because all WHEN clauses were failed.
      0 Rows not loaded because all fields were null.
    Space allocated for bind array:                  18560 bytes(64 rows)
    Read   buffer bytes: 1048576
    Total logical records skipped:          0
    Total logical records read:             4
    Total logical records rejected:         0
    Total logical records discarded:        0
    Run began on Mon Feb 09 18:17:35 2009
    Run ended on Mon Feb 09 18:17:36 2009
    Elapsed time was:     00:00:00.98
    CPU time was:         00:00:00.10
    {code}
    Hope this helps clearing your dobuts
    Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Dealing with an empty string parameter

    I'd think this should be simple but is driving me nuts. I have a string parameter (lets call it Foo) that is being passed from my C# application to a CR subreport. For this parameter field I have a formula associated with "Display String" similar to this:
    if (IsNull({?Foo}) or (length({?Foo}) = 0)) then
        "Value is empty"
    else
        "Value is " + {?Foo}
    I can never get the "Value is empty" line to appear! I've tried lots of suggestions:
    1. trim and check result equal to '' (two single quotes)
    2. test if equal to "".
    3. Adding false to Suppress.
    It appears that if this parameter is the empty string CR simply does nothing with my formulas and the entire parameter field is skipped.
    If I pass "null" (or any other special string) instead of "" from my C# code and then change the above test to check for that value as shown below things work properly.
            if (IsNull({?Foo}) or ({?Foo} = "null") then
    However I really don't like testing for a special string as there is the remote possibility that it could be the actual value of the parameter.
    Any help most appreciated.
    Dick

    Not surprised and willing to bet there will be a simple answer to this!
    There is something most odd happening when the string value is empty.
    Let me answer your questions.
    1 - How are you setting your parameter value?
    Since I want to be able to pass parameters to the base report as well as its subreports I'm using this method:
            protected void setParameter(string parameterName, object value)
                ParameterFields fields = report.ParameterFields;
                for (int i = 0; i < fields.Count; i++)
                    if (fields<i>.Name.Equals(parameterName))
                        string reportName = fields<i>.ReportName;
                        if (string.IsNullOrEmpty(reportName))
                        {   // give to base report
                            report.SetParameterValue(parameterName, value);
                        else
                        {   // give to subreport
                            report.SetParameterValue(parameterName, value, reportName);
    2 - What OS and service pack are you on?
    Windows XP, SP 3. All updates from MS installed.
    My development environment is either of these two:
    a. VS 2008. Version 9.0.30729.1 SP. ,NET Framework 3.5 SP1
    b. VS 2010 Version 4.0.30319
    3 - What platform are you targeting?
    For now just running on my XP PC but have tested our app on XP, Win7, and Vista. 32 and 64-bit version of each.
    4 - Is this a win or web form application? Win app
    5 - What is the version of your CrystalDecisions.CrystalReports.Engine?
    Version: 12.2.0.290, Product Type: Full
    6 - What is the version of crpe32.dll do you have on your machine?
    I only have one instance of this file in this directory:
         C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86
    7 - Did you have one of our betas on this machine? No
    Edited by: dcowan on Dec 7, 2010 2:10 AM
    I needed to finish this so I'm closing it.
    In my C# code I placed the following:
                        if (string.IsNullOrEmpty(value))
                            value = "!_Empty_!";
    and in the CR formula I used:
           (IsNull({?CoBrandName}) or ({?CoBrandName} = "!_Empty_!"))
    Everything is now working just as I want. Not an ideal solution but I gave up.

  • JDBC Receiver does not convert empty string to NULL

    Hello experts,
    I am facing a problem with an INSERT statement to ORACLE DB where some of the fields are empty, for example:
    - <STATEMENT_VLP_CONT_DETAILS>
    - <TABLE_VLP_CONT_DETAILS ACTION="INSERT">
      <TABLE>VLP_CONT_DETAILS</TABLE>
    - <ACCESS>
      <VLP_HDR_ID>43</VLP_HDR_ID>
      <VLP_CONT_LINE_ID>1</VLP_CONT_LINE_ID>
      <QUANTITY>1</QUANTITY>
      <OWNER>CBHU</OWNER>
      <SERIAL_NO>3372739</SERIAL_NO>
      <CONT_ISO_CODE>2300</CONT_ISO_CODE>
      <WEIGHT>6.44</WEIGHT>
      <POL>ILASH</POL>
      <POD>FRFOS</POD>
      <FD>FRFOS</FD>
      <OPER_CODE>COS</OPER_CODE>
      <CUR_STOW_LOC>150102</CUR_STOW_LOC>
      <PRV_STOW_LOC />
      <HAZARDOUS>N</HAZARDOUS>
    In the JDBC Receiver comm channel I selected: Interpretation of Empty String Values = NULL Value.
    It seems the empty strings are not converted to NULL values as can be seen in the reflected SQL statement in RWB:
    INSERT INTO  VLP_CONT_DETAILS (VLP_HDR_ID, VLP_CONT_LINE_ID, QUANTITY, OWNER, SERIAL_NO, CONT_ISO_CODE, WEIGHT, POL, POD, FD, OPER_CODE, CUR_STOW_LOC, PRV_STOW_LOC, HAZARDOUS, EMPTY, REFER, OOG, HAZARD_IMDG, TEMP_SET, TEMP_MIN, TEMP_MAX, FRONT_OVL, REAR_OVL, RIGHT_OVW, LEFT_OVW, OVERHEIGHT, COMMODITY, BOOKING_REF, ALLOTMENT, YARD_LOC, LD_SEQ_CRANEID, LD_SEQ_NUMBER, LD_STATUS, STACKABLE, OPT_PORT_CODE1, OPT_PORT_CODE2, OPT_PORT_CODE3) VALUES (44, 1, 1, CBHU, 3372739 , 2300,  6.44, ILASH, FRFOS, FRFOS, COS,   150102,         , N, N, N, N,      ,      ,      ,      ,    ,    ,    ,    ,    ,     ,             ,    ,           ,    ,    0,    64, N,      ,      ,      )
    So, I am getting the following error:
    Could not execute statement for table/stored proc. "VLP_CONT_DETAILS" (structure "STATEMENT_VLP_CONT_DETAILS") due to java.sql.SQLException: ORA-00936: missing expression
    Help would be appreciated.

    Hi Effi,
    There is a mismatch in the field and thier value.
    Here field id 37
    VLP_HDR_ID, VLP_CONT_LINE_ID, QUANTITY, OWNER, SERIAL_NO, CONT_ISO_CODE, WEIGHT, POL, POD, FD, OPER_CODE, CUR_STOW_LOC, PRV_STOW_LOC, HAZARDOUS, EMPTY, REFER, OOG, HAZARD_IMDG, TEMP_SET, TEMP_MIN, TEMP_MAX, FRONT_OVL, REAR_OVL, RIGHT_OVW, LEFT_OVW, OVERHEIGHT, COMMODITY, BOOKING_REF, ALLOTMENT, YARD_LOC, LD_SEQ_CRANEID, LD_SEQ_NUMBER, LD_STATUS, STACKABLE, OPT_PORT_CODE1, OPT_PORT_CODE2, OPT_PORT_CODE3
    And value is 35
    44, 1, 1, CBHU, 3372739 , 2300, 6.44, ILASH, FRFOS, FRFOS, COS, 150102, , N, N, N, N, , , , , , , , , , , , , , , 0, 64, N, , ,
    Give empty values for nuil fields so that they can be made NULL by jdbc adapter
    Regards
    Suraj

  • Cannot assign an empty string to host variable 1

    Guys,
    I am getting the following problem while trying to create an entity bean., cmp field is not blank string yet I am getting the error. can you please help out?
    _33##0#0#Info##Plain###Remote Exception in Create: CreateA2iLogin: com.sap.engine.services.ejb.exceptions.BaseRemoteException: Exception in method a2i.beans.login.LoginHomeImpl0.create(java.lang.String).
         at a2i.beans.login.LoginHomeImpl0.create(LoginHomeImpl0.java:408)
         at a2i.beans.login.LoginHome_Stub.create(LoginHome_Stub.java:56)
         at com.nibco.a2i.beans.A2iLogin.createA2iLogin(A2iLogin.java:118)
         at com.nibco.a2i.beans.A2iLogin.<init>(A2iLogin.java:38)
         at com.nibco.training.servlet.SayHelloServlet.doPost(SayHelloServlet.java:121)
         at com.nibco.training.servlet.SayHelloServlet.doGet(SayHelloServlet.java:32)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
    Caused by: com.sap.engine.services.ejb.entity.ContainerException: Exception in method ejbStore().
         at com.sap.engine.services.ejb.entity.ContextFP.store(ContextFP.java:118)
         at com.sap.engine.services.ejb.entity.ContextFP.store0(ContextFP.java:103)
         at com.sap.engine.services.ejb.entity.Context.passivate(Context.java:235)
         at a2i.beans.login.LoginHomeImpl0.create(LoginHomeImpl0.java:401)
         ... 21 more
    Caused by: com.sap.engine.services.ejb.exceptions.BaseEJBException: SQLException while the data is being flushed. The persistent object is a2i.beans.login.LoginBean0Persistent.
         at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:101)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flushAll(TransactionContext.java:429)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flush(TransactionContext.java:378)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.finishWork(TransactionContext.java:454)
         at a2i.beans.login.LoginBean0PM.ejbStore(LoginBean0PM.java:184)
         at com.sap.engine.services.ejb.entity.ContextFP.store(ContextFP.java:115)
         ... 24 more
    Caused by: com.sap.sql.log.OpenSQLException: Cannot assign an empty string to host variable 1.
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:85)
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:124)
         at com.sap.sql.jdbc.common.CommonPreparedStatement.setString(CommonPreparedStatement.java:584)
         at com.sap.engine.services.dbpool.wrappers.PreparedStatementWrapper.setString(PreparedStatementWrapper.java:341)
         at a2i.beans.login.LoginBean0Persistent.ejb_iInsert(LoginBean0Persistent.java:335)
         at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:92)
         ... 29 more
    ; nested exception is:
         com.sap.engine.services.ejb.entity.ContainerException: Exception in method ejbStore().#
    #1.5#001143A7AF4000680000005900000F4C00040C3E95D97A60#1139362848402#System.out#sap.com/A2IEARCURR#System.out#Guest#0####edec5450984311da917b001143a7af40#SAPEngine_Application_Thread[impl:3]_33##0#0#Info##Plain###Success 2#

    Guys,
    I am getting the following problem while trying to create an entity bean., cmp field is not blank string yet I am getting the error. can you please help out?
    _33##0#0#Info##Plain###Remote Exception in Create: CreateA2iLogin: com.sap.engine.services.ejb.exceptions.BaseRemoteException: Exception in method a2i.beans.login.LoginHomeImpl0.create(java.lang.String).
         at a2i.beans.login.LoginHomeImpl0.create(LoginHomeImpl0.java:408)
         at a2i.beans.login.LoginHome_Stub.create(LoginHome_Stub.java:56)
         at com.nibco.a2i.beans.A2iLogin.createA2iLogin(A2iLogin.java:118)
         at com.nibco.a2i.beans.A2iLogin.<init>(A2iLogin.java:38)
         at com.nibco.training.servlet.SayHelloServlet.doPost(SayHelloServlet.java:121)
         at com.nibco.training.servlet.SayHelloServlet.doGet(SayHelloServlet.java:32)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
    Caused by: com.sap.engine.services.ejb.entity.ContainerException: Exception in method ejbStore().
         at com.sap.engine.services.ejb.entity.ContextFP.store(ContextFP.java:118)
         at com.sap.engine.services.ejb.entity.ContextFP.store0(ContextFP.java:103)
         at com.sap.engine.services.ejb.entity.Context.passivate(Context.java:235)
         at a2i.beans.login.LoginHomeImpl0.create(LoginHomeImpl0.java:401)
         ... 21 more
    Caused by: com.sap.engine.services.ejb.exceptions.BaseEJBException: SQLException while the data is being flushed. The persistent object is a2i.beans.login.LoginBean0Persistent.
         at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:101)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flushAll(TransactionContext.java:429)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.flush(TransactionContext.java:378)
         at com.sap.engine.services.ejb.entity.pm.TransactionContext.finishWork(TransactionContext.java:454)
         at a2i.beans.login.LoginBean0PM.ejbStore(LoginBean0PM.java:184)
         at com.sap.engine.services.ejb.entity.ContextFP.store(ContextFP.java:115)
         ... 24 more
    Caused by: com.sap.sql.log.OpenSQLException: Cannot assign an empty string to host variable 1.
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:85)
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:124)
         at com.sap.sql.jdbc.common.CommonPreparedStatement.setString(CommonPreparedStatement.java:584)
         at com.sap.engine.services.dbpool.wrappers.PreparedStatementWrapper.setString(PreparedStatementWrapper.java:341)
         at a2i.beans.login.LoginBean0Persistent.ejb_iInsert(LoginBean0Persistent.java:335)
         at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:92)
         ... 29 more
    ; nested exception is:
         com.sap.engine.services.ejb.entity.ContainerException: Exception in method ejbStore().#
    #1.5#001143A7AF4000680000005900000F4C00040C3E95D97A60#1139362848402#System.out#sap.com/A2IEARCURR#System.out#Guest#0####edec5450984311da917b001143a7af40#SAPEngine_Application_Thread[impl:3]_33##0#0#Info##Plain###Success 2#

  • Oracle and empty strings

    Hi All,
    i'm porting my application to Oracle and i'm experiencing (big) issues since empty strings are treated as null by Oracle.
    This is a big issue for me since my application uses empty and null values as two different things (indeed they are different !!), ie, i'm not having null pointer exception, but wrong behavior.
    I'm thinking what's the best approach to follow since my appl. must work also on mysql and postgres.
    Three options at the moment:
    1. implement a jdbc wrapper that converts any empty string in something like '~'.
    2. using aspectj, add some aspects to setString/getString converting any empty string in something like '~'.
    3. buy a commercial driver that makes difference between empty and null (using aforementioned approaches ?).
    I think that this difference in Oracle is really an impediment in doing applications db neutral and I'd like to ask your opinion about the best solution (if someone already resolved it as i guess).
    Does anyone know if there are commercial jdbc driver that can help me ?
    Does anyone know how ORM frameworks (like hibernate) handle this case ?
    Thanks in advance
    ste

    jschell wrote:
    nichele wrote:
    jwenting wrote:
    If NULL really is different in your context from an empty string you're going to have to define some sequence of characters as indicating an empty string.yes, this is what i need to implement.Sounds like a flawed design then.
    I'm wondering what's the best approach in order to avoid to change all my application isolating this behavior somewhere (wrapping the jdbc driver for instance).That doesn't make much sense to me. You should already have a database layer. You change the database layer. If you don't have a database layer then that means you have another design flaw. And in that case I would really not be the one that needs to maintain that code base.I thought a bit about the value of your answer...but i didn't find it ....sorry but i don't like who replies on forum just to say bad design/bad choice etc...if you have any kind of suggestion you are welcome, otherwise you can spend your time in doing something else instead of reply to this thread.

  • The parameter 'token' cannot be a null or empty string sharepoint

    Hello ,
    I am trying to create SharePoint 2013 web app for office 365 using visual studio 2012. when i debug and run the SharePoint custom web app then it show the error ("the parameter 'token' cannot be a null or empty string") in the
    TokenHelper.cs file.
    Please help me on urgent basis.
    Mail me at : [email protected]
    Here is the screenshot in the TokenHelper.cs file.
            public static SharePointContextToken ReadAndValidateContextToken(string contextTokenString, string appHostName = null)
                JsonWebSecurityTokenHandler tokenHandler = CreateJsonWebSecurityTokenHandler();
                SecurityToken securityToken = tokenHandler.ReadToken(contextTokenString);
    In this section i get that error.
                JsonWebSecurityToken jsonToken = securityToken as JsonWebSecurityToken;

    you can go to <yoursiteurl>/_layouts/appregnew.aspx to create a new AppPrincipal, generating a client ID and client secret.  Once generated, copy the client ID from that page into your app manifest and web.config.
    http://msdn.microsoft.com/en-us/library/office/jj687469.aspx
    Check the below two links
    http://blogs.msdn.com/b/kaevans/archive/2013/04/05/inside-sharepoint-2013-oauth-context-tokens.aspx
    http://msdn.microsoft.com/en-us/library/fp179932.aspx
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • SQL query for empty string

    I am trying to execute the following SQl query, SELECT * FROM Failure WHERE ID = '123' AND RepairAction = ' ';, using the DB Tools Execute Query.vi. This query never finds the record in my database. My database contains a record where the ID filed contains the value of '123' and the RepairAction field is an empty string. If I remove the 'AND RepairAction ' ';' text from my query statement, the record is found. I believe my problem is that I am not using the correct syntax to describe and empty string. I have tried the following: '', ' ', "", " ", and NULL as empty string arguments, and none of these work.
    I was hoping someone might be able to tell me what the correct syntax is for an empty string or if there is another approach I need to take.
    Thank you in advance for your help,
    Jim
    Solved!
    Go to Solution.

    Hi,
    While creating your table "Failure", was the column "ID" delclared as intiger or varchar? If it is intiger and you use '123' , it wont return the results. You will have to try without the inverted comas ' '.
    Regards,
    Nitzz
    (Giver Kudos to good Answers, Mark it as a solution if your problem is Solved)

  • Null/Empty Strings use in ESB Database Adapter

    Hi
    I'm trying to use a database adapter to execute an update on a table with a composite primary key; one of the primary key columns sometimes contains an empty string, however whenever I try to call the adapter, it always converts this to a null value. Is there an easy way to force the adapter to use an empty string instead of a null?
    Thanks.

    the idea here is to execute the dbms statement, or the setpolicycontext statement in a db session, and being able to execute the next sql statement in the same db session.
    This is possible with consecutive database adapters sharing the same db session.
    and two db adapters sharing the same db session is possible, if you make sure that the bpel is participating in the db transaction which can be made possible via xa db connections.
    Hope this helps,
    Write back in case you need more info.

  • SharePoint 2013 - The parameter 'token' cannot be a null or empty string

    Hi all,
    I am trying to create SharePoint 2013 web app for office 365 using visual studio 2012. when I run the SharePoint web
    app then it show the error "the parameter 'token'
    cannot be a null or empty string" in the TokenHelper.cs file.
    this is the url i'm using: 
    $(function () {
    $('#exportToExcelBtn').click(function () {
    window.location = "https://xx.sharepoint.com/ENPages/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List={803B55DA-B973-4EF4-92ED-F61DFD016D7C}&View={A6282A16-299E-407D-A25A-14E05AB23AE7}&CacheControl=1";
    is it good?
    I checked that key "clientID" and "cleantSecret" contains values.
    what else can it be?

    in order to authenticate the app standard token should be submitted along with the url 
    check the below url
    http://msdn.microsoft.com/en-us/library/office/jj163816(v=office.15).aspx
    This combines five other tokens. It initially resolves to SPHostUrl={HostUrl}&SPAppWebUrl={AppWebUrl}&SPLanguage={Language}&SPClientTag={ClientTag}&SPProductNumber={ProductNumber}.
    Then each of these tokens resolves. If there is no app web, the portion &SPAppWebUrl={AppWebUrl} is
    not present.
    Hope that helps|Amr Fouad|MCTS,MCPD sharePoint 2010

  • Plsql - store function - passing a NULL or empty string argument

    Please see the question I posed below. Does anyone have experience with passing a NULL or empty string to a store function? THANKS.
    Hi All,
    I have a function that takes in two string arrays, status_array, and gender_array. You can see the partial code below. Somehow if the value for the string array is null, the code doesn't execute properly. It should return all employees, but instead it returns nothing. Any thoughts? THANKS.
    for iii in 1 .. status_array.count loop
    v_a_list := v_a_list || '''' || status_array(iii) || ''',';
    end loop;
    v_a_list := substr(v_a_list, 1, length(trim(v_a_list)) - 1);
    for iii in 1 .. gender_array.count loop
    v_b_list := v_b_list || '''' || gender_array(iii) || ''',';
    end loop;
    v_b_list := substr(v_b_list, 1, length(trim(v_b_list)) - 1);
    IF v_a_list IS NOT NULL and v_b_list IS NOT NULL THEN
    v_sql_stmt := 'select distinct full_name from t_employee where status in (' || v_a_list || ') and gender in (' || v_b_list || ')';
    ELSIF v_a_list IS NOT NULL and v_b_list IS NULL THEN
    v_sql_stmt := 'select distinct full_name from t_employee where status in (' || v_a_list || ') ';
    ELSIF v_a_list IS NULL and v_b_list is not null THEN
    v_sql_stmt := 'select distinct full_name from t_employee where gender in (' || v_b_list || ')';
    ELSE
    v_sql_stmt := 'select distinct full_name from t_employee';
    END IF;
    OPEN v_fullname_list FOR v_sql_stmt;
    RETURN v_fullname_list;

    Not sure what version of Oracle you are using, so here's an approach that will work with many releases.
    Create a custom SQL type, so we can use an array in SQL statements (we'll do that at the end).
    create or replace type string_list is table of varchar2(100);
    /declare your A and B lists as the type we've just created
    v_a_list    string_list default string_list();
    v_b_list    string_list default string_list();populate the nested tables with non-null values
    for iii in 1 .. status_array.count
    loop
       if status_array(iii) is not null
       then
          v_a_list.extend;
          v_a_list(v_a_list.count) := status_array(iii);
       end if;
    end loop;Here you'd want to do the same for B list.
    Then finally, return the result. Using ONE single SQL statement will help a lot if this routine is called frequently, the way you had it before would require excessive parsing, which is quite expensive in an OLTP environment. Not to mention the possibility of SQL injection. Please, please, please do some reading about BIND variables and SQL injection, they are very key concepts to understand and make use of, here's an article on the topic.
    [http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1922946900346978163]
    So here we ask for the distinct list of full names where either the status and the gender qualify based on the input data, OR the array passed in had no data to restrict the query on (the array.count = 0 does this).
    OPEN v_fullname_list FOR
       select
          distinct
             full_name
       from t_employee
       where
          status in (select /*+ CARDINALITY ( A 5 ) */ column_value from table(v_a_list) A )
          or v_a_list.count = 0
       and
          gender in (select /*+ CARDINALITY ( B 5 ) */ column_value from table(v_b_list) B )
          or v_b_list.count = 0
       );Hope that helps.
    Forgot to mention the CARDINALITY hint i added in. Oracle will have no idea how many rows these arrays (which we will treat as tables) will have, so this hint tells Oracle that you expect X (5 in this case) rows. Adjust it as you need, or remove it. If you are passing in thousands of possible values, where i've assumed you will pass in only a few, you may want to reconsider using the array approach and go for a global temporary table.
    Edited by: Tubby on Dec 11, 2009 11:45 AM
    Edited by: Tubby on Dec 11, 2009 11:48 AM
    Added link about using Bind Variables.

  • PreparedStatement space and empty String

    Hi, I have this problem:
    PreparedStatement bookedQtyPS = null;
    String qry="SELECT * from djwsearch where djwitem=?;
    bookedQtyPS = conn.prepareStatement(qry);
    if(item.equals(""){ //item is an empty String
    bookedQtyPS.setString(1," "); // I set space instead of empty String
    }else{
    bookedQtyPS.setString(1,item);
    My problem is that I need to set space insteadOf empty String, but I think that I can not use PreparedStatement to do this. I have performance problems (my query is much more complicated than this one) so I choose PreparedStatement and not Statement.
    How can I do? Is this bug solved using PreparedStatement?
    Thanks.

    you can do it with the help of PreparedStatement.
    Here the type of field(djwitem) and setmethod is should be match..i mean if the type of ur field is String then you need to use the setSting method.
    you can do one thing specify one string variable.
    String space=" ";
    and now put this sapce variable at the second parameter of setString method.

  • How to solve the error { java.lang.NumberFormatException: empty String }

    Sir,
    I am using the following code and get subjected error.
    {error}{
    java.lang.NumberFormatException: empty String
         at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1011)
         at java.lang.Double.parseDouble(Double.java:540)
         at invoice.InvoiceController$4.changed(InvoiceController.java:192)
    }{error}
    and
    //wt ,  sValExlSt1 and sPrice1 are numbers
    wt1.textProperty().addListener(new ChangeListener<String>() {
                    public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
                        sValExlSt1.setText(String.valueOf(
                                Double.parseDouble(newValue)  * Double.parseDouble(sPrice1.getText())));
            } catch (NumberFormatException e1) {
    }Please help.

    One way is to check each input variable for valid numbers and if a blank or a text is detected, then make that variable zero.
    wt1.textProperty().addListener(new ChangeListener<String>() {
                    public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
                        final double doubleTXTValue = 0.0;
                        final double doubleNewValue = 0.0;
                        try {doubleTXTValue = Double.parseDouble(sPrice1.getText());} catch(Exception e) {}
                        try {doubleNewValue = Double.parseDouble(newValue);} catch(Exception e) {}
                        sValExlSt1.setText(String.valueOf(
                                doubleNewValue  * doubleTXTValue));
                });The above code will make sure the user does not enter invalid double values of any type.
    You can take this further by inserting the old value of the variables or presenting an error to the user.
    If only blank values need to be checked then you can use a more simplistic check by just checking for blanks.
    wt1.textProperty().addListener(new ChangeListener<String>() {
                    public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
                        final double doubleTXTValue = 0.0;
                        final double doubleNewValue = 0.0;
                        if (sPrice1.getText().trim().length() > 0) doubleTXTValue = Double.parseDouble(sPrice1.getText());
                        if (newValue.trim().length() > 0) doubleNewValue = Double.parseDouble(newValue);
                        sValExlSt1.setText(String.valueOf(
                                doubleNewValue  * doubleTXTValue));
                });

Maybe you are looking for

  • Strange bug on skype (is this a sign that the pers...

    Hello I have the latest 5.9 version on my Iphone 5s and I couldn't help but notice a strange bug. When I turn on Skype, at first everyone is offline (just loading I guess), then I see some green lights appear at the bottom of the profile pictures of

  • Method not found :set_ToggleSidePanel(SidePanelKind) error

    I developed an wpf application in vs2010. I am generating the reports using crystal report wpf viewer. Its working fine on the system it is developed but on target machine its giving following error: method not found: void SAPBusinessObjects.WPF.View

  • Editing book in Lr on two different computers

    Hello, I produced a book using Lr's book module on my laptop.  I would like to do some further edits to it using Lr on my desktop.  I have the book saved on an external hard drive which I thought would make the transfer easy.  However, upon connectin

  • Wrong catch block is reach

    Hi, I encounter a strange behaviour in exception handling. My web app can generate pdf files, and download them. If client closes its browser window, a ClientAbortException is thrown (which is expected behaviour, I guess.) However, I can't catch it c

  • Printing problems in Lion - Broken pipe

    I am having problems with printing from Lion, particularly to some HP printers in my office network.  I have tried removing and then adding the printers, have tried printing with JetDirect, as an IP, and just letting Lion decide.  The jobs seem to be