Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General » SQL Server »

ODBC:No recibo NULL de los campos vacios con un getString

Estas en el tema de ODBC:No recibo NULL de los campos vacios con un getString en el foro de SQL Server en Foros del Web. Mi problema es el siguiente. Estoy leyendo campos de un resultset con un getString, y mi problema me surge cuando leo campos vacios. Solo me ...
  #1 (permalink)  
Antiguo 27/11/2008, 06:15
 
Fecha de Ingreso: septiembre-2008
Mensajes: 6
Antigüedad: 15 años, 7 meses
Puntos: 0
ODBC:No recibo NULL de los campos vacios con un getString

Mi problema es el siguiente. Estoy leyendo campos de un resultset con un getString, y mi problema me surge cuando leo campos vacios. Solo me devuelve null cuando leo el primero, si despues encuentra en ese mismo campo otro valor vacio me devuelve un string de longitud 0. Alguien puede ayudarme?

Muchas gracias!!
  #2 (permalink)  
Antiguo 27/11/2008, 06:20
 
Fecha de Ingreso: septiembre-2008
Mensajes: 6
Antigüedad: 15 años, 7 meses
Puntos: 0
Respuesta: ODBC:No recibo NULL de los campos vacios con un getString

Bueno llevo toda la mañana peleando con esto, y justo despues de colgar el post buscando en la pagina de sun encuentro esto:


Synopsis Error! ResultSet.wasNull() did not return true after reading null value
Category jdbc:jdbc_odbc_bridge
Reported Against ladybird-beta
Release Fixed 1.3.0_03, 1.3.1(Bug ID:2041352) , 1.4(merlin-beta) (Bug ID:2041353)
State 10-Fix Delivered, Verified, bug
Priority: 2-High
Related Bugs
Submit Date 10-MAR-2001
Description

Problem Description:
--------------------

This bug was discovered on ladybird (jdk 1.3.1) while testing the fix
for bug 4417105 by Sybase.

Please find below the details:

The new bridge does fix the problem we reported.

However, further testing of the bridge reveals that after reading a SQL
NULL value by calling ResultSet.getString(), calling ResultSet.wasNull()
returns false. This is incorrect behavior.

The problem can be corrected by explicitly setting ResultSet.lastColumnNull
at every return point in JdbcOdbcResultSet.getString(). Look for the
comment "ADDED BY xxxxx " in the accompanying copy of the
JdbcOdbcResultSet.java file.

Note that this same problem appears to be present in the other getXXX()
functions such as getBytes(), getDate(), etc. A similar fix should also be
made to those functions as well.

I have attached an updated copy of the original BridgeBug.zip file which
contains patched source to the bridge which fixes the problem with wasNull
() and getString().

Espero que os pueda servir de ayuda.
  #3 (permalink)  
Antiguo 27/11/2008, 12:02
Avatar de flaviovich  
Fecha de Ingreso: agosto-2005
Ubicación: Lima, Peru
Mensajes: 2.951
Antigüedad: 18 años, 8 meses
Puntos: 39
Respuesta: ODBC:No recibo NULL de los campos vacios con un getString

getString no parece una funcion de SQL, o por lo menos yo no la conozco.
Tal parece que te equivocaste de foro.
__________________
No repitamos temas, usemos el Motor de busquedas
Plantea bien tu problema: Ayúdanos a ayudarte.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:52.