Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. CONNECTING MSSQL DB FILE FROM PEN DRIVE

CONNECTING MSSQL DB FILE FROM PEN DRIVE

Scheduled Pinned Locked Moved Database
databasesql-serverhelpsysadminsecurity
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    r_mohd
    wrote on last edited by
    #1

    Hi all, I am trying to connect db file from a pen drive. it is fine when using on my local machine. But giving following error when trying it on my client machine. i am using vs2008 and mssql express 2008. Mssql express 2008 also installed on my client's machine. Type of application: Window application. Error:Failed to generate a user instance of sql server due to a failure in startng the process for the user instance. the connection will be closed. i have deleted mssqlexpress folder form the location: C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\ and restarted machine, but still getting the same error. Connection string: " Data Source='" & (SqlServerName) & "';AttachDbFilename=" & driveName & "dbfolder\dbname2.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" if i remove the "User Instance=True" from the above connection string it gives me following error: "Create database permission denied in dataase 'master' an attempt to attach an auto named database for file failed. A database with the same name exists, or specified file cannot be opened, or it is located on usc share." Kindly help me. Thanks

    rmshah Developer

    L J 2 Replies Last reply
    0
    • R r_mohd

      Hi all, I am trying to connect db file from a pen drive. it is fine when using on my local machine. But giving following error when trying it on my client machine. i am using vs2008 and mssql express 2008. Mssql express 2008 also installed on my client's machine. Type of application: Window application. Error:Failed to generate a user instance of sql server due to a failure in startng the process for the user instance. the connection will be closed. i have deleted mssqlexpress folder form the location: C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\ and restarted machine, but still getting the same error. Connection string: " Data Source='" & (SqlServerName) & "';AttachDbFilename=" & driveName & "dbfolder\dbname2.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" if i remove the "User Instance=True" from the above connection string it gives me following error: "Create database permission denied in dataase 'master' an attempt to attach an auto named database for file failed. A database with the same name exists, or specified file cannot be opened, or it is located on usc share." Kindly help me. Thanks

      rmshah Developer

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      r_mohd wrote:

      if i remove the "User Instance=True" from the above connection string it gives me following error:

      Do you need a user-instance, or not?

      Microsoft SQL Server 2005 Express Edition (SQL Server Express) supports a new feature, the user instance, which is only available when using the .NET Framework Data Provider for SQL Server (SqlClient). A user instance is a separate instance of the SQL Server Express Database Engine that is generated by a parent instance. User instances allow users who are not administrators on their local computers to attach and connect to SQL Server Express databases. Each instance runs under the security context of the individual user, on a one-instance-per-user basis.

      I assume that Sql Express or Sql Server is installed on the machine? Can you post the stacktrace of the exception?

      Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

      1 Reply Last reply
      0
      • R r_mohd

        Hi all, I am trying to connect db file from a pen drive. it is fine when using on my local machine. But giving following error when trying it on my client machine. i am using vs2008 and mssql express 2008. Mssql express 2008 also installed on my client's machine. Type of application: Window application. Error:Failed to generate a user instance of sql server due to a failure in startng the process for the user instance. the connection will be closed. i have deleted mssqlexpress folder form the location: C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\ and restarted machine, but still getting the same error. Connection string: " Data Source='" & (SqlServerName) & "';AttachDbFilename=" & driveName & "dbfolder\dbname2.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" if i remove the "User Instance=True" from the above connection string it gives me following error: "Create database permission denied in dataase 'master' an attempt to attach an auto named database for file failed. A database with the same name exists, or specified file cannot be opened, or it is located on usc share." Kindly help me. Thanks

        rmshah Developer

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #3

        r_mohd wrote:

        I am trying to connect db file from a pen drive.

        That needs more explanation. You have at least the following parts 1. MS SQL Server 2. The location of the MS SQL Server files. 3. The Visual Studio application. Is the above list a COMPLETE list of everything that you are attempting to run? From the above list what EXACTLY is on the pen drive? From the above list what EXACTLY is NOT on the pen drive?

        r_mohd wrote:

        i have deleted mssqlexpress folder form the location:

        As stated that is just flat out wrong. You can't just delete that directory. If SQL Server can't see the database then nothing you do in Visual Studio is going to fix that.

        r_mohd wrote:

        Connection string: " Data Source='" & (SqlServerName) & "';AttachDbFilename=" & driveName & "dbfolder\dbname2.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"

        Certainly looks like a back slash is missing to me.

        R 1 Reply Last reply
        0
        • J jschell

          r_mohd wrote:

          I am trying to connect db file from a pen drive.

          That needs more explanation. You have at least the following parts 1. MS SQL Server 2. The location of the MS SQL Server files. 3. The Visual Studio application. Is the above list a COMPLETE list of everything that you are attempting to run? From the above list what EXACTLY is on the pen drive? From the above list what EXACTLY is NOT on the pen drive?

          r_mohd wrote:

          i have deleted mssqlexpress folder form the location:

          As stated that is just flat out wrong. You can't just delete that directory. If SQL Server can't see the database then nothing you do in Visual Studio is going to fix that.

          r_mohd wrote:

          Connection string: " Data Source='" & (SqlServerName) & "';AttachDbFilename=" & driveName & "dbfolder\dbname2.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"

          Certainly looks like a back slash is missing to me.

          R Offline
          R Offline
          r_mohd
          wrote on last edited by
          #4

          Thanks jschell, MS SQL Server is installed on client's machine. The location of the MS SQL Server files. it on client's machine(C drive) and data file and log file lying on pen drive. The Visual Studio application is lying on client's machine(c drive). The connection string is fine as it works on my machine. i am using a pen drive for data file and log file. Thanks again.

          rmshah Developer

          J 1 Reply Last reply
          0
          • R r_mohd

            Thanks jschell, MS SQL Server is installed on client's machine. The location of the MS SQL Server files. it on client's machine(C drive) and data file and log file lying on pen drive. The Visual Studio application is lying on client's machine(c drive). The connection string is fine as it works on my machine. i am using a pen drive for data file and log file. Thanks again.

            rmshah Developer

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #5

            r_mohd wrote:

            and data file and log file lying on pen drive.

            And you can go into SQL Server Management Studio and create a database using that drive? On your box? Notice that has nothing to do with your application. It is just a test to insure that SQL server accepts that.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups