SpringBoot+Maven配置达梦数据库连接

该文章已生成可运行项目,

注意:要定位到项目文件夹的目录下操作下面指令,不然会报没有pom文件夹的错误:

[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\      ). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]

1.在项目的端口中运行以下指令

mvn org.apache.maven.plugins:maven-install-plugin:3.1.0:install-file -Dfile="C:\D\DMdb\drivers\jdbc\DmJdbcDriver18.jar" -DgroupId="com.dm" -DartifactId="DmJdbcDriver" -Dversion="1.8.0" -Dpackaging="jar" -DgeneratePom=true

-DgroupId=com.dm 和-Dversion=1.8.0 会提示

[ERROR] Unknown lifecycle phase ".8.0". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-v ersion>]:<goal>. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compi le, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1]

报错把 ".8.0" 当成了生命周期阶段,说明 -Dversion=1.8.0 在命令行被拆成了 1.8.0 两个 token(和之前 .dm 的问题是同一类原因):shell/换行/续行符/隐藏字符 导致点号开头的片段被单独传给 Maven。故加一个双引号即可

执行完后的结果:

2. 然后再到pom文件中加入依赖

        <!-- 达梦数据库驱动包-->
        <dependency>
            <groupId>com.dm</groupId>
            <artifactId>DmJdbcDriver</artifactId>
            <version>1.8.0</version>
        </dependency>

3.修改数据库连接的配置文件

spring:
  datasource:
    driver-class-name: dm.jdbc.driver.DmDriver
    # 推荐用 ?schema=... 参数(注意大写或小写均可,但以你驱动文档为准)
    url: jdbc:dm://localhost:5236?schema=springboot_vue&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
    username: SYSDBA
    password: *************

本文章已经生成可运行项目
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值