2017-09-17 4 views
0

SQL Server Windows認証モードでjavaで接続する方法を教えてください。Windows認証付きJavaでデータベースとの接続方法

私は、NetBeansに取り組んでいる8.1

  1. あなたがそこには、ユーザー名とパスワードはありませんので、それは春のバッチプログラムdatabase.xmlのように空白のままする必要があります知っていますか?

Bean xmlは正しいですか?

ここで私が直面mの誤差がある私のBeanは、JDBC接続のために

<bean id="dataSource1" 
    class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 
    <property name="driverClassName" value="sun.jdbc.odbc.JdbcOdbcDriver" /> 
    <property name="url" value="jdbc:sqlserver://DESKTOP-7CI6DU0\\SQLEXPRESS:1433;databaseName=master" /> 
    <property name="username" value="" /> 
    <property name="password" value="" /> 
</bean> 

を作成します:

Compiling 6 source files to C:\Users\Nitish\Downloads\SMD\Spring_Batch_SendMail\build\classes
C:\Users\Nitish\Downloads\SMD\Spring_Batch_SendMail\src\SendMail\Mailitemwriter.java:58: error: cannot access DataAccessException
result += jdbcTemplate.update(UPDATE_QUERY, params);
class file for org.springframework.dao.DataAccessException not found Note: C:\Users\Nitish\Downloads\SMD\Spring_Batch_SendMail\src\SendMail\MailProg.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error C:\Users\Nitish\Downloads\SMD\Spring_Batch_SendMail\nbproject\build-impl.xml:929: The following error occurred while executing this line: C:\Users\Nitish\Downloads\SMD\Spring_Batch_SendMail\nbproject\build-impl.xml:269: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 1 second)

答えて

1

あなたのURLは次のようになります。jdbc:sqlserver://localhost\YourServerName:1433;databaseName=YourDatabaseName;integratedSecurity=true; 私はそう春を使用していませんSql Server混在モードの認証ではなく、Windows認証を使用しているときにユーザーを追加する必要がありますが、パスワードは追加しないでください。

関連する問題