How do I handle NULL returns from prepared statement?

Thanks in advance to all those who respond. As a beginner with Java/JSP/JDBC, I need all the help I can get!
Here's the problem...
I'm using a prepared statement in JSP to query a MySQL database.
If there is a value to return, everything works properly.
If the query returns a NULL (empty set) value, I get the following error:
javax.servlet.ServletException: Before start of result set
Here's the code (no negative comments please...I know I'm violating some conventions! I'll restructure it later. Right now I just need help with handling the NULL case):
<%
Driver DriverAppt = (Driver)Class.forName(MM_test_DRIVER).newInstance();
Connection ConnAppt = DriverManager.getConnection(MM_test_STRING,MM_test_USERNAME,MM_test_PASSWORD);PreparedStatement StatementAppt = ConnAppt.prepareStatement("SELECT lastname FROM appts_pid1 WHERE user_id = " + Recordset1__MMColParam + " AND year = " + yy + " AND month = '" + months[mm] + "' AND date = " + dates[dd] + " AND appttime = '16:15:00'");
ResultSet Appt = StatementAppt.executeQuery();
boolean Appt_isEmpty = !Appt.first();
boolean Appt_hasData = !Appt_isEmpty;
Object Appt_data;
int Appt_numRows = 0;
%>
Thanks for the help!!!

I think I have a better handle on what's occurring here. To cut to the heart of the problem, I'm going to give a very simple example that illustrates what type of error handling I need.
HERE'S THE EXAMPLE:
Let's say that I have a database of users. There are only two columns in the database: user_id and lastname. There are only 2 users, user_id "1" has lastname "Jones" and user_id "2" has lastname "Smith".
I built a very simple web interface that let's a user enter a number to see if there's a lastname associated with that record. The user has no way of knowing if the user_id exists or not, so they may or may not enter a valid number.
If the user enters a valid user_id (in this case "1" or "2"), then the correct lastname is displayed. If the user enters an invalid user_id (in this case, anything other than "1" or "2") then I get the same "Before start of result set" error that I'm getting in my real application.
So, the question is: WHERE IN THIS CODE WOULD I HANDLE THE RETURN OF AN EMPTY SET?
The goal here is to have the sentence say "The user's lastname is .", basically returning null. If there has to be a value, then have the last sentence say "The user's lastname is unknown."
If you can solve this simple example, you'll have also solved the problem with my main application!!!! :-)
Here's the example code:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="Connections/example.jsp" %>
<%
String Recordset1__MMColParam = "1";
if (request.getParameter("user_id") !=null) {Recordset1__MMColParam = (String)request.getParameter("user_id");}
%>
<%
Driver DriverRecordset1 = (Driver)Class.forName(MM_example_DRIVER).newInstance();
Connection ConnRecordset1 = DriverManager.getConnection(MM_example_STRING,MM_example_USERNAME,MM_example_PASSWORD);
PreparedStatement StatementRecordset1 = ConnRecordset1.prepareStatement("SELECT * FROM test_table WHERE user_id = " + Recordset1__MMColParam + "");
ResultSet Recordset1 = StatementRecordset1.executeQuery();
boolean Recordset1_isEmpty = !Recordset1.next();
boolean Recordset1_hasData = !Recordset1_isEmpty;
Object Recordset1_data;
int Recordset1_numRows = 0;
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="test.jsp" method="get" enctype="application/x-www-form-urlencoded" name="form1" target="_self">
<p> Submit a user id and a lastname will be displayed.</p>
<p>
<input type="text" name="user_id">
<input type="submit" name="" value="Submit">
</p>
</form>
<p>The User's lastname is <%=(((Recordset1_data = Recordset1.getObject("lastname"))==null || Recordset1.wasNull())?"":Recordset1_data)%>.</p>
</body>
</html>
<%
Recordset1.close();
StatementRecordset1.close();
ConnRecordset1.close();
%>
A huge "THANK YOU!!!!" to all those who've helped me here!!!

Similar Messages

  • JDBC Receiver : Handling NULL return from SELECT query

    Hi All,
    I have a Proxy <-> XI <-> JDBC synchronous scenario. I have designed my message mapping to perform a select query using JDBC receiver adapter. The request message mapping structure at the JDBC end is as follows.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Matmvmt_Jdbc_Request xmlns:ns0="http://esag.com/xi/bat/MatMovementRead">
       <StatementSelect>
          <Tablename action="SELECT">
             <Table>MM_DATA</Table>
             <access>
                <SEQNO/>
                <MATERIAL/>
                <UOM/>
                <SOLDQTY/>
                <SAPUPD/>
             </access>
             <key compareOperation="EQ">
                <SAPUPD>N</SAPUPD>
             </key>
          </Tablename>
       </StatementSelect>
    </ns0:MT_Matmvmt_Jdbc_Request>
    The scenario works fine when there are records matching the select condition, but when there are no records matching the select condition (i.e. if there are no record with value SAPUPD = 'N' ) then my response message is returning the empty message strucuture as given below.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Matmvmt_Jdbc_Request_response xmlns:ns0="http://esag.com/xi/bat/MatMovementRead">
       <StatementSelect_response/>
    </ns0:MT_Matmvmt_Jdbc_Request_response>
    My requirement is that if there are no records matching the select condition then my response message should look like below.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Matmvmt_Jdbc_Request_response xmlns:ns0="http://esag.com/xi/bat/MatMovementRead">
       <StatementSelect_response>
          <row>
             <SEQNO/>
             <MATERIAL/>
             <UOM/>
             <SOLDQTY/>
             <SAPUPD/>
          </row>
       </StatementSelect_response>
    </ns0:MT_Matmvmt_Jdbc_Request_response>
    Note : I have made the occurence of the request and response message elements as miniccurs = 0 and maxoccurs = 1.
    Any inputs in this regard will be highly appreciated.
    Regards,
    Sandeep

    Hi Sandeep,
    you can not expect structure like <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Matmvmt_Jdbc_Request_response xmlns:ns0="http://esag.com/xi/bat/MatMovementRead">
       <StatementSelect_response>
          <row>
             <SEQNO/>
             <MATERIAL/>
             <UOM/>
             <SOLDQTY/>
             <SAPUPD/>
          </row>
       </StatementSelect_response>
    </ns0:MT_Matmvmt_Jdbc_Request_response>
       if there is no data in table. The response which you are geting is standard format which you can not change. Instead you map this response with mapwithdefault node function while mapping to target to make the response mapping success, even though there is no data in response message.
    thanks,
    madhu

  • How to retrieve a prepared statement from prepared statement cache?

    Hi All,
    I have created the connection pool during application server startup. The connection pool are getting created successfully. I have also created the prepared statements and stored as part of each connection in the connection pool.
    can anyone please tell me on how do I retrieve a prepared statement from prepared statement cache from a connection object.
    Any pointers to info source will be REALLY appreciated.
    Many Thanks in Advance,
    C R Baradwaj

    Raghuram Bharatwaj C wrote:
    Hi Joe,
    I have created a connection poool in my startup class and created the
    neccessary prepared statements for a each connection. I have 10 prepared
    statements to be created for each connection. I have created all the 10 prepared statements using the loop as mentioned below
    String [] epc_stmts;
    private java.sql.PreparedStatement[] _pstmts;
    if (epc_stmts!= null)
                   _pstmts = new PreparedStatement [len = epc_stmts.length];
                   for (i=0; i<len; i++)
                        _pstmts[i] = db.prepareStatement (epcstmts);
    I have closed the connection after the prepared statements are created.
    Now, How do i access a prepared statement from the connection object.
    Nothing. Are you talking about a WebLogic pool? If so, then therafter,
    whenever your application gets a pool connection, when it calls
    prepareStatement() with the same SQL as you prepared those statements,
    it will get a cached statement. Your array is unnecessary.
    Joe
    >
    Many Thanks in Advance,
    C R Baradwaj

  • Ouput sql from prepared statement

    I'm using prepared statements and I want to output the sql that is being run in the statement to the console. For example:
    Class.forName("oracle.jdbc.driver.OracleDriver");
    conn = DriverManager.getConnection("jdbc:oracle:thin:@xx.xx.x.xx:xxxx:xxxx", "xxxx", "xxxx");
    stmt = conn.prepareStatement("update table set a = ? where b = ? and c = ?");
    stmt.setString(1, "a");
    stmt.setString(2, "b");
    stmt.setString(3, "c");
    System.out.println(?????????);So the statement would be something like: "update table set a = 'a' where b = 'b' and c = 'c'"
    How can I get the sql from the statement? I would have thought this would be easy but there doesn't seem to be any obvious method.

    I also came across the article about overpowering the PreparedStatement, neat stuff.
    But as I downloaded the classes and compiled them, I got some errors due to the fact that some methods from the PreparedStatement- and Statement-interfaces were not implemented by the DebuggableStatement-class.
    I suspect this has something to do with the JDK-version being used.
    I myself am using version 1.4.1_01-b01.
    Anyone came across this same problem?
    As I do want to compile under the version mentioned, I just insert the method(-stubs) myself. Or is this a bad idea?

  • How to avoid the null values from xml publisher.

    I am creating a report which have the claim numbers with the values CLA001,CLA111,null, null . when i preview my report it is showing some spaces for null values also. How can i avoid the spaces from the report.
    I am giving for loop for the claim numbers in the template.
    <?for-each:ROW?> <?sort:CLAIMNUMBER;'ascending';data-type='text'?>
    <?CLAIMNUMBER?>
    <?end for-each?>
    Please help me out to solve this problem.
    Thanks,
    vasanth.

    Hi Sheshu,
    According to your description, you are experiencing the null values and infinity values when browser the calculated measure, right?
    Based on my research, the issue is caused by that dividing a non-zero or non-null value by zero or null. In this cases, we need to check for division by zero to avoid this situation. Here is the sample query for you reference.
    IIF(
    Measures.[Measure B]=0,null,
    Measures.[Measure A] / Measures.[Measure B]
    If you have any questions, please feel free to ask.
    Regards,
    Charlie Liao
    TechNet Community Support

  • How can I delete null values from List Item?

    Hi Friends,
    I used List item for field job_Type, I entered values in List item at design time through property pallet. When I run form I will see null values in this List Item.
    How can I remove these null values from the List?
    Best regards,
    Shahzad

    Dear Shahzad,
    It can be removed by adding the following code in the When-new-Form-Instance.
    Set_item_property('List name', required, property_true);
    :block_name.list_name := <put your default value here>; (If you didn't oput the default value, then you will get some problem and the cursor may not navigate away from the list).
    Senthil Alagu .P.

  • How to remove gaps/null values from set of columns in a row

    Im trying to implement a solution for removing null value columns from a row.
    Basically in below example i have five codes and corresponding id's for that codes.What im trying to achive here is if
    i have a null code then i have to move next not null code and id into its new location.
    Example:
    'A1'cd1,'A2'cd2,null cd3,'A4'cd4,null cd5,'i1'id1,'i2'id2,null id3,'i4' id4,null id5 So here cd4 and id4 should take positions of cd3 and id3.
    Output should look like this
    cd1 cd2 cd3 cd4 cd5     id1 id2 id3 id4 id5
    A1  A2   A4              i1  i2  i4Any help would be highly appreciated for below example:
    with temp_table as
    (select 'A1'cd1,'A2'cd2,null cd3,'A4'cd4,null cd5,'i1'id1,'i2'id2,null id3,'i4' id4,null id5 from dual union all
    select 'A11',null,null,'A44','A55','id11',null,null, 'id44','id55' from dual union all
    select null,'A111',null,null,'A555',null,'id111',null, null,'id555' from dual union all
    select 'A',null,null,'A1111','E55','id11',null,null, 'id111','id1111' from dual )
    select * from temp_table;Edited by: GVR on Dec 1, 2010 8:27 AM

    I like case expression B-)
    The same question of my homepage http://www.geocities.jp/oraclesqlpuzzle/7-81.html
    with temp_table(cd1,cd2,cd3,cd4,cd5,id1,id2,id3,id4,id5) as(
    select 'A1' ,'A2' ,null,'A4'   ,null  ,'i1'  ,'i2'   ,null,'i4'   ,null     from dual union all
    select 'A11',null ,null,'A44'  ,'A55' ,'id11',null   ,null,'id44' ,'id55'   from dual union all
    select null,'A111',null,null   ,'A555',null  ,'id111',null,null   ,'id555'  from dual union all
    select 'A'  ,null ,null,'A1111','E55' ,'id11',null   ,null,'id111','id1111' from dual)
    select
    case when SumCD1 = 1 then CD1
         when SumCD1+SumCD2 = 1 then CD2
         when SumCD1+SumCD2+SumCD3 = 1 then CD3
         when SumCD1+SumCD2+SumCD3+SumCD4 = 1 then CD4
         when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 1 then CD5 end as CD1,
    case when SumCD1+SumCD2 = 2 then CD2
         when SumCD1+SumCD2+SumCD3 = 2 then CD3
         when SumCD1+SumCD2+SumCD3+SumCD4 = 2 then CD4
         when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 2 then CD5 end as CD2,
    case when SumCD1+SumCD2+SumCD3 = 3 then CD3
         when SumCD1+SumCD2+SumCD3+SumCD4 = 3 then CD4
         when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 3 then CD5 end as CD3,
    case when SumCD1+SumCD2+SumCD3+SumCD4 = 4 then CD4
         when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 4 then CD5 end as CD4,
    case when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 5 then CD5 end as CD5,
    case when SumID1 = 1 then ID1
         when SumID1+SumID2 = 1 then ID2
         when SumID1+SumID2+SumID3 = 1 then ID3
         when SumID1+SumID2+SumID3+SumID4 = 1 then ID4
         when SumID1+SumID2+SumID3+SumID4+SumID5 = 1 then ID5 end as ID1,
    case when SumID1+SumID2 = 2 then ID2
         when SumID1+SumID2+SumID3 = 2 then ID3
         when SumID1+SumID2+SumID3+SumID4 = 2 then ID4
         when SumID1+SumID2+SumID3+SumID4+SumID5 = 2 then ID5 end as ID2,
    case when SumID1+SumID2+SumID3 = 3 then ID3
         when SumID1+SumID2+SumID3+SumID4 = 3 then ID4
         when SumID1+SumID2+SumID3+SumID4+SumID5 = 3 then ID5 end as ID3,
    case when SumID1+SumID2+SumID3+SumID4 = 4 then ID4
         when SumID1+SumID2+SumID3+SumID4+SumID5 = 4 then ID5 end as ID4,
    case when SumID1+SumID2+SumID3+SumID4+SumID5 = 5 then ID5 end as ID5
    from (select cd1,cd2,cd3,cd4,cd5,id1,id2,id3,id4,id5,
          nvl2(cd1,1,0) as SumCD1,
          nvl2(cd2,1,0) as SumCD2,
          nvl2(cd3,1,0) as SumCD3,
          nvl2(cd4,1,0) as SumCD4,
          nvl2(cd5,1,0) as SumCD5,
          nvl2(id1,1,0) as SumID1,
          nvl2(id2,1,0) as SumID2,
          nvl2(id3,1,0) as SumID3,
          nvl2(id4,1,0) as SumID4,
          nvl2(id5,1,0) as SumID5
          from temp_table)
    order by cd1,cd2,cd3,cd4,cd5;
    CD1   CD2    CD3   CD4   CD5   ID1    ID2    ID3     ID4   ID5
    A     A1111  E55   null  null  id11   id111  id1111  null  null
    A1    A2     A4    null  null  i1     i2     i4      null  null
    A11   A44    A55   null  null  id11   id44   id55    null  null
    A111  A555   null  null  null  id111  id555  null    null  nullMy SQL articles of OTN-Japan
    http://www.oracle.com/technology/global/jp/pub/jp/ace/sql_image/1/otnj-sql-image1.html
    http://www.oracle.com/technology/global/jp/pub/jp/ace/sql_image/2/otnj-sql-image2.html

  • How to catch error codes returned from java

    Hi all,
    Is there anyway to capture the exit code that is returned by System.exit() from java. I know a batch file's ERRORLEVEL can do this. However, I want to use c/cpp (JNI) to get this functionality. Please help ..
    Thanks in advance,
    Soujanya.R

    how could you expect me to use JAVA command without compiling it with Javac??
    I complied the java code using javac and then called(executed ) it using the Java..
    I am using JNI_Create/JavaVM() to create a JVM from CPP file. that works fine. Now, my issue is that I want to capture a couple of exit codes that are returned from the System.exit() of the java code.
    now, guys.. is there any way to capture that exit codes returning by Ssytem.exit() in or using JNI ??
    if yes, please help me with the code snippets.
    Thanks,
    Soujanya.R

  • How to convert localization strings returned from RIDC calls?

    I'm using the RIDC API to extract some data from UCM, but I'm running into issues where some values returned from service calls are the actual localization strings ("wwDocTypeDesc_Application" for example), not their translated values.
    Is there a service or method I can use to translate the strings? Something that evaluates IdocScript perhaps?

    Hey Mike,
    Please refer the following link.
    http://www.corecontentonly.com/index.php/2008/09/16/executing-idocscript-from-java-page-merger/
    looks like customization is the way forward from here. Just create a custom service, call your default ucm service from withing and before you pass on results fetch the required variable and send back.
    I know this is something that should have been taken care be them.
    cheers,
    swapnil

  • Show query from prepared statement

    Hi all!
    Does someone knows how to get the whole generated query from a prepared statement?
    I want to know if the parameters are set correctly and therefore want to print it out to screen
    before the query is executed.
    Thanks in advance.

    You can't. At least not using standard JDBC. This is partially because the driver doesn't necessarily generate a query from the prepared statement, it can make a remote procedure call instead, for example.
    Alin.

  • Handling ' and " in a Prepared Statement

    Hi,
    I am using a prepared statement (WebLogic Portal Server having JDBC communication with MS SQL server)
    I HAVE to pass a string like '"*ABC*"'
    i.e. <single quote><double quote>*ABC<double quote><single quote>
    If i hard code this value within the prepared statement it works.
    If i try to pass it as argument it fails.
    In my case the user may submit any string value in the place of ABC
    Kindly advise
    regards
    -Ramudu

    You're probably trying to include the quotes in the prepared statement and pass the ABC as the text to substitute for the question mark. It doesn't really work like that. It's all or nothing. Create your parameter like this:
    public String quoteWrapper(final String unwrappedParameter) {
       return "'\"*"+unwrappedParameter+"*\"'";
    }

  • Escape Characters - simulate the setString from Prepared Statements

    I would like to see what the value of setString() is for a given prepared statement call.
    Because of reasons that would take me to long to explain that I cannot use preparedstatements with their parameters - I need a way to execute a query like the following:
    String query = "insert into blahtable (somestring) values (\"asdfds\'\s sdsfdasfd \"\& ...\");
    PreparedStatement stmt = connection.prepareStatement(query);
    I know prepared statements can take care of this, but I want to know and write the query as above without the need of prepared statements help for string.
    Below is an example with prepared statement - but not what I want to do
    For example:
    String oddstringwithunusalcharacters = "...";
    String query = "insert into blahtable (somestring) values (?)";
    PreparedStatement stmt = connection.prepareStatement(query);
    stmt.setString(1, oddstringwithunusalcharacters);
    I would like to see what the actual query looks like and what the actual string was passed:
    --> insert into blahtable (something) values ("asdfds\'\s sdsfdasfd \"\& .... ")
    It is not sufficient enough for me to escape quotes and apostrophes because there maybe other unusual characters that I do not know of since the string is passed by an unknown source.
    Thank you in advance

    PreparedStatements actually doesn't escape quotes. It basically precompiles statements in the DB and only passes the values to the DB.
    But if you're using a plain vanilla SQL statement where you quote the string with a single quote ' then you need to escape all occurrences of exactly the same single quote ' in the actual String value. If you for example quote the string with an apostrophe ` then you just need to escape all occurrences of exactly the same apostrophe ` in the actual String value. And so on. It is nothing more than logical, is it?

  • How does everyone handle sweep data from loops

    There's a type of test I've done a few times over the years and I'm researching what are some standard ways to handle the data in TestStand. The test type is sweeping multiple parameters in a nested loop. For example, sweep Vcc from 5.1V to 5.5V in .1V steps, at each voltage sweep Q DC Bias from 1.9 to 2.3 in steps of .2, and at each Q DC Bias sweep LO Drive Level from -5 to -20 dBm in steps of .5 dBm. For each input combination record IM3 Suppression. This example produces 310 data records.
    If I did all this inside a single code module I could pass it back to TestStand as four arrays, one for each input param and one for the data. Done. I'd still need to log it.
    What if I want to do the looping in TestStand? Here's how I could collect data.
    1. Record the three params and one data into the ResultList as single points with Numeric Limit steps and sort it out in some datalogger callback.
    2. Collect four arrays or a 2D array in Locals and then copy the arrays into the ResultList as four arrays (or 1 2D), not as scalars in #1 above. Log it in some datalogger callback.
    3. Collect four arrays or a 2D array in Locals and just use a code module in the client sequence to save the data.
    4. Any others?
    Thanks

    Hi dowNow,
    I can't immediately think of any significantly different alternatives to accomplish what you are wanting to do.  In the past, I have personally used the external code module to do the looping and measurements and then returned the data as a 2-D array.  You can then add this array to the ResultList.  This has typically given me the most efficient tests and the simplest overall setup.
    Additionally, I am not sure if you are planning to store the results in a Database, but if you are, you will need to keep in mind that logging a 2-D array to a Database works differently than a 1-D array.  I have included a link to one of our KnowledgeBase articles that details exactly how to store a 2-D array in a Database:  http://digital.ni.com/public.nsf/allkb/1307679F845B162286257160000510ED
    Thanks,
    Jonathan C
    Staff Application Engineering Specialist | CTD | CLA
    National Instruments

  • Null returned from request.getSession( true )

    It is my understanding that when you call getSession on an instance of
              HttpServletRequest with a parameter of true, it should return the existing
              session (if there is one) or a new session. It should never return null.
              Unfortunately, that is exactly what we are seeing. Has anybody else had a
              similar problem? We've seen it three times at this point. It only seems to
              happen after stress or extended usage of the WebLogic server (several days).
              After null is returned, it is always returned until you restart the server.
              We are running WebLogic 4.5.1 (service pack 2) with clustering and in-memory
              replication of session data. We use jview (Microsoft's VM) on Windows NT
              Server 4.0 (service pack 6).
              Thanks,
              Walter Bodwell
              Evity, Inc.
              

    Copied from the API:
              getSession
              public HttpSession getSession(boolean create)
              Returns the current HttpSession associated with this request or, if
              necessary, creates a new session for the request. Use true for create to
              create a new session, or false to return the current HttpSession.
              If create is false and the request has no valid HttpSession, this method
              returns null.
              To make sure the session is properly maintained, you must call this method
              at least once before you write any output to the response. Newly created
              sessions (that is, sessions for which HttpSession.isNew returns true) do not
              have any application-specific state.
              Parameters:
              true - to create a new session for this request; false to return the current
              session
              Returns:
              the HttpSession associated with this request or null if create is false and
              the request has no valid session
              getSession
              public HttpSession getSession()
              Returns the current session associated with this request, or if the request
              does not have a session, creates one.
              Returns:
              the HttpSession associated with this request
              Hope that helps,
              -Andrew
              Walter Bodwell <[email protected]> wrote in message
              news:[email protected]...
              > The spec itself is not very clearly written, but seems to imply that
              > getSession( true ) only creates a session if there is not one already
              > associated with the request:
              >
              > getSession
              >
              > Returns the current valid session associated with this request. If this
              > method is called with no arguments, a session will be created for the
              > request if there is not already a session associated with the request. If
              > this method is called with a boolean argument, then the session will be
              > created only if the argument is true.
              >
              > The API documentation is much more clear (the important words being if
              > necessary):
              >
              > public abstract HttpSession getSession(boolean create)
              >
              > Gets the current valid session associated with this request, if create is
              > false or, if necessary, creates a new session for the request, if create
              is
              > true.
              >
              > Walter
              >
              > Andrew Robinson <[email protected]> wrote in message
              > news:[email protected]...
              > > In 2.1 getSession(true) ALWAYS creates a new session, getSession(false)
              > > returns the current session (or null).
              > > With getSession(), it returns the existing session, or creates a new one
              > if
              > > there is not one. Check out the API, very important difference.
              > >
              > > -Andrew
              > >
              > >
              > > Walter Bodwell <[email protected]> wrote in message
              > > news:[email protected]...
              > > > Doesn't getSession() just call getSession( true )? The descriptions
              for
              > > the
              > > > two sound identical.
              > > >
              > > > Thanks,
              > > > Walter
              > > >
              > > > Andrew Robinson <[email protected]> wrote in message
              > > > news:[email protected]...
              > > > > Try using getSession(), no arguments, it is in the 2.1 servlet spec
              > > > >
              > > > > Walter Bodwell <[email protected]> wrote in message
              > > > > news:[email protected]...
              > > > > > It is my understanding that when you call getSession on an
              instance
              > of
              > > > > > HttpServletRequest with a parameter of true, it should return the
              > > > existing
              > > > > > session (if there is one) or a new session. It should never
              return
              > > > null.
              > > > > > Unfortunately, that is exactly what we are seeing. Has anybody
              else
              > > had
              > > > a
              > > > > > similar problem? We've seen it three times at this point. It
              only
              > > > seems
              > > > > to
              > > > > > happen after stress or extended usage of the WebLogic server
              > (several
              > > > > days).
              > > > > > After null is returned, it is always returned until you restart
              the
              > > > > server.
              > > > > >
              > > > > > We are running WebLogic 4.5.1 (service pack 2) with clustering and
              > > > > in-memory
              > > > > > replication of session data. We use jview (Microsoft's VM) on
              > Windows
              > > > NT
              > > > > > Server 4.0 (service pack 6).
              > > > > >
              > > > > > Thanks,
              > > > > > Walter Bodwell
              > > > > > Evity, Inc.
              > > > > >
              > > > > >
              > > > >
              > > > >
              > > >
              > > >
              > >
              > >
              >
              >
              

  • How to eliminate NULL values from case statement?

    I have the following query where I am trying to eliminate the NULL record.  How can I do this?  My query:
    select
    AttendedSchoolLast3Months = case
    when d.scrnval_id = 'AA5639E4-E60C-473F-9B72-354472C11F5B' and d.picklist_value = 'BC349A1E-65A1-4497-A38A-116C83B2028F' then 2 --No
    when d.scrnval_id = 'AA5639E4-E60C-473F-9B72-354472C11F5B' and d.picklist_value = 'A529C643-60A7-4D79-AC67-1A8F70791934' then 1 --Yes
    end
    From [evolv_cs].[dbo].[test_header] [test_header_rv] WITH (NOLOCK)
    CROSS APPLY [dbo].[fn_getTestSetupFormDetails](null, [test_header_rv].[test_setup_header_id]) AS [test_header]
    CROSS APPLY [dbo].[fn_getTestSetupFormDetails]([test_header].[test_setup_details_id], null) AS [test_details]
    JOIN [evolv_reports].[dbo].[test_details_answers_expanded_view] d WITH (NOLOCK) ON
    [test_header_rv].[test_header_id] = d.[test_header_id]
    AND [test_details].[test_setup_details_id] = d.[test_setup_details_id]
    join [user_defined_lut_rv] udl1 with(nolock) on udl1.[user_defined_lut_id] = d.picklist_value
    join people_rv p (nolock) on d.people_id = p.people_id
    where d.actual_date between '9/1/13' and '9/30/13'
    and d.people_id = '7A9ACEE4-ABD5-4905-A54E-659A81048A1A'
    And the result currently is:
    AttendedSchoolLast3Months
    1
    NULL
    When I ran this query:
    select distinct --attendedschoollast3months
    d.*
    From [evolv_cs].[dbo].[test_header] [test_header_rv] WITH (NOLOCK)
    CROSS APPLY [dbo].[fn_getTestSetupFormDetails](null, [test_header_rv].[test_setup_header_id]) AS [test_header]
    CROSS APPLY [dbo].[fn_getTestSetupFormDetails]([test_header].[test_setup_details_id], null) AS [test_details]
    JOIN [evolv_reports].[dbo].[test_details_answers_expanded_view] d WITH (NOLOCK) ON
    [test_header_rv].[test_header_id] = d.[test_header_id]
    AND [test_details].[test_setup_details_id] = d.[test_setup_details_id]
    join [user_defined_lut_rv] udl1 with(nolock) on udl1.[user_defined_lut_id] = d.picklist_value
    --join [education_level] e (nolock) on e.[EducationLevel] = udl1.[description]
    join people_rv p (nolock) on d.people_id = p.people_id
    where d.actual_date between '9/1/13' and '9/30/13'
    and d.people_id = '7A9ACEE4-ABD5-4905-A54E-659A81048A1A'
    I get this:
    event_log_id people_id group_profile_id actual_date test_header_id test_setup_details_id test_domains_info_id question_caption question_code test_details_answers_id update_log_id test_details_id numeric_value scrnval_id picklist_value remarks narrative test_setup_details_answers_id is_checked date_value details_type_code test_setup_answers_caption test_setup_answers_order test_setup_answers_value output_code answers_category_id answers_category answers_category_code
    24E8F88F-9648-4714-9394-D5A3F642C0F0 7A9ACEE4-ABD5-4905-A54E-659A81048A1A NULL 2013-09-26 17:00:00.000 24E8F88F-9648-4714-9394-D5A3F642C0F0 67CDCF44-6308-4E15-8543-3C85DE4C6D4D NULL Attended school in the last 3 months NULL 1BB75044-A65C-4464-ADB9-0CA991019907 7CDD1A4F-41F4-403C-A85E-7FF51B761FF0 3F04BBFF-8DE9-4283-842F-E53A536E3E46 NULL AA5639E4-E60C-473F-9B72-354472C11F5B A529C643-60A7-4D79-AC67-1A8F70791934 NULL NULL 5979600C-B4E6-42DF-BF45-8AFF15ACDD7D 0 NULL PICKLIST Click here for list 1 NULL NULL NULL NULL NULL
    24E8F88F-9648-4714-9394-D5A3F642C0F0 7A9ACEE4-ABD5-4905-A54E-659A81048A1A NULL 2013-09-26 17:00:00.000 24E8F88F-9648-4714-9394-D5A3F642C0F0 EBDFBCA5-6E57-4907-9DEF-A1E118F3AB2D NULL Highest grade completed NULL 8F7F4644-4E67-4821-B0FC-A192389F994D 7CDD1A4F-41F4-403C-A85E-7FF51B761FF0 F6C59E67-EC74-4F0C-8EE8-AB372F22255D NULL 4536DD06-871D-4FA7-BA8A-552DB2CA59BC D77F0CAB-505E-4838-AECE-01BAAE8B8EB2 NULL NULL E7C9ECB7-7B40-4115-A6DB-BC752116D68D 0 NULL PICKLIST Click here for list 1 NULL NULL NULL NULL NULL
    Ryan D

    Hi, 
    what I understood from above is that u want to filter NULL records and want to display only not null records. Try below query.
    SELECT * FROM(select
    AttendedSchoolLast3Months = case
    when d.scrnval_id = 'AA5639E4-E60C-473F-9B72-354472C11F5B' and d.picklist_value = 'BC349A1E-65A1-4497-A38A-116C83B2028F' then 2 --No
    when d.scrnval_id = 'AA5639E4-E60C-473F-9B72-354472C11F5B' and d.picklist_value = 'A529C643-60A7-4D79-AC67-1A8F70791934' then 1 --Yes
    end
    From [evolv_cs].[dbo].[test_header] [test_header_rv] WITH (NOLOCK)
    CROSS APPLY [dbo].[fn_getTestSetupFormDetails](null, [test_header_rv].[test_setup_header_id]) AS [test_header]
    CROSS APPLY [dbo].[fn_getTestSetupFormDetails]([test_header].[test_setup_details_id], null) AS [test_details]
    JOIN [evolv_reports].[dbo].[test_details_answers_expanded_view] d WITH (NOLOCK) ON
    [test_header_rv].[test_header_id] = d.[test_header_id]
    AND [test_details].[test_setup_details_id] = d.[test_setup_details_id]
    join [user_defined_lut_rv] udl1 with(nolock) on udl1.[user_defined_lut_id] = d.picklist_value
    join people_rv p (nolock) on d.people_id = p.people_id
    where d.actual_date between '9/1/13' and '9/30/13'
    and d.people_id = '7A9ACEE4-ABD5-4905-A54E-659A81048A1A' ) AWHERE AttendedSchoolLast3Months IS NOT NULLTry this query.
    Thanks Shiven:) If Answer is Helpful, Please Vote

Maybe you are looking for

  • Materials Return to Vendor

    Hi All, How do I return Non valuated materials to a Vendor? (Without reference to a Purchase Order) Which movement type do I use and what transaction do i use? Thanks Adeel

  • Billing Cycle & Payments due by Dates

    I don't understand why the billing cycle ends after the bill/payment is due! For instance if I have to pay by the 30th of the month then why does my billing cycle end a week after I paid you? By the we are going over our already allowed plan of 40GB

  • MDM cleansing Issue

    Hi, I have implemented MDM scenario. I face a problem while doing cleansing. I'm getting the following error. INFO: MDM-MI-CFG008: All configuration files loaded. Jul 8, 2008 8:14:23 PM com.sun.mdm.standardizer.compat.StandardizationEngineWrap per <i

  • How do you promote a static route over a directly connected?

    Hi all, I have a need for a static route to be used instead of a directly connected route. (Long story - involving firewalls and anti-spoofing.. but can go further if required) I am using a Cisco 3750 switch. I notice directly connected routes have a

  • ITunes hangs when trying to restore

    I've got a 30GB video iPod that is formatted for Windows and half of the tracks on my iPod simply don't show up in the iPod interface. So I went to restore it on my Mac (10.4.10 PPC) using iTunes 7.4.2(4) and when I click restore it unpacks the firmw