2017-09-17 1 views
0

Bitte beraten Sie, wie Sie eine Verbindung in Java mit SQL Server Windows-Authentifizierungsmodus machen.Wie Sie eine Verbindung mit der Datenbank in Java mit Windows-Authentifizierung herstellen

Ich bin auf NetBeans 8.1 Arbeits

  1. Sie wissen, dass es so sollte kein Benutzername und Passwort ist, dass als Rohling im Frühjahr Batch-Programm database.xml gehalten werden?

Ist unten Bean xml korrekt?

Hier ist meine Bohne für JDBC-Verbindung erstellt

<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> 

Der Fehler, dass ich mit Blick auf M:

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)

Antwort

1

wie diese Ihre URL sollte aussehen: jdbc:sqlserver://localhost\YourServerName:1433;databaseName=YourDatabaseName;integratedSecurity=true; ich Frühling so nicht verwendet habe ich kann nur Folgendes riskieren: Sie müssen den Benutzer, aber nicht das Kennwort hinzufügen, da Sie die Windows-Authentifizierung im Gegensatz zur Sql Server-Authentifizierung im gemischten Modus verwenden.

Verwandte Themen