Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
Sign in
Sign up
Fetch the repository succeeded.
Open Source
>
Database Related
>
DB Development Package
&&
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
41
Star
102
Fork
131
openGauss
/
openGauss-connector-jdbc
Code
Issues
56
Pull Requests
4
Wiki
Insights
Pipelines
Service
JavaDoc
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
【测试类型:工具功能】jdbc调用自定义函数,out参数和return值对numeric类型的0,返回结果不一致
Done
#I7JDF9
Bug
DarkAthena
Opened this issue
2023-07-07 12:06
<!-- #请根据issue的类型在标题左侧下拉框中选择对应的选项(需求、缺陷或咨询等)--> <!-- #请按照如下模板填写详细的信息以供分析和定位 --> 【标题描述】: 【测试类型:SQL功能/存储功能/接口功能/工具功能/性能/并发/压力长稳/故障注入/安全/资料/编码规范】【测试版本:2.0.0】 jdbc调用自定义函数,out参数和return值对numeric类型的0,返回结果不一致 【操作系统和硬件信息】(查询命令: cat /etc/system-release, uname -a): 【测试环境】(单机/1主x备x级联备): 【被测功能】: 【测试类型】: 【数据库版本】(查询命令: gaussdb -V): 【预置条件】:数据库正常运行 alter database postgres set behavior_compat_options ='proc_outparam_override'; 【操作步骤】(请填写详细的操作步骤): ```java import java.sql.*; public class callSP_type3 { static final String driverName = "org.opengauss.Driver"; static final String urlString = "jdbc:opengauss://192.168.163.185:20000/postgres?batchMode=off"; static final String userName = "xxxx"; static final String password = "xxxx@123"; /** * @param args * @throws Exception */ public static void main(String[] args) throws SQLException { Connection conn = null; CallableStatement pstmt_callSP = null; String strCallSP = "{? = call fn_ty_in_ty_out3(?)}"; try { Class.forName(driverName); conn = DriverManager.getConnection(urlString, userName, password); //conn.setAutoCommit(false); Statement stmt = null; stmt = conn.createStatement(); stmt.execute("create or replace FUNCTION fn_ty_in_ty_out3(o_code out numeric) return numeric is begin o_code := 0; return o_code; end;"); pstmt_callSP = conn.prepareCall(strCallSP); { pstmt_callSP.registerOutParameter(1, Types.NUMERIC); pstmt_callSP.registerOutParameter(2, Types.NUMERIC); } pstmt_callSP.execute(); System.out.println(pstmt_callSP.getObject(1)); System.out.println(pstmt_callSP.getObject(2)); pstmt_callSP.close(); conn.close(); } catch (Exception e) { e.printStackTrace(); if(null != conn) { try { conn.rollback(); conn.close(); conn=null; }catch (Exception e_close) { e_close.printStackTrace(); } } } } } ``` 【预期输出】: 0 0 【实际输出】: 0 0E-107 【原因分析】: 【日志信息】(请附上日志文件、截图、coredump信息):   【测试代码】:
<!-- #请根据issue的类型在标题左侧下拉框中选择对应的选项(需求、缺陷或咨询等)--> <!-- #请按照如下模板填写详细的信息以供分析和定位 --> 【标题描述】: 【测试类型:SQL功能/存储功能/接口功能/工具功能/性能/并发/压力长稳/故障注入/安全/资料/编码规范】【测试版本:2.0.0】 jdbc调用自定义函数,out参数和return值对numeric类型的0,返回结果不一致 【操作系统和硬件信息】(查询命令: cat /etc/system-release, uname -a): 【测试环境】(单机/1主x备x级联备): 【被测功能】: 【测试类型】: 【数据库版本】(查询命令: gaussdb -V): 【预置条件】:数据库正常运行 alter database postgres set behavior_compat_options ='proc_outparam_override'; 【操作步骤】(请填写详细的操作步骤): ```java import java.sql.*; public class callSP_type3 { static final String driverName = "org.opengauss.Driver"; static final String urlString = "jdbc:opengauss://192.168.163.185:20000/postgres?batchMode=off"; static final String userName = "xxxx"; static final String password = "xxxx@123"; /** * @param args * @throws Exception */ public static void main(String[] args) throws SQLException { Connection conn = null; CallableStatement pstmt_callSP = null; String strCallSP = "{? = call fn_ty_in_ty_out3(?)}"; try { Class.forName(driverName); conn = DriverManager.getConnection(urlString, userName, password); //conn.setAutoCommit(false); Statement stmt = null; stmt = conn.createStatement(); stmt.execute("create or replace FUNCTION fn_ty_in_ty_out3(o_code out numeric) return numeric is begin o_code := 0; return o_code; end;"); pstmt_callSP = conn.prepareCall(strCallSP); { pstmt_callSP.registerOutParameter(1, Types.NUMERIC); pstmt_callSP.registerOutParameter(2, Types.NUMERIC); } pstmt_callSP.execute(); System.out.println(pstmt_callSP.getObject(1)); System.out.println(pstmt_callSP.getObject(2)); pstmt_callSP.close(); conn.close(); } catch (Exception e) { e.printStackTrace(); if(null != conn) { try { conn.rollback(); conn.close(); conn=null; }catch (Exception e_close) { e_close.printStackTrace(); } } } } } ``` 【预期输出】: 0 0 【实际输出】: 0 0E-107 【原因分析】: 【日志信息】(请附上日志文件、截图、coredump信息):   【测试代码】:
Comments (
2
)
Sign in
to comment
Status
Done
Backlog
Confirmed
已答复
Canceled
挂起
Fixing
Done
待回归
测试中
Accepted
Assignees
Not set
Labels
sig/connectors
Not set
Projects
Unprojected
Unprojected
Milestones
No related milestones
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
Branches (12)
Tags (20)
master
6.0.0
5.0.0
7.0.0-RC1
3.0.0
5.1.0
2.0.0
3.1.0
2.1.0
1.1.0
1.0.1
1.0.0
v6.0.1
v6.0.0
v5.0.3
v5.0.2
v6.0.0-RC1
v5.0.1-RC1
v5.0.1
v5.1.0
v3.0.5
v5.0.0
v3.0.3
v3.1.1
v3.1.0
v3.0.1
v3.0.0
v2.1.0
v2.0.0
1.1.0
1.0.1
1.0.0
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
Duration
(hours)
参与者(1)
Java
1
https://gitee.com/opengauss/openGauss-connector-jdbc.git
git@gitee.com:opengauss/openGauss-connector-jdbc.git
opengauss
openGauss-connector-jdbc
openGauss-connector-jdbc
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register