Do you have a connection string I can use to connect to the local MSSQL database?
Posted by Arvand Sabetian (Import) on 19 May 2009 05:13 AM
|
|
Yes. Please use the following connection string and fill in the necessary spots with your database's information: In some instances, the "Data Source" will need to have the Instance Name after it(\sqlexpress), such as this: <add name="strConn" connectionString="Data Source=localhost\sqlexpress;Initial Catalog=DBNAME;Integrated Security=false;User ID=DBUSERNAME;Password=DBPASSWORD" />
| |
|
please specify more support including fewer examples how we can connect to the database and how to confugure config file.
"Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed."
Description: "An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code."
Exception Details: "System.Data.SqlClient.SqlException: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed."
Source Error:
"An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below."
Regards
http://www.arpanet.ms
RESPONSE: The errors you are getting point at the fact that our connection string is not being used. You are trying to start a fully separate instance of MSSQL. Please contact our support to gain assistance.
In VS2010:
ServerName = the catalog and other info is from the db you set up on the server.
In Web.config: (only a space between attribs)
<connectionStrings>
<add name="myConnName"
connectionString="Data Source="bamboo.arvixe.com ";Initial Catalog=myDB;User ID=myID;Password=myPASWORD"
providerName="System.Data.SqlClient"/>
</connectionStrings>
For Membership Providers you can have something like:
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="myConnName"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="8"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
applicationName="/" />
</providers>
</membership>
For Role Provider:
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="myConnName" applicationName="/" />
</providers>
</profile>
<roleManager enabled="true">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="myConnName"
applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider"
type="System.Web.Security.WindowsTokenRoleProvider"
applicationName="/" />
</providers>
</roleManager>
for example, this connection string:
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=false;AttachDBFilename=|DataDirectory|aspnetdb.mdf;" providerName="System.Data.SqlClient"/>
drops this error:
Login failed for user ''.
please, i beg you to tell me WHICH CONNECTION STRING SHOULD I USE TO ACHIEVE THIS!!!!!
All this guy wants is default membership feature. to do that needs to have an access "aspnet" database that contains all information about ASP.NET applications services. To achieve that:
1) create a new DB for him and run aspnet_regsql.exe on it (aspnet_regsql.exe -S DBServerName -U DBLogin -P DBPassword -A all -d DBName); This will create all tables and sp. Then give him the connection string;
2) Option 2 give him access to exsisting "aspnet" db and give him the connection string;
Ariel Ferro
-use code provide by Themingware with connection string that points to that new created DB by Arvand
For getting the connection string, it is super easy. Just create a new data connection through server explorer in Visual Studio and connect to your db using the same credentials as you do through SSMS. Then, right click on your data connection and select properties. The connection string is right there, just copy and paste it into your web.config (obviously replacing the **** for password with your actual password)
Inga is correct about #1, but the successful approach I used was to do it on my local machine, use SQL Server Management Studio to back up the database, upload the backup to my website, and restore it using the Restore from the Control Panel. I struggled with the connection string (quite a bit of time because I was misspelling arvixe), but finally got it working following Themingware's advice. Thanks to Arvand, Themingware, and Inga. Arvixe is the greatest!!!
I'm running asp.net 4.0, aspnetdb.mdf membership db.
I tried this but did not work -
Conn="Provider=SQLOLEDB; Data source=websitename; UID=db_username; PWD=db_password; database=database_name;"
use Provider name "SQLNCLI10" instead of "SQLOLEDB"
<add name="ProductEntities" connectionString="metadata=res://*/Models.ProductDataModel.csdl|res://*/Models.ProductDataModel.ssdl|res://*/Models.ProductDataModel.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\Products.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
I tried substituting the data source:
<add name="ProductEntities" connectionString="metadata=res://*/Models.ProductDataModel.csdl|res://*/Models.ProductDataModel.ssdl|res://*/Models.ProductDataModel.msl;provider=System.Data.SqlClient;provider connection string="data source=MyDomain.com.strawberry.arvixe.com;attachdbfilename=|DataDirectory|\Products.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
I am not sure what the connection string needs to be for Entity Framework and MVC 3 on Arvixe.
Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.
[EntityException: The underlying provider failed on Open.]
http://icontoo.com.strawberry.arvixe.com/ click on Products or Categories
<add name="ProductEntities" connectionString="metadata=res://*/Models.ProductDataModel.csdl|res://*/Models.ProductDataModel.ssdl|res://*/Models.ProductDataModel.msl;provider=System.Data.SqlClient;provider connection string="data source=localhost\SQLEXPRESS;Initial Catalog=Products;integrated security=true;User ID=myDBusername;Password=myDBuserpassword;user instance=True;multipleactiveresultsets=False;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="PalMateOnlineEntities" connectionString="metadata=res://*/Models.PalMateOnline.csdl|res://*/Models.PalMateOnline.ssdl|res://*/Models.PalMateOnline.msl;provider=System.Data.SqlClient;provider connection string="data source=localhost\SQLEXPRESS;initial catalog=DBNAME;Integrated Security=false;User ID=USER;Password=PASSWORD;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
Good luck!
I believe some of the solutions above is good but did not help me much.
Here is the string that I am using and works good. Perhaps it can help others to.
<add name="TestDB.MySettings.ConnectionString" connectionString="Provider=SQLOLEDB;Data Source=focus1968.com,1433;persist Security=False;Initial Catalog=DBName;User ID=MyUser;Password=password"
providerName="System.Data.OleDb" />
I'v add ,1433 (sqlport) to my domain name and change from Integrated Security=false to persist security=false.
<add name="DataContext" connectionString="Data Source=windflower.arvixe.com,1433;Initial Catalog=DBNAME;Persist Security Info=false;Integrated Security=false;User ID=ForJandS;Password=password" providerName="System.Data.SqlClient"/>
Note: I did have tons of issues at first using Entity Framework, because there were DB permission issues...The issue was on the creation of the tables...make sure when viewing the table it says dbo.TableName and not user.TableName.
If you right click in MS SQL management studio and add a table, it will be created as user.TableName!!! and this causes all kinds of issues with entity framework and stored procedures.
IE: CREATE TABLE [dbo].[TableName] vs CREATE TABLE [USER].[TableName].... that was the difference!
e.g. nettle.arvixe.com,1433
System.Data.SqlClient.SqlException: Cannot open database "TestDB" requested by the login. The login failed.
Login failed for user 'TestUser'.
I am using the same connection string as Arvand suggested:
Data Source=localhost\sqlexpress;Initial Catalog=TestDB;Integrated Security=false;User ID=TestUser;Password=password
Can there be some kind of security setting for my DB that I could change in the control panel? Or any other advice?
Some points that might be related to the problem: when I am trying to connect to the DB through SSMS, I get to the point where I see the list of databases, but when I want to access my DB, I get a message The database is not accessible.
Also, I created a .bak file for my DB, but could not Restore it in control panel. I had to call the support, FTP the file and they restored it for me.
My site is built in VS2010. I disabled firewall for now.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
<connectionStrings>
<add name="WhimsicalFurnishingEntities"
connectionString="metadata=res://*/App_Code.WhimsicalFurnishingModel.csdl|res://*/App_Code.WhimsicalFurnishingModel.ssdl|res://*/App_Code.WhimsicalFurnishingModel.msl;
provider=System.Data.SqlClient;
provider connection string=
'data source=localhost\sqlexpress;
Initial Catalog=DB;
integrated security=True;
User ID=USERNAME;
Password=PASS;
Connection Timeout=60
user instance=True;
multipleactiveresultsets=True;
App=EntityFramework'"
providerName="System.Data.EntityClient" />
<add name="WhimsicalFurnishingConnectionString" connectionString="Data Source=localhost\sqlexpress;Initial Catalog=DBNAME;Integrated Security=true;User ID=USERNAME;Password=PASS;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
I get the following error:
Unable to find the requested .Net Framework Data Provider. It may not be installed.
Data Source=localhost\sqlexpress;Initial Catalog=vp1;Integrated Security=false;User ID=userid;Password=password
I'm trying to install nopCommerce 2.5. and this seems to create the database, but not allow me access. I get the following error:
Setup failed: System.Exception: Database does not exist or you don't have permissions to connect to it at Nop.Web.Controllers.InstallController.Index(InstallModel model)
The database does exist--its there in all its glory. I just can't get the credentials to work it seems. Were talking MVC 3.0 and ASP.Net 4.0.
Any other options?
"We're sorry, an internal error occurred that prevents the request to complete.
Our supporting staff has been notified with this error and will address this issue shortly. We profusely apologize for the inconvenience and for any damage this may cause. You might want to try the same action at later time."
Connection string now looks like this:
DataProvider: .\sqlexpress
DataConnectionString: Data Source=localhost;Initial Catalog=vp1;Integrated Security=false;User ID=userid;Password=password
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - No such host is known.)
My string is:
<add name="myConnectionString" connectionString="Data Source=codeparallel.arvixe.com,1433;Initial Catalog=MYDB;Integrated Security=false;User ID=MYUSERID;Password=MYUSERPWD" providerName="System.Data.SqlClient" />
So frustrated, working on this since yesterday. Please tell me where I am wrong...???????
<connectionStrings>
<clear/>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=serverName.arvixe.com;Initial Catalog=DBname;User ID=yourUsername;Password=yourPassword;" providerName="System.Data.SqlClient"/>
</connectionStrings>
Arvixe already has a setting for Dedicated Application Pool in the control panel. If I understand its function correctly, then every website will have a unique application pool. It is possible then to add the IISAPPPOOL\POOL_NAME to the database logins. This would securely give your website access to the database without ever storing a password in plaintext
on my localhost
<add name="strConn" connectionString="Data Source=localhost\SQLEXPRESS_2008;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True; Catalog=ASPNETDB.MDF;User Instance=True" providerName="System.Data.SqlClient" />
I uploaded my *.MDF & *.ldf files using websitepanel
someone for support told me that I don't need a .bak file he said that I have to create the db from the website panel then he attached this to the DB but it is not working Please help to solve this issue.
I have been trying since a long time to upload my db to the SQL server 2008 hosting, but I can't do it. UI have tried to make a .bak and then restore it to the server and I am still facing problem to restore it.
I guess the web.com fig hacve nothing to do with the upload of the .bak file to the server. But what am I supposed to do before I Upload my .bak to the server?
<add name="YourConnectionString" connectionString="Data Source=servername.arvixe.com;Initial Catalog=YourDatabse;User ID=YourUserID;Password=YourPassword"
providerName="System.Data.SqlClient" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings> Under Package/Publish SQL Settings which is under My Projects, you can click on Import from Web.config to upload the source database connection string. In the Connection String for destination Database you can use the connection string in the web config.release file. Under Package/Publish Web settings, select "include only files needed to run this application" and choose exclude App_Data folder. Click on the Project tab in the menu bar and select Build Deployment package. Then click on the build tab on the menu bar and Select Publish "Your Website". For the publish method select FTP and the target location is ftp://ftp.yourdomainname.com. Select passive mode and enter your User name and password for your domain. Then click Publish.
For SQL Server 2012, in my code I wrote:
set con = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
connection = "Provider=SQLOLEDB;Data Source=localhost;UID=uid;PWD=pwd;database=yourDBid"
con.ConnectionString = connect
https://support.arvixe.com/index.php?/Knowledgebase/Article/View/75/11/how-to-connect-to-a-ms-access-database-from-an-asp-script
I m using this connection string.
<connectionStrings>
<add name="constr" connectionString="Data Source=shubhanshu00.db.11294331.hostedresource.com; Initial Catalog=shubhanshu00; User ID=shubhanshu00; Password=******" providerName="system.data.sqlclient"/>
</connectionStrings>
pls help me sir.... It is very urgent...
thank you sir
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<Server=violet.arvixe.com;Database=elogin;User Id=elogin;Password=123456;>
</Server>
</connectionStrings>
<system.web>
<authentication mode="Forms" />
<authorization>
<allow roles="Administrators" />
</authorization>
<roleManager enabled="true" />
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
</system.web>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Server=199.48.254.186;Initial Catalog=filesseaddatabase;User ID=*******;Password=******
this connection string not work....
Error:-
Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.
Thanks. Just email my account in helping me.
<add name="YOURDBContext" connectionString="Data Source=YOUR SERVERNAME;Initial Catalog=DATABASENAME;User Id=YOUR DATABASE USER; Password=XXXXXX;Integrated Security=False" providerName="System.Data.SqlClient" />
connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\bin\Debug\DB.mdf;Integrated Security=True;Connect Timeout=30"
providerName="System.Data.SqlClient" />
but after deployment its not work plz help in solving the problem. thanks
- I was able to create a new user, but whenever I tried to access my database, I was getting the error: "An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax.\r\nParameter name: connectionString"
- For some reason, using 2 connection strings fixed it. The role provider, profile provider, and membership provider all reference a connection string that is in this format: <add name="ConnectionName" connectionString="data source=yourservername.arvixe.com;initial catalog=yourdbname;user id=yourusername;password=yourpassword;Integrated Security=False" providerName="System.Data.SqlClient" />
- Then, whenever creating an entity context in a controller, this string is passed through as a parameter (note: this is just a slight modification to the auto-generated string): <add name="AnotherConnectionString" connectionString="metadata=res://*/yourdatabase.csdl|res://*/yourdatabase.ssdl|res://*/yourdatabase.msl;provider=System.Data.SqlClient;provider connection string='data source=yourservername.arvixe.com; initial catalog=yourdatabase;user id=yourusername;password=yourpassword;Integrated Security=False'" providerName="System.Data.EntityClient" />
And I haven't had an issue since. If anyone could let me know why this even works I'd appreciate it. But, it appears to work for both debugging locally and publishing.
You basically have to take a backup of the local database, and then modify the profile providers as follows:
<providers>
<clear/>
<add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="DefaultConnection" applicationName="/" />
</providers>
Basically the same thing as the other forms, however you need to take a backup of your local database and restore it to the remote database. Otherwise the functions and stuff will not transfer to the remote database. I'll be writing a quick guide on this a bit later.
Thanks,
EBrown
My connection string
<connectionStrings>
<add name="MyContext" connectionString="Data Source=crawfoot.arvixe.com;Initial Catalog=BumperMedic;User ID=myUserId;Password=MyPassword" providerName="System.Data.SqlClient" />
</connectionStrings>
My Error:
{"An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct."}
Inner:{"The provider did not return a ProviderManifestToken string."}
{"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"}
{"The network path was not found"}
Please help.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)