ASP.NET connection string for SQL Server 2012 - asp.net

I am having some trouble with a connection string between an ASP app sat on IIS and an existing SQL Server 2012 instance.
The current connection string that works is as follows:
Data Source=SERVER1;Initial Catalog=CORE;User
ID=testuser;Password=password;
MultipleActiveResultSets=true;Connection Timeout=200;pooling=false
The ODBC driver installed is SQL Server V 6.01.7601.17514. I then added the latest driver SQL Server Native Client 11 and tried adjusting the connection string in IIS with no luck.
I tried both ODBC and OLE DB strings from connectionstrings.com.
OLEDB
Provider=SQLNCLI11;Server=SERVER1;Database=CORE;Uid=testuser;Pwd=password;
ODBC
Driver={SQL Server Native Client 11.0};Server=SERVER1;Database=CORE;Uid=testuser;Pwd=password;
Each time I get a login prompt which I don't understand why the connection string is failing to supply these details with? What am I missing here?
Just having a look though some of the similar questions, some mentions named pipes which is enabled...

The first connection string is valid for the Net Framework Data Provider (the SqlClient classes), while the others are for the OleDb provider or ODBC provider.
Of course you should use the connection string that your provider understand.
If, in your code, you use the SqlClient classes (SqlConnection, SqlCommand) then you need to use the first connection string, if you use OleDbConnection or ODBCConnection you should use the others
See connectionstrings.com

I've always done it this way:
Data Source=;Initial Catalog=;UID=;PWD=;
I also recommend you put the connection string in a config file for easy editing like this: http://www.connectionstrings.com/Articles/Show/store-connection-string-in-web-config

Related

What is the Data Source syntax SQL Client Connection String to Azure?

I am attempting to configure the connection string in web.confg for an ASP.NET app to connect to Azure DB. I am new to this but am familiar with sql configuration strings to SQL Server. How do I configure the login and data source in the connection string I am building. I haven't ever dealt with the cloud like this. If my db name is DB1 how do I set the Azure path for the data source portion of the connection string. NOTE: I know where to configure it in web.config and know to create a connection object.
Thanks.
In the Azure portal, you can navigate to your database's dashboard and click 'Show connection strings' on the right side. See the first screenshot on the below tutorial:
http://azure.microsoft.com/en-us/documentation/articles/sql-database-dotnet-how-to-use/
To answer your original question, "Data Source" means the same as "Server", it is just your server name, i.e. blah.database.windows.net. All of the connection string keywords (including their synonyms) are documented here: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring%28v=vs.110%29.aspx

Connecting with dsn

I have an application written in Classic ASP and VBScript. First it was developed for SQL Server 2000; I have upgraded this to SQL Server 2008. Previously I only need to define the DSN in the page like so:
DSN=""DSN="rrrr",UID="gggg"
But after upgrading to SQL Server 2008 it is not working. I need to define password attribute for this. (like this?)
DSN="DSN="rrrr",UID="gggg,PWD=xxxx""
Do we need to provide a password attribute or am I missing something?
You have quite a few different options to change your connection string to work with SQL Server 2008. If you are setting Trusted_Connection to true, then the password argument isn't used. You might have set up a 2008 INSTANCE, in which case, you need to use Server\Instance. It might be that simple.
From ConnectionStrings.com:
Standard Security
Server=myServerAddress;Database=myDataBase;User Id=myUsername;
Password=myPassword;
Trusted Connection
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
Connection to a SQL Server instance
Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;
Password=myPassword;
Connect via an IP address
Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;
Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

Not able to change Connection String in SSIS DTSX package

I have 2 SSIS(DTSX) packages which is existing one made in SQL Server 2008,
Now I Have to migrate into SQL server 2012 But I am getting problem in changing connection string .
When I open in the Designer mode using SQL Server Data Tools. Previously it was pointing to another Remote Server Now I am not able to change the new server,
I am using the Provider as-Native OLEDB/Microsoft OLE DB Provider for SQL Server,
Server Name when I am giving automatically it's not coming in the dropdown list and when I check Test Connection it is giving Test Connection Succeeded but when I click Ok it is not changing?
Can anyone please help me on this to Resolve this problem
Thanks in advance
The connection might be being set by an expression. Check the expressions for that connection - you may have to change the expression that is being used to set the connection.

Cannot open database 'dbname' requested by the login. The login failed

Firstly, I know that there are a lot of similar topics, but none seem to solve my problem.
I have inherited a project where the front-end is built in ASP.NET and the CMS is built in classic ASP. I'm in the process of setting up a local development environment where I've copied the database from the live server and am configuring the website to connect to my new local DB.
The ASP.NET part is connecting with the connection string Data Source=.\\SQLEXPRESS; Database=DBNAME; Trusted_Connection=True; but I had to mess about with Application Pools and Permissions.
I'm having a problem with getting the classic ASP part of the website to connect to the SQL database. The error I am recieving is:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database "DBNAME" requested by the login. The login failed.
/cms/connections/Conn.asp, line 18
The code in that file is:
12. Dim Conn_STRING, URL, mailHost
13. Conn_STRING = "Driver={SQL Server}; Server=.\SQLEXPRESS; Database=DBNAME; Trusted_Connection=True;"
15. Dim conn
16. set conn = Server.CreateObject("ADODB.Connection")
17. conn.ConnectionString = Conn_STRING
18. conn.Open
I know it's a permission problem or some sort, but I can't get to the bottom of it. I'll appreciate any help at all :)
hmmmm, well, the asp.net part is using SQLExpress, connected via an attached file. DBNAME in the first example is going to refer to a db file name in the actual asp.net project. It's been quite a long time since I last used classic ASP, but I'd be STUNNED if it supports this. You need to attach the db file to an actual sql server and use it that way.
server=mycomputername\sqlexpress; database=DBNAME; user id=username; password=password
You'll need to open your database in sql express mngmt studio
http://www.microsoft.com/download/en/details.aspx?id=7593
Go into your security settings for that user and set the default database to "dbname" (whatver your real dbname is of course)
Ensure your app pool is set to run under the user that has permissions to that database. It may just be easier to enable mixed mode authentication and create a sql user to connect to the database rather than messing around with windows authentication on an app pool.
You wil lof course need to change your connection string then to support the sql authentication if you go that route.
http://msdn.microsoft.com/en-us/library/ms143705%28v=sql.90%29.aspx

What connection string do I use for Classic ASP and Oracle 10g?

I have Oracle 10g and have installed ODBC via the instant client. I am able to use the ODBC administrator and set up a DSN and test successfully, and whenever I use Microsoft Access I can connect to my database no problem. I can also use Visual Web Developer to traverse the data.
But, when I try and use Classic ASP with:
myConn.Open "DSN=oracle10g;" & _
"Uid=myOracleUsername;" & "Pwd=myOraclePassword"
I get:
-2147467259Specified driver could not be loaded due to system error 5 (Oracle in instantclient10_2).
An error occurred while trying to create Server Object.
I have searched various places but nothing seems to work. All ORACLE_HOME, TNSnames, IUSR_X security, all is correct. I am thinking it is a DSN connection string problem.
Anyone know?
Try using the following DSN-less connection string:
myConn.Open "Provider=MSDAORA;Data Source=instance_name;User ID=myOracleUsername;Password=myOraclePassword"
I've used this exact connection string for older version of Oracle client, but can't see any reason why it won't work for your version as well.
try this :
provider=OraOLEDB.Oracle

Resources