Re: Null
Obviovusily you don't compare two string in this way! if (null == rs.getString(col_foo)) The right manner is: if (rs.getString(col_foo).equals(null)){ .. } Your problem is Java not database On 29/06/07, Propes, Barry L [EMAIL PROTECTED] wrote: are you initializing variables for each column in the DB, or likely not if you're using that array approach? -Original Message- From: PTS [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 27, 2007 9:33 PM To: Tomcat Users List Subject: Re: Null In several of the fields of the database the information is not entered until a later time and thus the field is null. If you look at actual data the value is null. When returned the data either is null or is not compatible with the data needed back. I am using the data in several areas. If I am expecting a String and it is null, then I want an empty string to be displayed. If I am expecting a number then I want a 0 if it is null. If the data returned is not of the type expected then I catch the exception and return the equivalent of no information for that data type. As for the String[], I am pulling back an entire row from the database and then picking a single element from the array. In essence it allows me to treat the result set as a two dimensional array. The concept that I was trying to convey to the OP was to do a try catch and return the desired default value of the proper type. Doug - Original Message - From: domenico di leo [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Wednesday, June 27, 2007 7:08 AM Subject: Re: Null If I have understand your problem is : you receive a lot of null value afther a query but you don't except them. The problem could be in your if statement . ((String[])queryResults.elementAt(r))[c]).equalsIgnoreCase(null)) you compare a String vector with a String because you have upacsted to String[] the return value of queryResult. I think you should do something like this: String[] queryResult = new String[10] /* Suppose that the queryResult method yelds a vector fill with 10 String queryResult = new ((String[])queryResults.elementAt(r))[c]) afther for (int i=0; i= queryResult.lenght(); i++){ if queryResult[i].equalsIgnoreCase(null)) return null; // Why do you use ? return queryResult[i]; } Cheers On 25/06/07, Propes, Barry L [EMAIL PROTECTED] wrote: yeah, this seems like a good solution, too. -Original Message- From: PTS [mailto:[EMAIL PROTECTED] Sent: Saturday, June 23, 2007 12:29 PM To: Tomcat Users List Subject: Re: Null I had to deal with a lot of null values coming back from a database. I may have been reinventing the wheel but I wrote a little DBUtil class that I used to sanitize the returned data. I wrote a get for each type of data and did a try catch. If the data came back not null I simply returned it, if it came back null it threw an exception and I returned back a default value in the catch clause. For text: /** returns the row and column equivalent from the DBResults or empty string if null or out of bounds*/ public String getDataP(int r, int c){ try{ if String[])queryResults.elementAt(r))[c]).equalsIgnoreCase(null)) return ; return(((String[])queryResults.elementAt(r))[c]); }catch(Exception e){return ;} } For numbers: /** returns the row and column equivalent from the DBResults or string 0 if null or out of bounds*/ public String getDataN(int r, int c){ try{ if String[])queryResults.elementAt(r))[c]).equalsIgnoreCase(null)) return 0; return(((String[])queryResults.elementAt(r))[c]); }catch(Exception e){return 0;} } For time: /** returns the row and column equivalent from the DBResults or string 00:00:00 if null or out of bounds*/ public String getDataT(int r, int c){ try{ if String[])queryResults.elementAt(r))[c]).equalsIgnoreCase(null)) return 00:00:00; return(((String[])queryResults.elementAt(r))[c]); }catch(Exception e){return 00:00:00;} } Doug - Original Message - From: Propes, Barry L [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Friday, June 22, 2007 1:11 PM Subject: RE: Null that doesn't sound rightare you sure you're pulling back a value from a column that's a string? -Original Message- From: Mohammed Zabin [mailto:[EMAIL PROTECTED] Sent: Thursday, June 21, 2007 6:02 AM To: Tomcat Users List Subject: Re: Null I tried it the other way, if( rs.getString(field) == null ) but the compiler plames that null can't be compared to string On 6/21/07, Tim Funk [EMAIL PROTECTED] wrote: if (null == rs.getString(col_foo)) { out.println(tdnbsp;/td); } else { // Evil since this doesn't escape the xml - for edutainment only out.println(td + rs.getString(col_foo) + /td); } -Tim Mohammed Zabin wrote: Hi All Anyone knows how to deal
Re: Null
Ok I 've understand, but what way you pick the element from String[] ? On 28/06/07, PTS [EMAIL PROTECTED] wrote: In several of the fields of the database the information is not entered until a later time and thus the field is null. If you look at actual data the value is null. When returned the data either is null or is not compatible with the data needed back. I am using the data in several areas. If I am expecting a String and it is null, then I want an empty string to be displayed. If I am expecting a number then I want a 0 if it is null. If the data returned is not of the type expected then I catch the exception and return the equivalent of no information for that data type. As for the String[], I am pulling back an entire row from the database and then picking a single element from the array. In essence it allows me to treat the result set as a two dimensional array. The concept that I was trying to convey to the OP was to do a try catch and return the desired default value of the proper type. Doug - Original Message - From: domenico di leo [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Wednesday, June 27, 2007 7:08 AM Subject: Re: Null If I have understand your problem is : you receive a lot of null value afther a query but you don't except them. The problem could be in your if statement . ((String[])queryResults.elementAt(r))[c]).equalsIgnoreCase(null)) you compare a String vector with a String because you have upacsted to String[] the return value of queryResult. I think you should do something like this: String[] queryResult = new String[10] /* Suppose that the queryResult method yelds a vector fill with 10 String queryResult = new ((String[])queryResults.elementAt(r))[c]) afther for (int i=0; i= queryResult.lenght(); i++){ if queryResult[i].equalsIgnoreCase(null)) return null; // Why do you use ? return queryResult[i]; } Cheers On 25/06/07, Propes, Barry L [EMAIL PROTECTED] wrote: yeah, this seems like a good solution, too. -Original Message- From: PTS [mailto:[EMAIL PROTECTED] Sent: Saturday, June 23, 2007 12:29 PM To: Tomcat Users List Subject: Re: Null I had to deal with a lot of null values coming back from a database. I may have been reinventing the wheel but I wrote a little DBUtil class that I used to sanitize the returned data. I wrote a get for each type of data and did a try catch. If the data came back not null I simply returned it, if it came back null it threw an exception and I returned back a default value in the catch clause. For text: /** returns the row and column equivalent from the DBResults or empty string if null or out of bounds*/ public String getDataP(int r, int c){ try{ if String[])queryResults.elementAt(r))[c]).equalsIgnoreCase(null)) return ; return(((String[])queryResults.elementAt(r))[c]); }catch(Exception e){return ;} } For numbers: /** returns the row and column equivalent from the DBResults or string 0 if null or out of bounds*/ public String getDataN(int r, int c){ try{ if String[])queryResults.elementAt(r))[c]).equalsIgnoreCase(null)) return 0; return(((String[])queryResults.elementAt(r))[c]); }catch(Exception e){return 0;} } For time: /** returns the row and column equivalent from the DBResults or string 00:00:00 if null or out of bounds*/ public String getDataT(int r, int c){ try{ if String[])queryResults.elementAt(r))[c]).equalsIgnoreCase(null)) return 00:00:00; return(((String[])queryResults.elementAt(r))[c]); }catch(Exception e){return 00:00:00;} } Doug - Original Message - From: Propes, Barry L [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Friday, June 22, 2007 1:11 PM Subject: RE: Null that doesn't sound rightare you sure you're pulling back a value from a column that's a string? -Original Message- From: Mohammed Zabin [mailto:[EMAIL PROTECTED] Sent: Thursday, June 21, 2007 6:02 AM To: Tomcat Users List Subject: Re: Null I tried it the other way, if( rs.getString(field) == null ) but the compiler plames that null can't be compared to string On 6/21/07, Tim Funk [EMAIL PROTECTED] wrote: if (null == rs.getString(col_foo)) { out.println(tdnbsp;/td); } else { // Evil since this doesn't escape the xml - for edutainment only out.println(td + rs.getString(col_foo) + /td); } -Tim Mohammed Zabin wrote: Hi All Anyone knows how to deal with null values in JDBC ResultSet?? I am trying to render a table in jsp page that read its value from the database, sometimes, the database returns null values, and so, the whole table couldn't be rendered. Is there any way to deal with null values. Thanks - To start a new topic, e-mail
Re: Null
If I have understand your problem is : you receive a lot of null value afther a query but you don't except them. The problem could be in your if statement . ((String[])queryResults.elementAt(r))[c]).equalsIgnoreCase(null)) you compare a String vector with a String because you have upacsted to String[] the return value of queryResult. I think you should do something like this: String[] queryResult = new String[10] /* Suppose that the queryResult method yelds a vector fill with 10 String queryResult = new ((String[])queryResults.elementAt(r))[c]) afther for (int i=0; i= queryResult.lenght(); i++){ if queryResult[i].equalsIgnoreCase(null)) return null; // Why do you use ? return queryResult[i]; } Cheers On 25/06/07, Propes, Barry L [EMAIL PROTECTED] wrote: yeah, this seems like a good solution, too. -Original Message- From: PTS [mailto:[EMAIL PROTECTED] Sent: Saturday, June 23, 2007 12:29 PM To: Tomcat Users List Subject: Re: Null I had to deal with a lot of null values coming back from a database. I may have been reinventing the wheel but I wrote a little DBUtil class that I used to sanitize the returned data. I wrote a get for each type of data and did a try catch. If the data came back not null I simply returned it, if it came back null it threw an exception and I returned back a default value in the catch clause. For text: /** returns the row and column equivalent from the DBResults or empty string if null or out of bounds*/ public String getDataP(int r, int c){ try{ if String[])queryResults.elementAt(r))[c]).equalsIgnoreCase(null)) return ; return(((String[])queryResults.elementAt(r))[c]); }catch(Exception e){return ;} } For numbers: /** returns the row and column equivalent from the DBResults or string 0 if null or out of bounds*/ public String getDataN(int r, int c){ try{ if String[])queryResults.elementAt(r))[c]).equalsIgnoreCase(null)) return 0; return(((String[])queryResults.elementAt(r))[c]); }catch(Exception e){return 0;} } For time: /** returns the row and column equivalent from the DBResults or string 00:00:00 if null or out of bounds*/ public String getDataT(int r, int c){ try{ if String[])queryResults.elementAt(r))[c]).equalsIgnoreCase(null)) return 00:00:00; return(((String[])queryResults.elementAt(r))[c]); }catch(Exception e){return 00:00:00;} } Doug - Original Message - From: Propes, Barry L [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Friday, June 22, 2007 1:11 PM Subject: RE: Null that doesn't sound rightare you sure you're pulling back a value from a column that's a string? -Original Message- From: Mohammed Zabin [mailto:[EMAIL PROTECTED] Sent: Thursday, June 21, 2007 6:02 AM To: Tomcat Users List Subject: Re: Null I tried it the other way, if( rs.getString(field) == null ) but the compiler plames that null can't be compared to string On 6/21/07, Tim Funk [EMAIL PROTECTED] wrote: if (null == rs.getString(col_foo)) { out.println(tdnbsp;/td); } else { // Evil since this doesn't escape the xml - for edutainment only out.println(td + rs.getString(col_foo) + /td); } -Tim Mohammed Zabin wrote: Hi All Anyone knows how to deal with null values in JDBC ResultSet?? I am trying to render a table in jsp page that read its value from the database, sometimes, the database returns null values, and so, the whole table couldn't be rendered. Is there any way to deal with null values. Thanks - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat does not start
I have the same problem, I suppose the cause is JDk 1.6 indeed I use jdk 1.5 and Tomcat play well, On 30/05/07, Dell'oro Marco [EMAIL PROTECTED] wrote: Hi there, I'm having problems running Apache Tomcat 6 (But the same happens with Tomcat 5.0) on a Windows XP home computer with Sun JRE 1.6.0_01. I've installed the same configuration on other machines with successfull results... the log message follows: [2007-05-18 00:37:09] [986 prunsrv.c] [error] Failed creating java C:\Programmi\Java\jre1.6.0_01\bin\client\jvm.dll [2007-05-18 00:37:09] [1260 prunsrv.c] [error] ServiceStart returned 1 [2007-05-18 00:37:09] [info] Run service finished. [2007-05-18 00:37:09] [info] Procrun finished. Do you guys have any idea about this? Thanks Francesco ___ L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need Help Restoring a Seesion after session time-out
I suppose you use a servlet to set the session, you can use session.setMaxInactiveInterval(time) where the variable time points out how many second you want to keep alive your session. e.g. time=60*60 =1h. However you should set a reasonable time interval, you can't keep alive your session for ever , otherwise your server could goes down On 24/05/07, Jitendra Ch [EMAIL PROTECTED] wrote: Hi to allCan One of you help me how to make a session alive, because my session is getting expired after the time mentioned in the web.xmlWith regardsJitendra Ch _ The idiot box is no longer passe! http://content.msn.co.in/Entertainment/TV/Default.aspx - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cannot Access Tomcat Server Using IP Address
When you try to acces to your web application form another PC, you need the ip address of server where your application is runnign but also the tcp port(in your case is 8080). the coorect web address is: http://ip_address:8080/login.html On 21/05/07, Teh Noranis Mohd Aris [EMAIL PROTECTED] wrote: Dear All, I've tested my applications using http://localhost:8080/login.html in the same computer and it works. However, when I tried to acces my applications using an IP Address in another computer by typing http://ipaddress/login.html, The page cannot be found is displayed. How can I access my applications using IP address? Please help me. Thank you. Greeting - Give spam the boot. Take control with tough spam protection in the all-new Yahoo! Mail Beta. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question about jar file name.
I'm not expert, but you should out your Jar file into lib directory (WEB-INF/lib) of your application. When Tomcat compiles your class automatically look into lib to find the class. Bye On 20/05/07, Rodrigo Pimenta Carvalho [EMAIL PROTECTED] wrote: Hi. I have a TomCat project and its Java source code can't compile. The problem is due to an import clause. This is trying to import Connector class. But I didn't put the respectively jar file in my classpath. What is the correct jar file (containing org.apache.catalina.connector.Connector) to solve this problem? Thanks a lot. Rodrigo Pimenta Carvalho. Brazil. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Run Xalan on Tomcat
Hi How can I run Xalan on Tomcat? I use Tomcat 5.5.23 and I'm newbie many thanks - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]