Solved

JDBC and NaN in where condition

Posted on 2000-03-27
3
554 Views
Last Modified: 2008-02-26
I try to retrieve rows that include columns with an NaN value as Float.
I use preparedStatement.

ex : select c1,c2,c3 where c1 = ?

java code is like :

               ps = con.preparedStatement(select c1,c2,c3 where c1 = ?);
               ps.setObjet(1,new Float(Float.NaN);
               rs = ps.executeQuery();

I know that some rows match this case, but rs.next() return false

Can somebody help me ?

0
Comment
Question by:jguy
3 Comments
 
LVL 1

Expert Comment

by:computerpunk
ID: 2662900
Have you tried ps.setFloat() or setDouble() passing in the value.
Something like ps.setFloat(1,Float.NaN);
And besides that have you checked your SQL statement ?? YOu have forgotten your erm.. Table name .
0
 

Author Comment

by:jguy
ID: 2663140
I tried this solution yet with no succes. In fact, i think it is probably due to the bite value of the Float.NaN in java comparing to the his value on the database (I use Sybase).
0
 
LVL 2

Accepted Solution

by:
azawawi earned 100 total points
ID: 2677978
check if Sybase uses IEEE 754 as Java, if not... then try converting NaN into another special value (like null) for example...
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
check java version using powershell 13 303
how to install java on RHEL image on EC2 4 57
going to wrong jsp page 2 49
ejb message driven bean mdb creation steps 2 35
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This video teaches viewers about errors in exception handling.

733 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