Hi Gerardo,

we had a similar problem. The cause was that we had the database field defined as 
CHAR(10). Oracle uses the full-lenght string of the database to do the comparisons, 
thus '10        ' = '10'. The comparison yields FALSE and you don't get the row.

If you run the same query in sql*plus the trailing blanks are ignored and the row is 
found.

I think it is a matter of configuration for the database session (or oracle net), but 
didn't do any further investigation.

Our solution:
We use VARCHAR/VARCHAR2 database fields now and have no problems doing so.

If anybody knows whether this can be configured at jdbc level or somewhere else, let 
us know.

Regards
Max


> -----Ursprüngliche Nachricht-----
> Von: Gerardo Arroyo [mailto:[EMAIL PROTECTED]]
> Gesendet: Dienstag, 3. Dezember 2002 18:55
> An: [EMAIL PROTECTED]
> Betreff: OJB 0.9.8 and ORACLE
> Wichtigkeit: Hoch
> 
> 
> Hi,
> 
> I had a weird condition using OJB 0.9.8 or 0.9.7 with an 
> ORACLE database. I
> had a very simple SELECT statement with an direct WHERE clause.
> I used P6Spy in order to detect and analize the SQL 
> Statements sended to the
> RDBMS and I found a well formed sentence:
> SELECT A0.des_marca,A0.ind_es_comercial,A0.cod_linea,A0.cod_marca FROM
> web_marca_tb A0 WHERE A0.cod_linea =  '01'
> 
> Note: the '01' argument is a hard-coded value inside my logic
> (criteria.addEqualTo("cod_linea", "01"); )
> 
> If I run the application the "broker" return 0 rows, but if I 
> cut and paste
> the statement and execute it directly I got the 2 rows that 
> in fact exists!!
> And I had this problem in diferents segments of my code. 
> Under Sybase 11.9.2
> the applications works perfectly.
> 
> I am using ORACLE 9.2.0.1.0 and the last JDBC driver. My
> jdbc-connection-descriptor is:
>  <jdbc-connection-descriptor
>               platform="Oracle"
>               jdbc-level="2.0"
>               driver="com.p6spy.engine.spy.P6SpyDriver"
>               protocol="jdbc"
>               subprotocol="oracle"
>               dbalias="thin:@10.1.1.157:1521:auto"
>               username="user"
>               password="pass"
>    />
> 
> and the real driver is "oracle.jdbc.driver.OracleDriver"
> 
> Ideas? Suggestions?
> 
> Thanks in advance,
> Gerardo
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to