使用Spring Data JPA无法正确连接到SQlitedb

时间:2019-01-30 07:41:15

标签: sqlite spring-data-jpa

我尝试了许多可能的解决方案,但似乎没有任何效果,我想我缺少了一些小而重要的东西。现在看到这么多解决方案令我感到困惑。建立数据库连接或jar版本是否有问题?我是第一次使用sqlite。 我曾经使用过Translator,尝试修改jar版本的范围,遇到了一个解决方案,其中提到了有关sqlite-jdbc存储库的一些内容,但并没有完全理解。 请帮忙。 我收到以下错误  https://pastebin.com/E0ND6WYL pom.xml

<?xml version="1.0" encoding="UTF-8"?>
     <project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
     http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

    <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.2.RELEASE</version>
    <relativePath /> 
    <!-- lookup parent from repository -->
    </parent>

    <groupId>com.epsilon.bike</groupId>
    <artifactId>demo-1</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo-1</name>
    <description>BIke project for Spring Boot</description>

    <properties>
    <java.version>1.8</java.version>
    </properties>

    <dependencies>
    <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>org.xerial</groupId>
        <artifactId>sqlite-jdbc</artifactId>
        <version>3.16.1</version>
        <scope>runtime</scope>
    </dependency>


    <!-- https://mvnrepository.com/artifact/com.zsoltfabok/sqlite- 
    dialect -->
    <dependency>
        <groupId>com.zsoltfabok</groupId>
        <artifactId>sqlite-dialect</artifactId>
        <version>1.0</version>
    </dependency>


    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
</project>

Application.properties




    spring.jpa.database-platform=org.hibernate.dialect.SQLiteDialect
    spring.jpa.ddl-auto=none
    spring.jpa.show-sql=true

    spring.datasource.url=jdbc:sqlite:bike.db
    spring.datasource.driver-class-name=org.sqlite.JDBC
    #spring.datasource.username=
    #spring.datasource.password=

0 个答案:

没有答案