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: help
PostPosted: Wed Feb 17, 2010 5:06 pm 
Newbie

Joined: Fri Aug 14, 2009 9:35 am
Posts: 3
I work with java and eclipse and microsoft sql server 2005

do I need to NHibernate or Hibernate?

do you have an example of configuratiom.xml file for microsoft sql server 2005?

thanks.


Top
 Profile  
 
 Post subject: Re: help
PostPosted: Thu Feb 18, 2010 4:00 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
As you work with java I suggest you to use Hiberante.
To connect to microsoft sql server 2005 you just need an appropriate jdbc-driver.

NHiberante is for programming with .NET, here's an article on wikipedia which compares between Java and .NET
http://en.wikipedia.org/wiki/Comparison_of_the_Java_and_.NET_platforms

Here a sample persistence.xml file I use (I use JPA-approach and SQLServer2008),
it should be easy to adapt for usage in configuration.xml
Code:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"  version="1.0">

<persistence-unit name="bclayer">
   <properties>
     <!-- Scan for annotated classes and Hibernate mapping XML files -->
     <property name="hibernate.archive.autodetection" value="class, hbm"/>

     <!-- SQL stdout logging  -->
    <property name="hibernate.show_sql" value="false"/>
    <property name="hibernate.format_sql" value="true"/>
    <property name="use_sql_comments" value="true"/>

    <!-- MS_SQLServer -->
    <property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    <property name="hibernate.connection.url" value="jdbc:sqlserver://mymachine:1433;databasename=Bart"/>
    <property name="hibernate.connection.username" value="sa"/>
    <property name="hibernate.connection.password" value="mypasswd"/>
    <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>


    <!-- uncomment following section if you want to go on SQLServer with JTDS (http://jtds.sourceforge.net/) instead
     
    <property name="hibernate.connection.driver_class" value="net.sourceforge.jtds.jdbc.Driver"/>
    <property name="hibernate.connection.url" value="jdbc:jtds:sqlserver://mymachine:1433;databasename=Bart;cacheMetaData=true;maxStatements=2147483647"/>
-->


     <!-- activate following line for logging or profiling (java -jar libext/jdbc/p6spy/sqlprofiler.jar )
         all jdbc-activities. Edit spy.properties first (must be located in classpath)

     <property name="hibernate.connection.driver_class" value="com.p6spy.engine.spy.P6SpyDriver"/>
     -->

    </properties>
</persistence-unit>
</persistence>


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.