Solved

what will rs.getBoolean() return if the field is null OR varchar 'FALSE'?

Posted on 2006-06-27
10
1,189 Views
Last Modified: 2008-02-26
hi, as per title.
1. what will rs.getBoolean() return if the field is null?

2. if the field is varchar, and the value is 'FALSE' (for every row), if i read the value using rs.getBoolean, will i get the boolean value of 'false'?

tks
0
Comment
Question by:InNoCenT_Ch1ld
  • 4
  • 4
  • 2
10 Comments
 
LVL 16

Accepted Solution

by:
suprapto45 earned 250 total points
ID: 16997797
1. It should be false.
2. If it is 'FALSE' it will return false, but if it is 'TRUE', it will return true.

David
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 16997802
1. false, use wasNull() to check if null

2. i don't think so
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 16997805
I think for the second point, there is a rule where we can determine whether it is true or false. Let me check for a sec

David
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 92

Expert Comment

by:objects
ID: 16997809
suck it and see :)
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 16997816
Sorry for the spam.

This is just based on my experiences and may not be right.

If your VARCHAR column is started with 'T' or even a single 'T', it should return true

but if it is started with other characters than 'T', it should return false.

Just my experiences ;)

David
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 16997920
let me run some experiment for point#2 first...
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 16998049
here's my result:

field(varchar)           getBoolean()
----------------------------------------------
'FALSE'                    false
'TRUE'                     true
'FISH'
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 16998061
ignore my previous comment ;-)

test:
-MS SQL SERVER 2000


here's my result:

field(varchar)           getBoolean()
----------------------------------------------
'FALSE'                    false
'TRUE'                     true
'FISH'                      false
'TANK'                     false
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 16998070
additional:

'T'       --> false
'F'       --> false

guess it only recognize 'TRUE' for ms sql server.. or maybe it depends on the jdbc...
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 16998076
>>"'TANK'                     false"
Ok, my theory is wrong :(.

Enjoy ;)
David
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question