Questions tagged [connection-string]
A string containing information necessary for connecting to a service, usually database.
connection-string
4,618
questions
22
votes
1
answer
19k
views
Change Application Name in Sql Server Profiler
When profiling a .Net Application in SQL Server Profiler the default Application Name is taken from the Data Provider. How can I change this to my own Application Name?
22
votes
2
answers
12k
views
What is the correct format for Running Entity Framework migrate.exe tool without a Web/App.config?
We recently switched to Entity Framework data migrations and I am working on some build automation scripts for our MVC app. I can successfully run the migrations from our build server using the ...
21
votes
1
answer
35k
views
The entry has already been added
All my Razors views have this error:
The pre-application start initialization method Start on type WebMatrix.WebData.PreApplicationStartCode threw an exception with the following error message:
The ...
21
votes
20
answers
151k
views
How to fix error ::Format of the initialization string does not conform to specification starting at index 0::
I uploaded my site on godaddy shared host. I can access this database from my management studio. I can't access this database from my site. I get following error:
Format of the initialization ...
21
votes
2
answers
23k
views
Configuration.GetConnectionString returns null when running asp.net core on VS Code but fine on Visual Studio
Here is my appsettings.json file
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=db;User ID=postgres;Password=root"
},
"Logging": {
"IncludeScopes": ...
21
votes
8
answers
81k
views
Format of the initialization string does not conform to specification starting at index 0
I have an ASP.Net MVC application which runs fine on my local development machine. But when deployed to IIS7 gives the following error when trying to log in:
Format of the initialization string ...
21
votes
4
answers
5k
views
.Net Encryption
What I would like to know is the definite approach to encrypting connection strings in a config file. Here are my questions:
Using machine-level encryption, can't anybody accessing my server write a ...
21
votes
2
answers
7k
views
Encrypt and deploy app.config
I read and tested a lot to find the best practice to encrypt and deploy an app.config to different machines. In general, I would like to secure the content of the connection string from third parties ...
20
votes
14
answers
37k
views
sql server query running slow from java
I have a java program that runs a bunch of queries against an sql server database. The first of these, which queries against a view returns about 750k records. I can run the query via sql server ...
20
votes
1
answer
30k
views
Help with a OleDB connection string for excel files
The problem i'm having is that the data adapter is looking at only the first row in each column to determine the data type. In my case the first column "SKU" is numbers for the first 500 rows then I ...
19
votes
2
answers
19k
views
unable to retrieve metadata for unrecognized element providers
I get a message error whenever I try to add a controller with Entity framework template but I keep getting a error message
unable to retrieve metadata for 'path' unrecognized element providers.
...
19
votes
3
answers
50k
views
App.config connection string relative path
I need to set in the app.config the sqlite connection string. I want to set the path relative to the debug/release folders the database file will be copied to those folders.
<add name="...
19
votes
3
answers
12k
views
Centralize connection strings for multiple projects within the same solution
I currently have three projects in my solution that all have their own App.config file with the same exact connection string.
Is there a way to consolidate the connections strings / app.config files ...
19
votes
2
answers
18k
views
Encrypting the connection string in web.config file in C#
I have written the name of my database, username and password in my web.config file as connection string.
I want to encrypt this data. How can I do it?
<connectionStrings>
<add name="...
19
votes
4
answers
9k
views
Best practices re sharing IDbConnection or connection string/factory in your .Net code
I'm wondering what would be the best prectice regarding mainataining connections to the database in .Net application (ADO.NET but I guess the practice should be the same for any data layer). Should I ...
19
votes
4
answers
57k
views
Entity Framework connection string not from config
public class Context : DbContext
{
public Context(string connString) : base(connString)
{
Database.SetInitializer(new MyContextInitializer());
}
//...
Need to pass a connection ...
19
votes
4
answers
15k
views
User Secrets in .NET 4.7 connectionstrings format
I have been digging for hours and keep coming up with information about .NET Core, yet hardly anything about .NET 4.7 full framework. I figured out how to add User Secrets to the main project of my ...
18
votes
11
answers
26k
views
SQL Server "." Alias Not Working
I've added an alias of "." which should point to my local (named) instance, ".\SQL2008". But when I try to connect to ".", it times out.
Am I missing something or is this not allowed?
Aliases I've ...
18
votes
1
answer
42k
views
Building a connection URL for mssql+pyodbc with sqlalchemy.engine.url.URL
The problem...
I am trying to connect to a MSSql server via SQLAlchemy. Here is my code with fake credentials (not my real credentials obviously).
The code...
credentials = {
'username' : '...
18
votes
4
answers
202k
views
error: the details of the application error from being viewed remotely
I have 2 login pages: Login.aspx-for customer login and xlogin.aspx for admin login
i just uploaded my project to the server and all application pages works great
but when i log in the admin xlogin....
18
votes
3
answers
10k
views
Set the application ConnectionString in the Service Configuration instead of web.config in Azure
I have an application currently in Azure and whenever we push it into the Staging segment, we cannot truly test since the connection string is pointing to the prod database.
Someone mentioned to me ...
18
votes
3
answers
32k
views
Connection String to Connect to .MDF
I've created a new project in VS2008, and added a .MDF file to the project. This is the first time I've tried to use the MDF files and .SQLEXPRESS databases (I've always used extenal Oracle servers ...
18
votes
2
answers
15k
views
How can I get a connection URL from an SQLAlchemy Engine instance?
I begin a program by generating a URL object and passing it to create_engine. In a section of code far, far away I would like to find out what this engine is connected to, i.e. the connection URL.
Is ...
18
votes
6
answers
102k
views
How to add CommandTimeout to connection string in web.config
How to add CommandTimeout to connection string in web.config?
I tried:
<add name="ConnectionString" connectionString="Data Source=;Initial Catalog=;Persist Security Info=True;User ID=sa;Password=...
18
votes
5
answers
41k
views
encrypt SQL connectionstring c#
I created an c# application (not asp webpage) which connects to a sql 2005 server. In my sourcecode the password and userid for this sql-server is coded plain text in ConnectionString.
SqlConnection ...
18
votes
1
answer
9k
views
Wait! which config file? (Entity Framework Connection String)
So, I created my entity model in a separate class library. I had to add the connection string to the app.config file of that class library. Then I added a ref for that project in my web application. I ...
18
votes
1
answer
1k
views
ODBC problems in SQL 2000 --> 2005 Upgrade
This wiki post outlines both a problem and a solution. I wanted to post this for others that may be having similar problems, as I couldn't find anything specifically to solve this problem elsewhere.
...
17
votes
4
answers
14k
views
Get Connection String in Azure Function v3
I am very confused. I want to get a connection string in an Azure v3 function (.Net Core 3.1).
My local settings looks like
{
"IsEncrypted": false,
"Values": {
&...
17
votes
8
answers
16k
views
What is the best way to store connection string in .NET DLLs?
The application my team is currently developing has a DLL that is used to perform all database access. The application can not use a trusted connection because the database is behind a firewall and ...
16
votes
5
answers
13k
views
Is there a need to secure connection string in web.config?
So I am using connection strings in my web.config using SQL authentication.
Of course people say this could be a vulnerability as you are storing password in plaintext.
However, from what I know, ...
16
votes
4
answers
62k
views
SSRS report subscriptions cannot be created
I am not able to create subscriptions for SSRS reports as it gives the following error:
Subscriptions cannot be created because the credentials used to run
the report are not stored, or if a ...
16
votes
1
answer
10k
views
ELMAH Logging in SQL Server
I am having an ELMAH problem. I think it is the connection string but can't figure out why. It is emailing me errors no problem, just not logging them into sql. If the problem is permissions, how ...
16
votes
4
answers
11k
views
Connection String Best Practices [closed]
What is the best way to manage connection strings in a web application, from a security standpoint? I've done it several different ways. I've stored them as plain text web.config setting keys. I've ...
15
votes
6
answers
55k
views
Multiple SQL Server connection strings in app.config file
I'm interested in displaying in a Windows Forms app a list of N radio buttons for the user to choose a target database server. I would like to add the SQL Server connection strings in the app.config ...
15
votes
2
answers
9k
views
Code first migrations - what connection string will it use?
Code first migrations have been working very well for me. I have a services project and a wpf project. The model is in the services project which is referenced by the wpf project. Update-database ...
15
votes
2
answers
29k
views
How to securely store Connection String details in VBA
I have an Excel Template that has hardcoded Ms Access MDB path in the VBA code used to connect to the Access tables and save, retrieve data.
I migrated the MS Access Database over to SQL Server with ...
15
votes
1
answer
9k
views
Output Azure SQL Database ConnectionString after template deployment
I have an ARM template that (among others) creates a database on an Azure SQL server (which is also created by the template).
I need to output the database ADO.NET connectionstring.
Becuase I wasn't ...
15
votes
1
answer
21k
views
Force the TCP/IP protocol in connection string
I have a database driven website written in asp.net. I'd like to modify the connection string to force protocol TCP. Please advise.
<add name="TESTConnectionString"
connectionString=...
15
votes
2
answers
27k
views
Entity Framework: "ProviderName" in connection string required- all of the sudden?
We've been using Entity framework in a production environment for many months now, and just yesterday started to get errors on some machines when querying the database using our subclass of DbContext:
...
15
votes
1
answer
13k
views
What's the Option=N in the MySQL ODBC connection string?
I have seen both Option=3 and Option=4 in connection string samples for MySQL ODBC but no explanation or documentation. What do those numbers mean?
15
votes
3
answers
26k
views
ASP.NET connection string metadata syntax
I'm new to ASP.NET-ville, be gentle.
I have been troubleshooting a ASP.NET setup, where the server/database values are changing, therefore web.config needs to be updated.
There are multiple <add ...
15
votes
3
answers
15k
views
the best way to connect sql server (Windows authentication vs SQL Server authentication) for asp.net app
I have a database and a site having forms authentication. It is working fine with VS2008. This time, I am using "Trusted_connection =True". But when it is opened from outside or directly from browser ...
14
votes
2
answers
77k
views
Oracle connection string without tnsnames.ora file
I am using the .NET framework with the System.Data.OracleClient namespace. I have the oracle 11 client installed on my computer. I do not want to use the tnsnames.ora file to store connection ...
14
votes
1
answer
9k
views
Multipleactiveresultsets in Entity Framework 4.1 Code First
This is my first EF project so bear with me please.
When updating an entity such as Department, you pull it from the context, update its values and call context.SaveChanges. However, if you update ...
14
votes
2
answers
7k
views
How to get provider specific ConnectionString from Entity Framework
using ado.net tipically we need to define a connectionstring to create a sqlconnection object, and if we use the entity framework, we have to dedine a connectionstring too.
is threre any way to get ...
14
votes
9
answers
22k
views
Managing A Debug and Release Connection String
What is a good approach to managing a debug and release connection string in a .NET / SQLServer application?
I have two SQL Servers, a production and a build/debug and I need a method of switching ...
14
votes
8
answers
40k
views
error occurred while establishing a connection to SQL Server
If I have my connection string in the web.config like this (added line feeds for better readability):
<add
name="conn"
connectionString="Data Source=(localdb)\v11.0; Initial
Catalog=MyDB; ...
14
votes
3
answers
25k
views
connection timeout property in connection string ignored
I'm building an app in C#. I'm using a connection string like:
DSN=SomeDataSource; Trusted Connection=yes; Uid=SomeId; pwd=somePwd; Connection Timeout=x
But no matter what value I set as x (...
14
votes
3
answers
26k
views
Error connecting to Data Source in SSRS
I am trying to connect to Datasource but getting this error:
An error occurred during local report processing.
An error has occurred during report processing.
Cannot create a connection to data ...
14
votes
4
answers
2k
views
How is everyone storing connectionstrings?
I was wondering if people could post their solution to the ongoing problem of local databases and different connectionstrings among many developers in one project within source control?
More ...