(一)SQL state [99999]; error code [17056]; 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK; nested exception

博客详细解析了遇到的SQL state [99999],error code [17056],不支持字符集ZHS16GBK的问题。原因是高版本Oracle JDBC驱动缺少orai18n.jar,解决方案是引入该jar包或切换到低版本驱动。实验表明,引入orai18n.jar或使用18.x.x.x及以下版本的驱动可以解决问题。
摘要由CSDN通过智能技术生成

不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK

 

 

目录

 

一、报错解答

1、报错

2、背景

3、原因分析

4、解决方案

 

二、实验

1、实验操作与分析

2、实验结论

 

三、附录

1、Maven仓库配置(D:\Maven\apache-maven-3.6.3\conf\settings.xml)

2、Oracle jdbc 驱动程序配置(pom.xml)


 

一、报错解答

 

1、报错

org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException; SQL state [99999]; error code [17056]; 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK; nested exception is java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK

 

详细报错内容如下:

org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException; SQL state [99999]; error code [17056]; 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK; nested exception is java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK

	at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1542)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1206)
	at com.example.jdbctemplateproject.service.ComplexTests.procedure_oracle(ComplexTests.java:91)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.util.ArrayList.forEach(ArrayList.java:1249)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.util.ArrayList.forEach(ArrayList.java:1249)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK
	at oracle.sql.CharacterSetUnknown.failCharsetUnknown(CharacterSetFactoryThin.java:240)
	at oracle.sql.CharacterSetUnknown.convert(CharacterSetFactoryThin.java:201)
	at oracle.jdbc.driver.PhysicalConnection.throughDbCharset(PhysicalConnection.java:11043)
	at oracle.jdbc.driver.PhysicalConnection.enquoteIdentifier(PhysicalConnection.java:11123)
	at oracle.jdbc.driver.OracleStatement.enquoteIdentifier(OracleStatement.java:6788)
	at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:4211)
	at oracle.jdbc.driver.InsensitiveScrollableResultSet.findColumn(InsensitiveScrollableResultSet.java:299)
	at oracle.jdbc.driver.GeneratedResultSet.getString(GeneratedResultSet.java:662)
	at com.example.jdbctemplateproject.service.ComplexTests$3.doInCallableStatement(ComplexTests.java:110)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1190)
	... 68 more

 

 

2、背景

 单元测试类:ComplexTests.java

@SpringBootTest
public class ComplexTests {
    @Autowired
    private JdbcTemplate jdbcTemplate;


    @Test
    void procedure_oracle() {

        List resultList = (List) jdbcTemplate.execute(
            new CallableStatementCreator() {
                @Override
                public CallableStatement createCallableStatement(Connection con) throws SQLException {
                    String storedPoc = "{call pro_query_emp_limit(?,?,?)}"; // 调用的sql
                    CallableStatement cs = con.prepareCall(storedPoc);
                    cs.setInt(1, 4); // 设置输入参数的值
                    cs.setInt(2, 3); // 设置输入参数的值
                    cs.registerOutParameter(3, OracleTypes.CURSOR); // 注册输出参数的类型
                    return cs;
                }
            }, new CallableStatementCallback() {
                @Override
                public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
                    List resultsMap = new ArrayList();
                    cs.execute();
                    ResultSet rs = (ResultSet) cs.getObject(3); //获取游标一行的值
                    while(rs.next()) { // 转换每行的返回值到 Map 中
                        Map rowMap = new HashMap();
                        rowMap.put("id", rs.getString("empno"));
                        rowMap.put("name", rs.getString("ename"));
                        resultsMap.add(rowMap);
                    }
                    rs.close();
                    return resultsMap;
                }
            }
        );

        for (int i=0; i<resultList.size(); i++) {
            Map rowMap = (Map) resultList.get(i);
            String id = rowMap.get("id").toString();
            String name = rowMap.get("name").toString();
            System.out.println("id=" + id + ";name=" + name);
        }
    }

}

 

引入的 Oracle jdbc 驱动程序是21.5.0.0版本的。

pom.xml

		<!-- Oracle 驱动包 -->
		<dependency>
			<groupId>com.oracle.database.jdbc</groupId>
			<artifactId>ojdbc8</artifactId>
			<version>21.5.0.0</version>
			<scope>runtime</scope>
		</dependency>

 

3、原因分析

引入的Oracle jdbc 驱动程序“不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK”,需要在pom.xml文件中同时引入orai18n.jar包。

 

 

4、解决方案

方案1:

 在maven仓库引入 orai18n.jar 包。如下所示,在pom.xml文件中引入 orai18n.jar 包。

下面两种不同来源的orai18n包任选一种即可(推荐第一种,第一种是官方的)。

 

第一种:

pom.xml

        <!-- 引入orai18n包(用于支持中文字符集解析) -->
		<!-- Additional library required to support Internationalization -->
		<dependency>
			<groupId>com.oracle.database.nls</groupId>
			<artifactId>orai18n</artifactId>
			<version>21.5.0.0</version>
			<optional>true</optional>
		</dependency>

或者:

 

第二种:

pom.xml

		<!-- https://mvnrepository.com/artifact/cn.easyproject/orai18n -->
		<dependency>
			<groupId>cn.easyproject</groupId>
			<artifactId>orai18n</artifactId>
			<version>12.1.0.2.0</version>
			<scope>provided</scope>
		</dependency>

 

 

 备注:<version> 一栏不写的话,spring-boot-starter-parent包(以2.7.6版本为例)里面包含的的spring-boot-dependencies包(2.7.6版本为例)里面有默认配置。


spring-boot-dependencies-2.7.6.pom

<!-- spring-boot-dependencies-2.7.6.pom -->
  <properties>
    <oracle-database.version>21.5.0.0</oracle-database.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.oracle.database.jdbc</groupId>
        <artifactId>ojdbc-bom</artifactId>
        <version>${oracle-database.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

 

 

 

方案2:

更换其它较低版本的 Oracle jdbc 驱动程序,那些里面有引入orai18n.jar包(注意这些jar包需要在本地或远程的maven仓库能找到)。下面是更换并测试通过的 Oracle jdbc 驱动程序。

 

 ojdbc6:

11.2.0.4

 

示例:

    	<dependency>
			<groupId>com.oracle.database.jdbc</groupId>
			<artifactId>ojdbc6</artifactId>
			<version>11.2.0.4</version>
			<scope>runtime</scope>
		</dependency>

或者

 

 ojdbc8:
12.2.0.1
18.3.0.0
18.15.0.0

 

示例:

		<dependency>
			<groupId>com.oracle.database.jdbc</groupId>
			<artifactId>ojdbc8</artifactId>
			<version>12.2.0.1</version>
			<scope>runtime</scope>
		</dependency>

 

 

二、实验

下面是针对这个上述报错进行过的实验测试。

 

1、实验操作与分析

实验1:Oracle jdbc 驱动程序版本测试

 

操作:

(1)高版本测试:经测试,当启动spring boot 进行单元测试时,版本19.x.x.x ~ 21.x.x.x 的 Oracle jdbc 驱动程序包会出现上述报错。

(2)低版本测试:经测试,其他一些低版本(18.x.x.x及以下)的 Oracle jdbc 驱动程序则正常(备注:这些低版本的 Oracle jdbc 驱动程序,内部有引入orai18n.jar 包,且在本地或远程maven仓库中能找到)。

 

分析:

Oracle jdbc 驱动程序,高、低版本中有所差异,19.x.x.x及以上的高版本没有引入orai18n.jar 包 或者 引入了但是在本地和远程仓库都无法找到。

 

 

实验2:在pom.xml文件中引入 orai18n.jar 包

 

操作:

步骤1:在pom.xml文件中引入 orai18n.jar 包,如下:

pom.xml

        <!-- Additional library required to support Internationalization -->
		<dependency>
			<groupId>com.oracle.database.nls</groupId>
			<artifactId>orai18n</artifactId>
			<version>12.2.0.1</version>
			<optional>true</optional>
		</dependency>

步骤2:使用高版本的Oracle jdbc 驱动程序进行测试。经测试,引入 orai18n.jar 包后正常。

 

分析:

当引入的是高版本(19.x.x.x及以上)的Oracle jdbc 驱动程序时,需要同时引入 orai18n.jar 包。

 

2、实验结论

根据上述两个实验可知:

 

(1)当引入的是高版本(19.x.x.x及以上)的Oracle jdbc 驱动程序时,由于其不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK,所以需要同时引入 orai18n.jar 包才能正常启动。

 

用法示例:

 

pom.xml

		<!-- Oracle 驱动包 -->
		<dependency>
			<groupId>com.oracle.database.jdbc</groupId>
			<artifactId>ojdbc8</artifactId>
			<version>21.5.0.0</version>
			<scope>runtime</scope>
		</dependency>

		<!-- Additional library required to support Internationalization -->
		<dependency>
			<groupId>com.oracle.database.nls</groupId>
			<artifactId>orai18n</artifactId>
			<version>21.5.0.0</version>
			<scope>provided</scope>
		</dependency>

 

(2)当引入的是低版本(18.x.x.x及以下)的Oracle jdbc 驱动程序时,由于其内部有引入orai18n.jar 包且orai18n.jar 包在本地或远程maven仓库中能找到,所以可以不再需要引入orai18n.jar 也能正常启动。

 

用法示例:

 

 pom.xml

        <!-- Oracle 驱动包 -->
		<dependency>
			<groupId>com.oracle.database.jdbc</groupId>
			<artifactId>ojdbc8</artifactId>
			<version>18.15.0.0</version>
			<scope>runtime</scope>
		</dependency>

 

 

三、附录

 

1、Maven仓库配置(D:\Maven\apache-maven-3.6.3\conf\settings.xml)

settings.xml

<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in
 |                 ${maven.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
  <!-- 配置本地仓库 -->
  <localRepository>D:\Maven\repository</localRepository>

  <!-- interactiveMode
   | This will determine whether maven prompts you when it needs input. If set to false,
   | maven will use a sensible default value, perhaps based on some other setting, for
   | the parameter in question.
   |
   | Default: true
  <interactiveMode>true</interactiveMode>
  -->

  <!-- offline
   | Determines whether maven should attempt to connect to the network when executing a build.
   | This will have an effect on artifact downloads, artifact deployment, and others.
   |
   | Default: false
  <offline>false</offline>
  -->

  <!-- pluginGroups
   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
   |-->
  <pluginGroups>
    <!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
    -->
  </pluginGroups>

  <!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
  </proxies>

  <!-- servers
   | This is a list of authentication profiles, keyed by the server-id used within the system.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   |-->
  <servers>
    <!-- server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the 'id' attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     |
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
    -->

    <!-- Another sample, using keys to authenticate.
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->
  </servers>

  <!-- mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   |
   | It works like this: a POM may declare a repository to use in resolving certain artifacts.
   | However, this repository may have problems with heavy traffic at times, so people have mirrored
   | it to several places.
   |
   | That repository definition will have a unique id, so we can create a mirror reference for that
   | repository, to be used as an alternate download site. The mirror site will be the preferred
   | server for that repository.
   |-->
  <mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
	 
	<!-- 阿里云镜像地址 -->
    <mirror>
	  <id>aliyunmaven</id>
	  <mirrorOf>*</mirrorOf>
	  <name>阿里云公共仓库</name>
	  <url>https://maven.aliyun.com/repository/public</url> <!-- 阿里云仓库地址 -->
	  <!-- <url>https://maven.aliyun.com/nexus/content/groups/public</url> --> <!-- 阿里云仓库地址(老版) -->
	</mirror>
	
	<!-- 华为云镜像地址 -->
	<!-- <mirror>
		<id>huaweicloud</id>
		<name>mirror from maven huaweicloud</name>
		<mirrorOf>central</mirrorOf>
		<url>https://repo.huaweicloud.com/repository/maven/</url>
	</mirror> -->
	
	<!-- 中央仓库 -->
 	<mirror>
	  <id>repo</id>
	  <mirrorOf>central</mirrorOf>
	  <name>中央仓库</name>
	  <url>https://repo.maven.apache.org/maven2</url>
	</mirror>
	
	
	<!-- 中央仓库1 -->
  	<mirror>
	  <id>repo1</id>
	  <mirrorOf>central-1</mirrorOf>
	  <name>中央仓库1</name>
	  <url>https://repo1.maven.org/maven2/</url>
	</mirror>	
		
	
	
  </mirrors>

  <!-- profiles
   | This is a list of profiles which can be activated in a variety of ways, and which can modify
   | the build process. Profiles provided in the settings.xml are intended to provide local machine-
   | specific paths and repository locations which allow the build to work in the local environment.
   |
   | For example, if you have an integration testing plugin - like cactus - that needs to know where
   | your Tomcat instance is installed, you can provide a variable here such that the variable is
   | dereferenced during the build process to configure the cactus plugin.
   |
   | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
   | section of this document (settings.xml) - will be discussed later. Another way essentially
   | relies on the detection of a system property, either matching a particular value for the property,
   | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
   | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
   | Finally, the list of active profiles can be specified directly from the command line.
   |
   | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
   |       repositories, plugin repositories, and free-form properties to be used as configuration
   |       variables for plugins in the POM.
   |
   |-->
  <profiles>
    <!-- profile
     | Specifies a set of introductions to the build process, to be activated using one or more of the
     | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
     | or the command line, profiles have to have an ID that is unique.
     |
     | An encouraged best practice for profile identification is to use a consistent naming convention
     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
     | This will make it more intuitive to understand what the set of introduced profiles is attempting
     | to accomplish, particularly when you only have a list of profile id's for debug.
     |
     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
    <profile>
      <id>jdk-1.4</id>

      <activation>
        <jdk>1.4</jdk>
      </activation>

      <repositories>
        <repository>
          <id>jdk14</id>
          <name>Repository for JDK 1.4 builds</name>
          <url>http://www.myhost.com/maven/jdk14</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
    -->

    <!--
     | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
     | might hypothetically look like:
     |
     | ...
     | <plugin>
     |   <groupId>org.myco.myplugins</groupId>
     |   <artifactId>myplugin</artifactId>
     |
     |   <configuration>
     |     <tomcatLocation>${tomcatPath}</tomcatLocation>
     |   </configuration>
     | </plugin>
     | ...
     |
     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
     |       anything, you could just leave off the <value/> inside the activation-property.
     |
    <profile>
      <id>env-dev</id>

      <activation>
        <property>
          <name>target-env</name>
          <value>dev</value>
        </property>
      </activation>

      <properties>
        <tomcatPath>/path/to/tomcat/instance</tomcatPath>
      </properties>
    </profile>
    -->
  </profiles>

  <!-- activeProfiles
   | List of profiles that are active for all builds.
   |
  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
    <activeProfile>anotherAlwaysActiveProfile</activeProfile>
  </activeProfiles>
  -->
</settings>

 

2、Oracle jdbc 驱动程序配置(pom.xml)

(1)Oracle 驱动包:ojdbc8

pom.xml

		<!-- Oracle 驱动包 -->
		<dependency>
			<groupId>com.oracle.database.jdbc</groupId>
			<artifactId>ojdbc8</artifactId>
			<version>21.5.0.0</version>
			<scope>runtime</scope>
		</dependency>

(2)Oracle 字符集支持国际化:orai18n

pom.xml

		<!-- Additional library required to support Internationalization -->
		<dependency>
			<groupId>com.oracle.database.nls</groupId>
			<artifactId>orai18n</artifactId>
			<version>21.5.0.0</version>
			<scope>provided</scope>
		</dependency>

 


 

参考资料

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值