-->
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.  [ 12 posts ] 
Author Message
 Post subject: Configuration problem Microsoft SQL server 2000
PostPosted: Wed Dec 03, 2003 11:54 am 
Beginner
Beginner

Joined: Wed Sep 10, 2003 5:32 pm
Posts: 28
Hi everyone,

I am having problem to buildSessionFactory and connect to Microsoft SQL server 2000. I am using inet Opt2000 microsoft sql server JDBC driver. Here is my configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd" >
<hibernate-configuration>
<session-factory>
<!-- property -->
<property name="connection.driver_class">com.inet.tds.TdsDriver</property>
<property name="connection.url">jdbc:inetdae7a:192.168.0.19:1433?database=vfav4_testcase5</property>
<property name="connection.username">sa</property>
<property name="connection.password">password</property>
<property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
<property name="query.substitutions">hqlCurrentDate sysdate, hqlCase case, hqlWhen when, hqlThen then, hqlElse else, hqlEnd end</property>
<property name="use_outer_join">true</property>
<property name="jdbc.batch_size">30</property>
<property name="show_sql">true</property>
<property name="hibernate.dbcp.maxActive">4</property>
<property name="hibernate.dbcp.maxIdle">6</property>
<property name="hibernate.dbcp.whenExhaustedAction">1</property>
<property name="hibernate.dbcp.maxWait">2000</property>
<property name="hibernate.dbcp.timeBetweenEvictionRunsMillis">60000</property>
<property name="hibernate.dbcp.minEvictableIdleTimeMillis">0</property>
<property name="hibernate.dbcp.validationQuery">select 1 from dual</property>
<property name="hibernate.dbcp.testOnBorrow">true</property>
<property name="hibernate.dbcp.testOnReturn">false</property>
<property name="hibernate.dbcp.testWhileIdle">false</property>
<property name="hibernate.dbcp.ps.maxActive">5</property>
<property name="hibernate.dbcp.ps.maxIdle">10</property>
<property name="hibernate.dbcp.ps.maxWait">2000</property>
<property name="hibernate.dbcp.ps.whenExhaustedAction">1</property>

<!-- Mapping -->
<mapping file="c:\dev\Accucast4_research\av4\classes\testcase\testcase5\Customer.hbm.xml"/>
<mapping file="c:\dev\Accucast4_research\av4\classes\testcase\testcase5\CustAccucastData.hbm.xml"/>
<mapping file="c:\dev\Accucast4_research\av4\classes\testcase\testcase5\List.hbm.xml"/>
<mapping file="c:\dev\Accucast4_research\av4\classes\testcase\testcase5\ListMember.hbm.xml"/>
<mapping file="c:\dev\Accucast4_research\av4\classes\testcase\testcase5\Recipient.hbm.xml"/>
<mapping file="c:\dev\Accucast4_research\av4\classes\testcase\testcase5\Response.hbm.xml"/>
<mapping file="c:\dev\Accucast4_research\av4\classes\testcase\testcase5\SamplingResult.hbm.xml"/>
<mapping file="c:\dev\Accucast4_research\av4\classes\testcase\testcase5\Subscription.hbm.xml"/>
</session-factory>
</hibernate-configuration>

When I am trying to call configuration.buildSessionFactory(), I got the following from the log:

10:46:17,021 INFO Configuration:564 - processing one-to-many association mappings
10:46:17,036 DEBUG Binder:1258 - Second pass for collection: testcase.testcase5.Customer.listMembers
10:46:17,052 INFO Binder:1083 - Mapping collection: testcase.testcase5.Customer.listMembers -> LIST_MEMBER
10:46:17,099 DEBUG Binder:412 - Mapped property: lmLId -> LM_L_ID, type: long
10:46:17,161 DEBUG Binder:1270 - Mapped collection key: LM_C_ID, index: LM_L_ID, one-to-many: testcase.testcase5.ListMember
10:46:17,177 DEBUG Binder:1258 - Second pass for collection: testcase.testcase5.Customer.recipients
10:46:17,193 INFO Binder:1083 - Mapping collection: testcase.testcase5.Customer.recipients -> RECIPIENT
10:46:17,208 DEBUG Binder:412 - Mapped property: rcDId -> RC_D_ID, type: long
10:46:17,271 DEBUG Binder:1270 - Mapped collection key: RC_C_ID, index: RC_D_ID, one-to-many: testcase.testcase5.Recipient
10:46:17,271 DEBUG Binder:1258 - Second pass for collection: testcase.testcase5.Customer.responses
10:46:17,286 INFO Binder:1083 - Mapping collection: testcase.testcase5.Customer.responses -> RESPONSE
10:46:17,302 DEBUG Binder:412 - Mapped property: rsId -> RS_ID, type: long
10:46:17,333 DEBUG Binder:412 - Mapped property: rsType -> RS_TYPE, type: integer
10:46:17,411 DEBUG Binder:1270 - Mapped collection key: RS_C_ID, index: RS_ID, RS_TYPE, one-to-many: testcase.testcase5.Response
10:46:17,427 DEBUG Binder:1258 - Second pass for collection: testcase.testcase5.Customer.samplingResults
10:46:17,427 INFO Binder:1083 - Mapping collection: testcase.testcase5.Customer.samplingResults -> SAMPLING_RESULT
10:46:17,443 DEBUG Binder:412 - Mapped property: srDId -> SR_D_ID, type: long
10:46:17,505 DEBUG Binder:1270 - Mapped collection key: SR_C_ID, index: SR_D_ID, one-to-many: testcase.testcase5.SamplingResult
10:46:17,521 DEBUG Binder:1258 - Second pass for collection: testcase.testcase5.Customer.subscriptions
10:46:17,521 INFO Binder:1083 - Mapping collection: testcase.testcase5.Customer.subscriptions -> SUBSCRIPTION
10:46:17,536 DEBUG Binder:412 - Mapped property: subDId -> S_D_ID, type: long
10:46:17,552 DEBUG Binder:412 - Mapped property: subLId -> S_L_ID, type: long
10:46:17,583 DEBUG Binder:412 - Mapped property: subType -> S_TYPE, type: long
10:46:17,646 DEBUG Binder:1270 - Mapped collection key: S_C_ID, index: S_D_ID, S_L_ID, S_TYPE, one-to-many: testcase.testcase5.Subscription
10:46:17,661 DEBUG Binder:1258 - Second pass for collection: testcase.testcase5.List.listMembers
10:46:17,661 INFO Binder:1083 - Mapping collection: testcase.testcase5.List.listMembers -> LIST_MEMBER
10:46:17,677 DEBUG Binder:1270 - Mapped collection key: LM_L_ID, one-to-many: testcase.testcase5.ListMember
10:46:17,693 INFO Configuration:573 - processing one-to-one association property references
10:46:17,708 INFO Configuration:598 - processing foreign key constraints
10:46:17,724 DEBUG Configuration:608 - resolving reference to class: testcase.testcase5.Customer
10:46:17,724 DEBUG Configuration:608 - resolving reference to class: testcase.testcase5.List
10:46:17,740 DEBUG Configuration:608 - resolving reference to class: testcase.testcase5.Customer
10:46:17,755 DEBUG Configuration:608 - resolving reference to class: testcase.testcase5.Customer
10:46:17,771 DEBUG Configuration:608 - resolving reference to class: testcase.testcase5.Customer
10:46:17,786 DEBUG Configuration:608 - resolving reference to class: testcase.testcase5.Customer
10:46:18,115 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.SQLServerDialect
10:46:18,130 INFO SettingsFactory:62 - Use outer join fetching: true
10:46:18,255 INFO DBCPConnectionProvider:56 - DBCP using driver: com.inet.tds.TdsDriver at URL: jdbc:inetdae7a:192.168.0.19:1433?database=vfav4_testcase5
10:46:18,286 INFO DBCPConnectionProvider:57 - Connection properties: {user=sa, password=password}
10:46:18,693 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)

No error message, just hang. Can someone give me some directions on how to solve this problem?? This is the first time that I test on SQL server 2000, I am sure that I have done something wrong on configuration, if someone can point out my mistake that would be wonderful. Thanks.

Vivian Fonger


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2003 12:10 pm 
Regular
Regular

Joined: Sat Oct 18, 2003 11:53 am
Posts: 55
I am using the same driver with SQLServer7. I could not get DBCP to work with SQLServer with that driver and a different one. I switched to proxool (which I highly recommend) and it works slick.

Here is my config:

Code:
        <!-- DATABASE -->
        <property name="hibernate.dialect">net.sf.hibernate.dialect.SybaseDialect</property>
        <property name="hibernate.connection.driver_class">com.inet.tds.TdsDriver</property>
        <property name="hibernate.connection.url"><![CDATA[jdbc:inetdae:localhost:1433?database=lognet&sql7=true]]></property>
        <property name="statement_cache.size">15</property>
        <property name="show_sql">false</property>
        <property name="use_outer_join">true</property>
        <property name="hibernate.jdbc.batch_size">15</property>
        <property name="hibernate.jdbc.use_scrollable_resultset">true</property>

        <!-- PROXOOL -->
        <property name="proxool.pool_alias">pool1</property>
        <property name="hibernate.proxool.house-keeping-sleep-time">30000</property>
        <property name="hibernate.proxool.house-keeping-test-sql">select users_id from users where users_id=1;</property>
        <property name="hibernate.proxool.maximum-connection-count">15</property>
        <!--property name="hibernate.proxool.maximum-connection-lifetime">4</property -->
        <!-- property name="hibernate.proxool.simultaneous-build-throttle">2</property -->
        <!-- property name="hibernate.proxool.maximum-active-time">500</property -->
        <property name="hibernate.proxool.minimum-connection-count">3</property>
        <property name="hibernate.proxool.prototype-count">1</property>
        <property name="hibernate.proxool.statistics">1m,15m,1d</property>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2003 1:47 pm 
Regular
Regular

Joined: Fri Sep 05, 2003 12:01 am
Posts: 80
Location: Bogot
We use SQLserver with the microsoft JDBC driver. It works well as long as you dont use dates as primary keys.

Heres our example config for tests (for production we use a JNDI datasource and it also works well). You should try to avoid using DBC connection pool in a production environment (in our experience it doesnt handle disconnections very well) and use a container provided pool.

Code:


        <!--DB  properties -->
       
        <property name="hibernate.dialect">net.sf.hibernate.dialect.SybaseDialect</property>
        <property name="show_sql">true</property>
        <property name="use_outer_join">true</property>

       
        <property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
        <property name="hibernate.connection.password">xxx</property>
        <property name="hibernate.connection.username">xxx</property>
        <property name="hibernate.connection.url">jdbc:microsoft:sqlserver://rafael:1433;database=pmt_be;selectMethod=cursor</property>
       
        <property name="hibernate.jdbc.batch_size">0</property>
        <property name="hibernate.jdbc.use_scrollable_resultsets">false</property>
        <property name="hibernate.connection.pool_size">10</property>
        <property name="hibernate.connection.pool_alias">pool1</property>
   

_________________
Mauricio Hern


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 11:11 am 
Beginner
Beginner

Joined: Wed Sep 10, 2003 5:32 pm
Posts: 28
I find my error actually on that date.. :) I have a invalid sql statement on validate sql.. :) Bad finger.. :)


Top
 Profile  
 
 Post subject: SQLServerDialect???
PostPosted: Thu Dec 11, 2003 2:53 pm 
Regular
Regular

Joined: Fri Sep 12, 2003 12:40 pm
Posts: 65
<property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>

I just looked in the jar file and I didn't find this...Are you sure this is correct???

I noticed micho2001 is using the SybaseDialect.

Just curious.

_________________
- Brian


Top
 Profile  
 
 Post subject: Re: SQLServerDialect???
PostPosted: Thu Dec 11, 2003 3:20 pm 
Regular
Regular

Joined: Sat Oct 18, 2003 11:53 am
Posts: 55
bbonner wrote:
<property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>

I just looked in the jar file and I didn't find this...Are you sure this is correct???

I noticed micho2001 is using the SybaseDialect.

Just curious.


Sybase == MSSqlServer


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 3:35 pm 
Regular
Regular

Joined: Fri Sep 12, 2003 12:40 pm
Posts: 65
Hibernate does the mapping SQLServerDialect to Sybase under the covers? I would have thought it used the name verbatim to load the class. I didn't know it handled aliases.

In which class file does Hibernate do this? I just did a search on SQLServerDialect and I came up empty.

_________________
- Brian


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 3:44 pm 
Regular
Regular

Joined: Sat Oct 18, 2003 11:53 am
Posts: 55
bbonner wrote:
Hibernate does the mapping SQLServerDialect to Sybase under the covers? I would have thought it used the name verbatim to load the class. I didn't know it handled aliases.

In which class file does Hibernate do this? I just did a search on SQLServerDialect and I came up empty.


MS SQLServer was purchased from sybase years back. Initially they just slapped the MS name on it and shipped it (I believe).. so that is why Sybase == SQLServer. They are truly the same app.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 4:25 pm 
Regular
Regular

Joined: Fri Sep 12, 2003 12:40 pm
Posts: 65
I understand, but from vfonger's original post, he's using SQLServerDialect. I'm not sure this will work.

_________________
- Brian


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 4:26 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
SQLServerDialect is included as an extension of SybaseDialect in the current release


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 4:28 pm 
Regular
Regular

Joined: Fri Sep 12, 2003 12:40 pm
Posts: 65
Thanks. I'm using 2.1 Beta 6. Didn't realize that. Thanks.

_________________
- Brian


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 4:30 pm 
Beginner
Beginner

Joined: Wed Sep 10, 2003 5:32 pm
Posts: 28
I should reply earlier.. :) :)

My hibernate configuration works perfect for Microsoft sql server after I have correct validation query in my dbcp configuration. I should use select getdate() instead of select 1 from dual. :) :)

Everything works great. I think I prefer to use SQLServerDialect since it is specific to Microsoft sql server even though SQLServerDialect is extended from SybaseDialect.

Thanks for all the help.. :) I really appreciate it.. :)

Vivian Fonger


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 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.