dbTalk Databases Forums  

Running a DLL in the Query Analyzer

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Running a DLL in the Query Analyzer in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jim
 
Posts: n/a

Default Running a DLL in the Query Analyzer - 11-23-2007 , 08:15 AM







Hi,

I have a DLL that I want to run from the Query Analyzer. I tried the
following:

USE master;
EXEC sp_addextendedproc BLAH, '\\Other-Server\Path\To\Blah\Blah.dll'

and I get the error:

ODBC: Msg 0, Level 16, State 1
Cannot load the DLL \\Other-Server\Path\To\Blah\Blah.dll, or one of
the DLLs it references. Reason: 126(The specified module could not be
found.).

The DLL was written in Cobol. The "Other-Server" in the Path above is
the server that Cobol (and the DLL) is located on.

I looked at the dependencies for the DLL and it includes (not
surprisingly) Cobol Dll's. It should find those on the other server.

What can I do?

Thanks!





Reply With Quote
  #2  
Old   
jimshain@gmail.com
 
Posts: n/a

Default Re: Running a DLL in the Query Analyzer - 11-23-2007 , 09:15 AM







One other thing....

The DLL can be called from Visual Basic. That was installed some time
ago and works great.


On Nov 23, 9:15 am, Jim <jsh... (AT) datamann (DOT) com> wrote:
Quote:
Hi,

I have a DLL that I want to run from the Query Analyzer. I tried the
following:

USE master;
EXEC sp_addextendedproc BLAH, '\\Other-Server\Path\To\Blah\Blah.dll'

and I get the error:

ODBC: Msg 0, Level 16, State 1
Cannot load the DLL \\Other-Server\Path\To\Blah\Blah.dll, or one of
the DLLs it references. Reason: 126(The specified module could not be
found.).

The DLL was written in Cobol. The "Other-Server" in the Path above is
the server that Cobol (and the DLL) is located on.

I looked at the dependencies for the DLL and it includes (not
surprisingly) Cobol Dll's. It should find those on the other server.

What can I do?

Thanks!


Reply With Quote
  #3  
Old   
Dan Guzman
 
Posts: n/a

Default Re: Running a DLL in the Query Analyzer - 11-24-2007 , 08:52 AM



Quote:
The DLL was written in Cobol. The "Other-Server" in the Path above is
the server that Cobol (and the DLL) is located on.
Not just any DLL can run as a SQL Server extended stored procedure.
Extended stored procedures are usually written in C/C++, although I've heard
that some have been written using Delphi. See Creating Extended Stored
Procedures in the Books Online for details.

Separately, COM DLLs can be invoked using sp_OA* procs.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Jim" <jshain (AT) datamann (DOT) com> wrote

Quote:
Hi,

I have a DLL that I want to run from the Query Analyzer. I tried the
following:

USE master;
EXEC sp_addextendedproc BLAH, '\\Other-Server\Path\To\Blah\Blah.dll'

and I get the error:

ODBC: Msg 0, Level 16, State 1
Cannot load the DLL \\Other-Server\Path\To\Blah\Blah.dll, or one of
the DLLs it references. Reason: 126(The specified module could not be
found.).

The DLL was written in Cobol. The "Other-Server" in the Path above is
the server that Cobol (and the DLL) is located on.

I looked at the dependencies for the DLL and it includes (not
surprisingly) Cobol Dll's. It should find those on the other server.

What can I do?

Thanks!






Reply With Quote
  #4  
Old   
jimshain@gmail.com
 
Posts: n/a

Default Re: Running a DLL in the Query Analyzer - 11-26-2007 , 09:08 AM




Since I can call it from a VB program, do you know if I can create a
new DLL using the VB program and use that to access the needed DLL?
If not... If I can call my needed DLL from a C/C++ program, can I
create a new DLL that I could call to get at my needed DLL?

The DLL that I need to call, was bought from a different company, so I
don't have access to the code.

Thanks alot!

Jim


On Nov 24, 9:52 am, "Dan Guzman" <guzma...@nospam-
online.sbcglobal.net> wrote:
Quote:
The DLL was written in Cobol. The "Other-Server" in the Path above is
the server that Cobol (and the DLL) is located on.

Not just any DLL can run as a SQL Server extended stored procedure.
Extended stored procedures are usually written in C/C++, although I've heard
that some have been written using Delphi. See Creating Extended Stored
Procedures in the Books Online for details.

Separately, COM DLLs can be invoked using sp_OA* procs.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Jim" <jsh... (AT) datamann (DOT) com> wrote in message

news:8d9db5fa-a277-400f-9761-7886f9607c55 (AT) g21g2000hsh (DOT) googlegroups.com...





Hi,

I have a DLL that I want to run from the Query Analyzer. I tried the
following:

USE master;
EXEC sp_addextendedproc BLAH, '\\Other-Server\Path\To\Blah\Blah.dll'

and I get the error:

ODBC: Msg 0, Level 16, State 1
Cannot load the DLL \\Other-Server\Path\To\Blah\Blah.dll, or one of
the DLLs it references. Reason: 126(The specified module could not be
found.).

The DLL was written in Cobol. The "Other-Server" in the Path above is
the server that Cobol (and the DLL) is located on.

I looked at the dependencies for the DLL and it includes (not
surprisingly) Cobol Dll's. It should find those on the other server.

What can I do?

Thanks!- Hide quoted text -

- Show quoted text -


Reply With Quote
  #5  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Running a DLL in the Query Analyzer - 11-26-2007 , 04:35 PM



(jimshain (AT) gmail (DOT) com) writes:
Quote:
Since I can call it from a VB program, do you know if I can create a
new DLL using the VB program and use that to access the needed DLL?
If not... If I can call my needed DLL from a C/C++ program, can I
create a new DLL that I could call to get at my needed DLL?

The DLL that I need to call, was bought from a different company, so I
don't have access to the code.
Yes, you could write one or more extended stored procedures to access
the DLL. Or implement COM methods.

On SQL 2005, you could to a COM-interop and call it from CLR.

Whatever, it's a bit of work, and and if you have errors in your
code that causes access violation, you could crash SQL Server.

To get information about writing extended stored procedures, please
see in Books Online for details. If you have never done it before,
expect at least 50 hours of development.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
  #6  
Old   
jimshain@gmail.com
 
Posts: n/a

Default Re: Running a DLL in the Query Analyzer - 11-27-2007 , 08:17 AM




Thanks for the pointers!

Jim

On Nov 26, 5:35 pm, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote:
Quote:
(jimsh... (AT) gmail (DOT) com) writes:
Since I can call it from a VB program, do you know if I can create a
new DLL using the VB program and use that to access the needed DLL?
If not... If I can call my needed DLL from a C/C++ program, can I
create a new DLL that I could call to get at my needed DLL?

The DLL that I need to call, was bought from a different company, so I
don't have access to the code.

Yes, you could write one or more extended stored procedures to access
the DLL. Or implement COM methods.

On SQL 2005, you could to a COM-interop and call it from CLR.

Whatever, it's a bit of work, and and if you have errors in your
code that causes access violation, you could crash SQL Server.

To get information about writing extended stored procedures, please
see in Books Online for details. If you have never done it before,
expect at least 50 hours of development.

--
Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.