Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

Conectando-se ao MS sql através da hibernação


Conforme mencionado por Pascal Thivent , use qualquer driver. No caso de JTDS, use a seguinte configuração.
<hibernate-configuration>
<session-factory>
    <property name="connection.url">jdbc:jtds:sqlserver://XX.XX.XXX.XX:YYYY/DB-NAME</property>
    <property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
    <property name="connection.username">username</property>
    <property name="connection.password">password</property>
    <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
. 
.
.
</session-factory>
</hibernate-configuration>

E no caso do Microsoft SQL JDBC Driver,
<hibernate-configuration>
<session-factory>
    <property name="connection.url">jdbc:microsoft:sqlserver://XX.XX.XXX.XX:YYYY/DB-NAME</property>
    <property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
    <property name="connection.username">username</property>
    <property name="connection.password">password</property>
    <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
. 
.
.
</session-factory>
</hibernate-configuration>