CONNECTING MSSQL DB FILE FROM PEN DRIVE
-
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
-
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
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[^]
-
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
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_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.
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
-
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
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.