Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 2005 SQLServer2005作业-使用注册表中的连接字符串调用PLSQL过程_Sql Server 2005_Plsql_Registry_Connection String_Sql Server Job - Fatal编程技术网

Sql server 2005 SQLServer2005作业-使用注册表中的连接字符串调用PLSQL过程

Sql server 2005 SQLServer2005作业-使用注册表中的连接字符串调用PLSQL过程,sql-server-2005,plsql,registry,connection-string,sql-server-job,Sql Server 2005,Plsql,Registry,Connection String,Sql Server Job,我希望我问的是一个相当简单的问题——只是想为自己节省一些时间 我只想从SQLServer作业调用PL/SQL过程 我已经在注册表字符串中有了连接字符串,并且已经生成了过程 我不知道是否可以指定T-SQL并以某种方式获取注册表设置,但我怀疑我需要一个ActiveX脚本(如果可能的话) 有没有人手头有这个(公认非常具体的)代码片段 提前谢谢 弗罗斯蒂最终到达了那里。这在ActiveX作业下对我有效: Const HKEY_CURRENT_USER = &H80000001 Const HKE

我希望我问的是一个相当简单的问题——只是想为自己节省一些时间

我只想从SQLServer作业调用PL/SQL过程

我已经在注册表字符串中有了连接字符串,并且已经生成了过程

我不知道是否可以指定T-SQL并以某种方式获取注册表设置,但我怀疑我需要一个ActiveX脚本(如果可能的话)

有没有人手头有这个(公认非常具体的)代码片段

提前谢谢


弗罗斯蒂最终到达了那里。这在ActiveX作业下对我有效:

Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002

Dim oConnection, oRegistry, sConnectionString, sPlsqlCall, sRegistryKey, sValueName, sParam1, sParam2

' Get connection string from registry
Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
sRegistryKey = "Software\OracleConnectionString"
sValueName = "Value"
oRegistry.GetStringValue HKEY_CURRENT_USER, sRegistryKey, sValueName, sConnectionString

' Set up PLSQL query
sPlsqlCall = "my_package.my_procedure(" & sParam1 & ", " & sParam2 & ")"

' Call PLSQL
Set oConnection = CreateObject("ADODB.Connection")
oConnection.ConnectionString = sConnectionString
oConnection.Open
oConnection.Execute sPlsqlCall

oConnection.Close
Set oConnection = Nothing
Set oRegistry = Nothing

他最终到达了那里。这在ActiveX作业下对我有效:

Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002

Dim oConnection, oRegistry, sConnectionString, sPlsqlCall, sRegistryKey, sValueName, sParam1, sParam2

' Get connection string from registry
Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
sRegistryKey = "Software\OracleConnectionString"
sValueName = "Value"
oRegistry.GetStringValue HKEY_CURRENT_USER, sRegistryKey, sValueName, sConnectionString

' Set up PLSQL query
sPlsqlCall = "my_package.my_procedure(" & sParam1 & ", " & sParam2 & ")"

' Call PLSQL
Set oConnection = CreateObject("ADODB.Connection")
oConnection.ConnectionString = sConnectionString
oConnection.Open
oConnection.Execute sPlsqlCall

oConnection.Close
Set oConnection = Nothing
Set oRegistry = Nothing