简体   繁体   English

Spring 引导应用程序无法连接到本地 SQL 服务器

[英]Spring Boot Application can't connect to a local SQL Server

I'm creating a spring boot application, but I'm not able to connect it to a local sql server.我正在创建 spring 引导应用程序,但无法将其连接到本地 sql 服务器。

Here's my POM file:这是我的 POM 文件:

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency> 
            <groupId>org.springframework.boot</groupId> 
            <artifactId>spring-boot-starter-web</artifactId> 
        </dependency>
        <dependency> 
            <groupId>org.springframework.boot</groupId> 
            <artifactId>spring-boot-starter-data-jpa</artifactId> 
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

application.properties:应用程序属性:

spring.datasource.url=jdbc:sqlserver://localhost;databaseName=myDB

spring.datasource.username=username
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2008Dialect

The SQL Server is running on the port 1433 (TCP enabled), but when i run the application i got the following error: SQL 服务器在端口 1433 上运行(启用 TCP),但是当我运行应用程序时出现以下错误:

PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

which i don't know how to solve.我不知道如何解决。

Any help?有什么帮助吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么spring-boot连接到本地mysql服务器? - Why doesn't spring-boot connect to local mysql server? 无法将 Microsoft SQL Server 连接到 Spring Boot 应用程序 - Unable to Connect Microsoft SQL Server to Spring Boot Application 无法将 spring 引导应用程序与 SQL SERVER 数据库连接 - Not able to connect spring boot application with SQL SERVER Database 无法从Spring Boot应用程序连接到Bigtable - Can't connect to Bigtable from a Spring Boot application 无法将Spring Boot Admin Server 2和Spring Boot Admin Client 2与Spring Boot 2集成在单个应用程序中 - Can't integrate Spring Boot Admin Server 2 and Spring Boot Admin Client 2 with Spring Boot 2 in a single application Spring 启动应用程序无法连接到本地网络上的 mysql 服务器 - Spring boot app can't conncect to mysql server on local network 将 Spring 引导连接到 SQL 服务器 Express - Connect Spring Boot to SQL Server Express JAVA-如何将Spring Boot应用程序与SQL Server 2016(具有Windows身份验证)连接? - JAVA - How to Connect spring boot application with SQL server 2016 (which has windows authentication)? 将 SQL 服务器与 Spring 引导应用程序连接 - Connecting SQL Server with Spring Boot application 如何在 Spring Boot Dockerised 应用程序中连接到特定的本地 MongoDB 实例? - How to connect to specific local MongoDB instance in Spring Boot Dockerised application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM