zoukankan      html  css  js  c++  java
  • sql存储过程与webMethods

    今天尝试着做之前用webMethods没做出来的SQL存储过程的使用,因为本来对于数据库的存储过程也是一知半解,所以先在http://www.cnblogs.com/hoojo/archive/2011/07/19/2110862.html上学习了一下。先在sql中写好有输入输出的存储过程,典型一点好做实验。

    在webMethods中需要先做好的准备有:安装好SQL与webMehtods,在IS服务器上配置好SQL的JDBC Adapter。我用的是sql2005,将数据库连接驱动放到D:\webmethods82\IntegrationServer\packages\WmJDBCAdapter\code\jars中,对应的datasource Class 是com.microsoft.sqlserver.jdbc.SQLServerDataSource。进行简单的sql查询测试一下连接是否成功。

    1,新建一个adapter service,选择store procedure类型。

    2,call中设置所在db,所属权限,procedure的名称,返回域。

    3,parameter中设置输入输出参数。

    4,result set中如果返回的是一个结果集,那么需要设置他的index。

    5,运行了一下,没有返回值,问题出在哪里?

    问题出在存储过程没有设置输出,存储过程修改后如下:

    if (object_id('proc_VIPRecord', 'P') is not null)
    drop proc proc_VIPRecord
    go
    create proc proc_VIPRecord(
    @id varchar(20), --默认输入参数
    @name varchar(20) out --输出参数
    )
    as
    select @name = name from VIP where name = @id ;
    go

    在第三步时将parameter中的输入设为id,输出设为name,运行service之后会有结果返回到IS。

    至此,在webMethods中使用sql的存储过程尝试成功。

  • 相关阅读:
    VS密钥
    继承中delelte对象子类析构函数不被执行
    [LeetCode] Merge k Sorted Lists
    [LeetCode] Spiral Matrix II
    [LeetCode] Multiply Strings
    [LeetCode] Valid Number
    [LeetCode] Search Insert Position
    [LeetCode] Spiral Matrix
    [LeetCode] Valid Parentheses
    [LeetCode] Rotate List
  • 原文地址:https://www.cnblogs.com/bgWebMethods/p/3850654.html
Copyright © 2011-2022 走看看