Showing posts with label vb6. Show all posts
Showing posts with label vb6. Show all posts

Sunday, March 25, 2012

Does sp_OA_Create work with .Net?

Does anyone know if a .Net DLL will work similar to a VB6 DLL using
sp_OA_Create?
TIA
JeffP...It is not supported for extended stored procedures or sp_OA procedures to ca
ll .NET code in CLR;
hosted within SQL Server's address space..
See:
http://support.microsoft.com/defaul...kb;en-us;322884
Also, below is with permission from David Browne, explaining how you can hav
e SQL Server execute CLR
code executing in its own process:
"
Short answer: Don't do it.
Calling managed code inside a stored procedure is not supported.
http://support.microsoft.com/defaul...kb;en-us;322884
At least not directly. You need some sort of unmanaged proxy to communicate
with your component running in another process.
For instance, http, or, drum roll, a COM+ Server Application.
This will cause COM+ to load an unmanaged proxy object in the SqlServer
process and will load the CLR into a COM+ surrogate process (dllhost.exe).
Which somebody here mentioned last w, and I just got around to testing.
It's all perfectly transparent to you, but you have to set up the COM+
server application.
Remember this is something different from .net remoting. With .NET remoting
you have a _managed_ proxy object in the local process, and so you load the
CLR in the local process as well as the remote process.
Anyway here's what I did:
I created this VB class
comTest.vb listing:
Imports System.Runtime.InteropServices
<ClassInterface(ClassInterfaceType.AutoDual),
ProgId("comTest.comTestClass")> _
Public Class comTest
Public Function Hello() As String
Return "hello"
End Function
End Class
build comTest.dll and registered it with
regasm /codebase comTest.dll /tlb:comTest.tlb
(complains that I haven't strong-named my assembly, which you should do.)
created an empty COM+ server application, set to run under a local
administrator account, and dragged comTest.dll into its components folder.
created an unmanaged host (vbscript will do), and invoked the component
using IDispach just like SQLServer.
test.vbs listing
Set d = CreateObject("comTest.comTestClass")
MsgBox d.Hello
Then I used the .net command line debugger cordbg.exe's 'pro' command to
list the processes hosting the CLR. And procexp.exe from
www.sysinternals.com to verify that the CLR's dll's were not loaded in my
unmanaged process. My unmanaged host did not load the CLR, although it
loaded "comsvcs.dll", and the CLR was loaded by the dllhost.exe process.
Then in sql I ran
declare @.object int
declare @.msg varchar(50)
declare @.rc int
declare @.hr int
declare @.source varchar(1000)
declare @.description varchar(1000)
exec @.rc = sp_oacreate 'comTest.comTestClass', @.object output
if @.rc <> 0
begin
EXEC @.hr = sp_OAGetErrorInfo @.object, @.source OUT, @.description OUT
print 'create failed ' + @.description
return
end
exec @.rc = sp_oamethod @.object, 'Hello', @.msg output
if @.rc <> 0
begin
EXEC @.hr = sp_OAGetErrorInfo @.object, @.source OUT, @.description OUT
print 'method failed ' + @.description
return
end
print 'return: ' + @.msg
exec @.rc = sp_oadestroy @.object
if @.rc <> 0
begin
EXEC @.hr = sp_OAGetErrorInfo @.object, @.source OUT, @.description OUT
print 'destroy failed ' + @.description
return
end
Ran fine, and still only one CLR loaded into dllhost.exe's process. So
think we can safely conclude that COM+ server applications do not violate
the prohibition against running managed code in SQLServer's process and
provide a convenient mechanism for interoperating with managed code from
TSQL.
David
"
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"JDP@.Work" <JPGMTNoSpam@.sbcglobal.net> wrote in message
news:eXAIE000FHA.2932@.TK2MSFTNGP10.phx.gbl...
> Does anyone know if a .Net DLL will work similar to a VB6 DLL using
> sp_OA_Create?
> TIA
> JeffP...
>

Wednesday, March 7, 2012

Does anyone knows what is needed in each PC for that?

Hi everyone,

I’m pursuing a fast deployment for SSIS. I mean, we’ve got ten ASP/VB6 developers which often doing some DTS stuff by mean, of course, Enterprise Manager.

Now, they’d have to handle the same but with SSIS. I don’t have very clear whether only is necessary install them SSIS component or it’d requires something else. Framework 2.0 too?

If they are building packages then they will need BIDS installed. If they want to run them on their client machines from outside BIDS then they will need SSIS installed (which is a different install option on the CD).

Framework 2.0 is required but that will be installed off the SQL Server CD automatically if it is needed (I think).

Does that answer the question?

-Jamie

|||

Hi Enric,

Please browse through "Installing SQL Server Integration Services by Using Setup " @. http://msdn2.microsoft.com/en-us/library/ms143510.aspx were they have detailed on the different components of SQL Server Install and their applications. and http://msdn2.microsoft.com/en-us/library/ms143731.aspx (has got information on "Installing Integration Services Side-By-Side with SQL Server 20000 Data Transformation Services)

.NET Framework 2.0 is a must requirement.

Thanks,
Loonysan

|||

Jamie,

Yeah, that asnwer partially my question because I don't know if is needed a license per place or not.

Loonysan,

Thanks for that link.

|||

Do you have an MSDN subscription? I think that covers you to have Developer Edition on each machine.

-Jamie

|||

yes, we have. Thanks.

something else. When people talks about 'Client Tools' for Sql Server 2005 are they talking about BIDS environment and SSIS component generally speaking?

|||

Well i guess it depends who you're asking. When I talk about client tools I mean SSMS and BIDS (which includes the SSIS Designer). I do not mean SSIS. There is a distinction here.

-Jamie

|||OK