-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: problem with reading varchar2 column stored in database
PostPosted: Mon Apr 07, 2008 4:48 am 
Newbie

Joined: Mon Apr 07, 2008 3:42 am
Posts: 2
Hi,
I'm using Hibernate 3.2.5 with Oracle 9 database.
I've a problem while reading varchar2(20) column where user password hash is stored.
I get different results when password is read from pl/sql developer (or C client aplication which is connecting with my application) and when using hibernate.

For example:
codes of characters for some pass, read from pl/sql dev are as following:
8364, 35, 8364, 88, 8364, 80, 196, 110, 341, 91

while corresponding codes returned by hibernate are:
128, 35, 128, 88, 128, 80, 196, 110, 224, 91

It seems like hibernate was reading only one byte, but 8 least significant bits of 8364 aren't the same as bits of 128.

I thought that it is problem with setting NLS_LANG environment variable, but after setting it result is the same.

part of hibernate.cfg.xml:

Code:
<hibernate-configuration>
    <session-factory name="MySessionFactory">
        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="hibernate.connection.password">pass</property>
        <property name="hibernate.connection.url">jdbc:oracle:thin:@(...)</property>
        <property name="hibernate.connection.username">user</property>
        <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
        <property name="hibernate.current_session_context_class">thread</property>
        <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
        <property name="hibernate.cache.use_query_cache">true</property>
        <property name="hibernate.generate_statistics">true</property>
        <property name="hibernate.cache.use_structured_entries">true</property>
        <property name="hibernate.max_fetch_depth">1</property>


password column mapping:

Code:
        <property name="Password" type="string">
            <column name="PASSWORD" length="20" />
        </property>



I think that i've missed something during configuration.
Any help will be appreciated.
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 07, 2008 9:59 am 
Newbie

Joined: Mon Apr 07, 2008 3:42 am
Posts: 2
Hi again,
Finally i've managed to solve the problem. It had nothing to do with hibernate. It was because Strings from client were encoded using utf-8, not the same charset as used in Database.
it was the matter of simple conversion.
thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.