DB2 export 使用Modified by <file-mod> 方法随笔

本文介绍如何使用DB2Export将timestamp数据导出为标准格式,解决因默认格式导致Postgre等数据库无法解析的问题,并总结了在使用Modifiedby方法过程中遇到的常见错误及解决办法。
部署运行你感兴趣的模型镜像

DB2 export 使用Modified by 方法随笔

本人在使用DB2 Export进行数据导出时,由于导出的timestamp数据的默认格式是"yyyy-mm-dd-hh.mm.ss.uuuuuu"。但是该格式的字符串无法被其他数据库如Postgre的timestamp类型解析。为了导出为标准的timestamp格式(“yyyy-mm-dd hh:mm:ss.uuuuuu‘)

格式,可以使用DB2 export 的modified by 提供的方法 timestampformat=”X“. 
      在使用该方法时,出现了以下的各种错误。现加以总结,以免走多弯路:
1. SQL3016N   在文件类型的 filetmod 参数中找到意外的关键字 关键字。
    这是由于DB2客户端的版本太低,没法使用Modified by 的功能。Modified by 功能是从DB2 8.1.4 之后开始用的,若版本太低,则不支持。故解决方法是:  升级DB2客户端版本。

2. SQL3192N   在 filetmod 中,用户指定的以字符串 字符串 开头的格式 关键字 无效。
    这是因为DB2在解析的过程中,以字符串开头必须用\转义,故对于modified by timestampformat = ”x" 中的两个双引号"",必须用\进行转义 。解决方法:modified by timestampformat =  \”x\" .

3. SQL3022N  An SQL error "-104" occurred while processing the SELECT string
     这个只有在Linux的DB2客户端操作会出现这问题。解决方法: db2 后面跟住的命令必须用双引号“”括住,如下:db2  "export to <路径下的文件名>of del modified by timestampformat=\"yyyy-mm-dd hh:mm:tt.uuuuuu\" select * from <表名> "

4. SQL3001C  An I/O error (reason = "sqlofopn -2079391743") occurred while
opening the output file.
SQL3001C  An I/O error (reason = "sqlofopn -2079391743") occurred while
opening the output file.
     以上两种错误均是在Linux下发生,主要是当前用户权限不够。故解决方法: 输入su ,输入root的密码,再输入该命令即可.

您可能感兴趣的与本文相关的镜像

Stable-Diffusion-3.5

Stable-Diffusion-3.5

图片生成
Stable-Diffusion

Stable Diffusion 3.5 (SD 3.5) 是由 Stability AI 推出的新一代文本到图像生成模型,相比 3.0 版本,它提升了图像质量、运行速度和硬件效率

<?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 https://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>3.5.4</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>edu.bw</groupId> <artifactId>springboot-data</artifactId> <version>0.0.1-SNAPSHOT</version> <name>springboot-data</name> <description>springboot-data</description> <url/> <licenses> <license/> </licenses> <developers> <developer/> </developers> <scm> <connection/> <developerConnection/> <tag/> <url/> </scm> <properties> <java.version>21</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jdbc</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>com.mysql</groupId> <artifactId>mysql-connector-j</artifactId> <version>8.0.33</version> </dependency> <!--连接池--> <!-- <dependency>--> <!-- <groupId>com.alibaba</groupId>--> <!-- <artifactId>druid</artifactId>--> <!-- <version>1.2.24</version>--> <!-- </dependency>--> <!-- druid连接池--> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.1.23</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> #连接池的配置 spring: datasource: druid: username: root password: lwf123456 url: jdbc:mysql://localhost:3306/springboot? useUnicode=true&characterEncoding=utf-8&useSSL=false driver-class-name: com.mysql.cj.jdbc.Driver initial-size: 100 max-active: 100 min-idle: 2 报错 Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception with message: Failed to determine a suitable driver class
最新发布
08-19
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值