如何使用ShellCommandActivity(AWS数据管道)中的数据管道在SQL Server中调用存储过程 [英] How do I call a stored procedure in SQL Server with Data Pipeline in ShellCommandActivity (AWS Data Pipeline)

查看:192
本文介绍了如何使用ShellCommandActivity(AWS数据管道)中的数据管道在SQL Server中调用存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道您可以使用下面的脚本调用MySQL过程,但是对于SQL Server来说可能是相同的吗?

I know you can call a MySQL procedure with the script below, but is the same possible for SQL Server?

mysql --host host_url --port port_number --user username --password password --execute="CALL stored_proc_name;

我有SQL Server Express,需要设置一个每天运行的过程.它在RDS上,并且SQL Server Express没有任务计划程序.

I have SQL Server Express, and need to setup a procedure to be run daily. It's on RDS, and SQL Server Express doesn't have a task scheduler..

推荐答案

以下方法应该起作用:

  • 下载SQL Server JDBC驱动程序.选择下载tar.gz文件并解压缩.在提取的文件中,应有一个名为sqljdbc.jar的文件.将此上传到S3.出于许可原因,AWS无法分发此文件.
  • 创建数据管道 JdbcDatabase 对象引用您的SQL数据库.将jdbcDriverJarUri设置为您的S3位置.将驱动程序类名称设置为"com.microsoft.sqlserver.jdbc.SQLServerDriver".
  • 从数据管道SqlActivity调用EXEC命令. SqlActivity将引用您已定义的JdbcDatabase对象.
  • Download the SQL Server JDBC Driver. Choose to download the tar.gz file and unzip it. Among the extracted files should be file named sqljdbc.jar. Upload this to S3. For licensing reasons, AWS is not able to distribute this file.
  • Create a Data Pipeline JdbcDatabase object to refer to your SQL database. Set the jdbcDriverJarUri to your S3 location. Set the driver class name to "com.microsoft.sqlserver.jdbc.SQLServerDriver".
  • Invoke the EXEC command from a Data Pipeline SqlActivity. The SqlActivity will refer to the JdbcDatabase object that you've defined.

这篇关于如何使用ShellCommandActivity(AWS数据管道)中的数据管道在SQL Server中调用存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆