2017-09-17 3 views
0

SQL Server Windows 인증 모드로 Java에서 연결하는 방법을 알려주십시오.Windows 인증을 사용하여 java에서 데이터베이스와 연결하는 방법

내가 넷빈즈에서 일하고 있어요 8.1

  1. 당신이 어떤 사용자 이름과 암호가 없습니다 그래서 봄 일괄 프로그램 database.xml에서 빈 유지해야 알아?

콩 xml 아래에 있습니까? 여기

나의 빈은 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 인증을 사용하는 경우 사용자는 추가해야하지만 암호는 추가하지 않아야합니다.