我正在尝试建立与数据库的连接.这是一个使用maven的简单项目.我有问题sqljdbc_auth.dll
我添加了mssql jdbc驱动程序并添加了依赖项 pom.xml
<dependency>
<groupId>com.microsoft</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>4.0.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这是我的尝试块
try {
// Establish the connection.
SQLServerDataSource ds = new SQLServerDataSource();
ds.setIntegratedSecurity(true);
ds.setServerName("BUILDSRV");
ds.setDatabaseName("master");
ds.setIntegratedSecurity(true);
con = ds.getConnection();
}
Run Code Online (Sandbox Code Playgroud)
我有一个错误
21.11.2012 18:07:04 com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit>
WARNING: Failed to load the sqljdbc_auth.dll cause :- no sqljdbc_auth in java.library.path
com.microsoft.sqlserver.jdbc.SQLServerException:
Run Code Online (Sandbox Code Playgroud)
我有我的sqljdbc_auth.dll但我不需要把它放到我的C:\windows\...
我需要在maven的项目中添加它.我怎样才能做到这一点?
我试图将它添加到它pom.xml但它不起作用
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>attach-artifacts</id>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<file>target</file>
<type>dll</type>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)
我在建造时遇到了另一个错误
Failed to execute …Run Code Online (Sandbox Code Playgroud)