Setting up maven dependency for SQL Server

后端 未结 8 1742
小鲜肉
小鲜肉 2020-11-28 02:07

I am developing a portlet where I have Hibernate access to SQL Server database. I set up maven dependencies for it and try to find out SQL Server connector

相关标签:
8条回答
  • 2020-11-28 03:08

    Answer for the "new" and "cool" Microsoft.

    Yay, SQL Server driver now under MIT license on

    • GitHub: https://github.com/Microsoft/mssql-jdbc
    • Maven Central: http://search.maven.org/#search%7Cga%7C1%7Cmssql-jdbc
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>mssql-jdbc</artifactId>
        <version>6.1.0.jre8</version>
    </dependency>
    

    Answer for the "old" Microsoft:

    For my use-case (integration testing) it was sufficient to use a system scope for the JDBC driver's dependency as such:

    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>sqljdbc4</artifactId>
        <version>3.0</version>
        <scope>system</scope>
        <systemPath>${basedir}/lib/sqljdbc4.jar</systemPath>
        <optional>true</optional>
    </dependency>
    

    That way, I could put the JDBC driver into local version control. No need to have each developer manually set stuff up in their own repositories.

    I took inspiration from this answer to another Stack Overflow question and I've also blogged about it here.

    0 讨论(0)
  • 2020-11-28 03:08

    I believe you are looking for the Microsoft SQL Server JDBC driver: http://msdn.microsoft.com/en-us/sqlserver/aa937724

    0 讨论(0)
提交回复
热议问题