This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes how to set a null and how to retrieve it Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "how to set a null and how to retrieve it" Watch "how to set a null and how to retrieve it" New topic
Author

how to set a null and how to retrieve it

ramchander yshetti
Ranch Hand

Joined: Apr 22, 2006
Posts: 97
hai,
how to set a null values into a table and
how to retrieve the null values from the table

i used the methods
setNull() and getNull() i am not getting
please solve my query with example..

thank Q

bye.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2343

To set null values:
PreparedStatement.setNull().

To check null values: ResultSet.wasNull().

Regards, Jan
[ April 24, 2007: Message edited by: Jan Cumps ]

OCUP UML fundamental
ITIL foundation
Gaurav Chikara
Ranch Hand

Joined: Jun 09, 2000
Posts: 410


To check null values: ResultSet.wasNull().


ResultSet's wasNull only checks if last column read was Null
Better and scalable approach is always to write a utility class for checking null value and check the value returned against it
e.g. You wrote Util.java and one of the methods is
boolean isNull(Object obj)

then simply use it and you will know if the value returned is Null or not
[ April 24, 2007: Message edited by: Gaurav Chikara ]

SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: how to set a null and how to retrieve it
 
Similar Threads
Problem with cell Editing of three columns
table selection in SWT
setting and retrieving values for JRadioButton
Simple Question ???
Retrieve Soap header