Recently, I received a project that required localization and used the Dameng database. Unexpectedly, there were problems with the configuration at the beginning. I will paste the configuration below so that you can avoid pitfalls.
1. Download Dameng database first
This is the download link of Dameng database . Dameng database is not free. Personally, it seems that it has a one-year trial period. I am not sure about the details and haven’t started to study it carefully.
After the download is complete, install it.
2. Introduce jar package into the project (two ways)
It should be noted here that Dameng currently has no dependencies in the maven central warehouse that can be downloaded. It can only be used through local introduction. There are two ways: one is to put it directly into the project for reference, and the other is to package it yourself through the maven command. Reference directly to your local maven repository.
Before installation, we need to find the required jar package. The jar package is in the path where Dameng is installed. After installing Dameng, the jar package comes with it and can be used.
The one I chose here is 18. If you are interested, you can see the difference between them. I will use the latest one.
1. Put the jar package into the project for direct reference
1. First create a lib folder in the project root directory, and then put the jar package into it.
2. After putting it in, you can start to reference the jar package.
In this way, it can be used. Of course, this is only the configured jar package, and I have put the yaml configuration at the end.
2. Install to the local warehouse through the maven command (personal recommendation)
In fact, this is relatively simple and the citation method is the same as the citation online. I personally recommend this method.
1. First find the location of the jar, open the cmd window command at the location of the jar package, and then enter this line of command
mvn install:install-file -Dfile=F:\DMDb\drivers\jdbc\DmJdbcDriver18.jar -DgroupId=com.dm -DartifactId=DmJdbcDriver -Dversion=1.8.0 -Dpackaging=jar
Simply put this command in the cmd window to package it.
-Dfile is the address of the jar package. Remember to change it to your own. You can just copy and paste the others. If the version is changed, remember to change -Dversion .
2. After installation, you can directly reference it in the pom.
At this point you can use Dameng's dependencies.
3. Dameng database yaml configuration
The configuration of Dameng database is a bit different from that of mysql. It can be divided into two types. The first is ip+port/database name , and the second is ip+port?schema=database name (also called schema name) . See Personal preference, the first one I use.
spring:
datasource:
driver-class-name: dm.jdbc.driver.DmDriver
url: jdbc:dm://127.0.0.1:5236/库名?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8
username: username
password: password
hikari:
maximum-pool-size: 10
minimum-idle: 5
connection-timeout: 10000
This basically works, I hope it can help everyone.