Solved

JDBC and NaN in where condition

Posted on 2000-03-27
3
551 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Arrays.asList  VS  ArrayList 4 60
hibernate jars 4 32
eclipse buid path vs tomcat lib path 10 24
pagenation logic how it is working in my code 1 31
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

803 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