none
CREATE ASSEMBLY failed because it could not open the physical file (The device is not ready.).

    Question

  • I have a simple class libarray that I have compiled into DLL using csc.exe

    Source code is as follows: -

     

    using System;

    using System.Collections.Generic;

    using System.Text;

    using System.IO;

    using Microsoft.SqlServer.Server;

     

    namespace RTFTextParser

    {

    public class ParseText

    {

    [SqlFunction(DataAccess = DataAccessKind.None)]

    public static String ParseRTFText()

    {

    return "Imtiaz";

    }

    }

    }

    When I try to run the following

    CREATE ASSEMBLY RTFTextParser FROM 'E:\Class1.dll'

     I get the following error

    Msg 6501, Level 16, State 7, Line 1

    CREATE ASSEMBLY failed because it could not open the physical file 'E:\Class1.dll': 21(The device is not ready.).

     

    Friday, March 23, 2007 1:59 AM

All replies

  • Hmm, a couple of questions:
    1. I assume you have an E: drive?
    2. Is the SQL Server and the E: drive on the same machine?
    3. If not, does the machine that SQL run on have that parricular drive mapping?
    4. Does the SQL Server have access to the E: drive, i.e permissions?

    Niels
    Friday, March 23, 2007 7:11 AM
    Moderator
  • Hi,

    one more question:

    by uploading the assembly - using a file path -, the current user must be a Windows authenticated login or a member of the sysadmin fixed server role.

    ...

    USE <DBName>

    GO

     

    CREATE ASSEMBLY [RTFTextParser]

    AUTHORIZATION [dbo]

    FROM 'E:\class1.dll'

    WITH PERMISSION_SET = SAFE

    GO

    Friday, March 23, 2007 7:22 AM
  • Hi
    when I executed following SQL statement

    alter

     

     

     

     


    DevASSEMBLY AuditUtil
    AUTHORIZATION
    [amrs\dsingh1]
    FROM
    'C:\SMIBLD\Checkout\ML.SMI.UMA\AuditUtil\AuditUtil\bin\AuditUtil.dll'
    WITH
    PERMISSION_SET = SAFE
    GO

    I got following errors-

    Msg 156, Level 15, State 1, Line 4
    Incorrect syntax near the keyword 'AUTHORIZATION'.
    Msg 319, Level 15, State 1, Line 8
    Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
    Please advice.
    Tuesday, January 05, 2010 4:27 PM
  • The ALTER ASSEMBLY statement does not allow the AUTHORIZATION clause. See (http://msdn.microsoft.com/en-us/library/ms186711.aspx).

    Also, if this is your actual DDL, "alter DevAssembly....." won't work.

    Cheers,
    Bob Beauchemin
    SQLskills

    Tuesday, January 05, 2010 6:32 PM
    Moderator
  • when I tried following statement I got the errror-

    1)
     alter
     ASSEMBLY AuditUtil
     FROM 'C:\SMIBLD\Checkout\ML.SMI.UMA\AuditUtil\AuditUtil\bin\AuditUtil.dll'
     WITH PERMISSION_SET = SAFE
     GO

     (Permission_set is safe for exiting assembly)

     Error-
     Msg 15151, Level 16, State 1, Line 1
     Cannot alter the assembly 'AuditUtil', because it does not exist or you do not have permission.

    2)
     alter
     ASSEMBLY AuditUtil
     FROM '\\MySyatemName\bin\AuditUtil.dll'
     GO
      Msg 6501, Level 16, State 7, Line 1
      ALTER ASSEMBLY failed because it could not open the physical file "\\MySyatemName\bin\AuditUtil.dll": 5(Access is denied.).


    If this is the issue of permission ,what all necessary permission I might needed to have?

    Please advice.

    Dev
    • Edited by Dev_1 Wednesday, January 06, 2010 8:11 AM
    Wednesday, January 06, 2010 7:41 AM
  • 1. Can you validate that the assembly exists by executing (in the same database where you tried ALTER ASSEMBLY):
         select * from sys.assemblies;

    Is your assembly present in the database? If not, you can't alter it.

    2. File not found is a fairly straightforward error. Can you validate that the file is present at the location you specify on the machine where SQL Server is running? And that you have permission to access it?

    Cheers,
    Bob
    • Proposed as answer by Dev_1 Wednesday, January 06, 2010 12:59 PM
    Wednesday, January 06, 2010 8:10 AM
    Moderator
  • re. 1 ,you were right, assemblies were not in that server.

        2 .file path is my local system location, does it needs to be the locaiton somewhere in system where sql server is running?
          can't I give the locaiton of my system local path ...e.g. C:\apps\bin...
    Dev
    Wednesday, January 06, 2010 11:07 AM
  • WRT #2...

    You need to give CREATE ASSEMBLY the location of a file SQL Server has access to because CREATE ASSEMBLY is running within the server. You can use a UNC name with CREATE ASSEMBLY if it's pointing to a spot that the server (or the person who's running CREATE ASSEMBLY, depending on which SQL Server principal you use) has access to. The UNC location must be "network visible" from the server machine as well. Usually it's easier to just move the DDL onto the server.

    You can also create an assembly from a stream of bits, which is what VS autodeploy does.

    Cheers,
    Bob

    • Proposed as answer by Dev_1 Thursday, January 07, 2010 8:05 AM
    Wednesday, January 06, 2010 7:22 PM
    Moderator
  • This answer is not clear to me... Please explain...

    I have logged into SQL Server with NT authentication, which as access to the file (as I am logged in Windows User also)..


    It would be great if could explain in simple steps to give authorization or verify it.

     

    thanks


    HydPhani
    Wednesday, January 11, 2012 10:30 AM
  • i think that you work from one pc and your sql server is install in other pc.

    your file most is copy in sql server pc.


    be sure that this file E:\Class1.dll exist in sql server pc.
    Wednesday, May 22, 2013 6:14 AM