Questions tagged [connection-string]
A string containing information necessary for connecting to a service, usually database.
connection-string
4,618
questions
640
votes
9
answers
851k
views
What is the difference between Integrated Security = True and Integrated Security = SSPI?
I have two apps that use Integrated Security. One assigns Integrated Security = true in the connection string, and the other sets Integrated Security = SSPI.
What is the difference between SSPI and ...
445
votes
22
answers
859k
views
Get connection string from App.config
var connection = ConnectionFactory.GetConnection(
ConfigurationManager.ConnectionStrings["Test"]
.ConnectionString, DataBaseProvider);
And this is my App.config:
<?xml version="1.0" ...
395
votes
10
answers
423k
views
Entity Framework Timeouts
I am getting timeouts using the Entity Framework (EF) when using a function import that takes over 30 seconds to complete. I tried the following and have not been able to resolve this issue:
I added ...
296
votes
8
answers
800k
views
How to connect to Oracle using Service Name instead of SID
I have a Java application that uses JDBC (via JPA) that was connecting to a development database using hostname, port and Oracle SID, like this:
jdbc:oracle:thin:@oracle.hostserver1.mydomain.ca:1521:...
273
votes
13
answers
462k
views
Read connection string from web.config
How can I read a connection string from a web.config file into a public class contained within a class library?
I've tried:
WebConfigurationManager
ConfigurationManager
But these classes are not ...
212
votes
5
answers
687k
views
Connection string using Windows Authentication
I am creating a website, but in the database I use windows authentication.
I know that you use this for SQL authentication
<connectionStrings>
<add name="NorthwindContex"
...
180
votes
16
answers
412k
views
How to read connection string in .NET Core?
I want to read just a connection string from a configuration file and for this add a file with the name "appsettings.json" to my project and add this content on it:
{
"ConnectionStrings": {
"...
172
votes
6
answers
187k
views
Keyword not supported: "data source" initializing Entity Framework Context
I'm initializing Entity Framework Object context, and this gives me the keyword not supported error:
metadata=res://*/MainDB.csdl|res://*/MainDB.ssdl|res://*/MainDB.msl;provider=System.Data.SqlClient;...
158
votes
4
answers
69k
views
"Server" vs "Data Source" in connection string
I'm new to SqlServer, right now I have SqlLocalDb installed to work locally. Good, but I can see two connection strings typically and both works:
Data Source=(localdb)\v11.0;Integrated Security=true;
...
130
votes
5
answers
130k
views
How should I edit an Entity Framework connection string?
I recently had to edit my app.config file to change the connection string for an Entity Framework data model (.edmx file). But I'd like to know: Is there a way to edit the EF connection string using ...
130
votes
14
answers
475k
views
What is the MySQL JDBC driver connection string?
I am new to JDBC and I am trying to make a connection to a MySQL database.
I am using Connector/J driver, but I cant find the JDBC connection string for my Class.forName() method.
126
votes
10
answers
1.1m
views
How can I set an SQL Server connection string?
I'm developing a simple C# application, and I'd like to know this: When I connect my application to SQL Server on my PC, I know the connection string (server name, password, etc.), but when I connect ...
121
votes
2
answers
39k
views
How to use pg_dump with a connection uri / url?
I can invoke psql like this:
psql postgres://...
How can I use pg_dump with a connection string in the format postgres://...?
Would be more convenient than breaking URI's into host, post, username, ...
121
votes
3
answers
125k
views
Writing a connection string when password contains special characters
I'm using SQLalchemy for a Python project, and I want to have a tidy connection string to access my database. So for example:
engine = create_engine('postgresql://user:pass@host/database')
The ...
120
votes
16
answers
470k
views
How to find SQL Server running port?
Yes I read this How to find the port for MS SQL Server 2008?
no luck.
telnet 1433
returns connection failed, so I must specify other port.
I tried to use
netstat -abn
but I don't see ...
114
votes
14
answers
434k
views
Get ConnectionString from appsettings.json instead of being hardcoded in .NET Core 2.0 App
I have the following class in NET Core2.0 App.
// required when local database does not exist or was deleted
public class ToDoContextFactory : IDesignTimeDbContextFactory<AppContext>
{
...
105
votes
3
answers
216k
views
What is the point of "Initial Catalog" in a SQL Server connection string?
Every SQL Server connection string I ever see looks something like this:
Data Source=MyLocalSqlServerInstance;Initial Catalog=My Nifty Database;
Integrated Security=SSPI;
Do I need the Initial ...
102
votes
4
answers
46k
views
What is the difference between Trusted_Connection and Integrated Security in a connection string?
I'm curious what the difference between the token "Trusted_Connection" and "Integrated Security" in SQL Server connection strings (I believe other databases/drivers don't support these). I understand ...
101
votes
15
answers
733k
views
Setting up connection string in ASP.NET to SQL SERVER
I'm trying to set up a connecting string in my web.config file (Visual Studio 2008/ASP.NET 3.5) to a local server (SQL server 2008).
In my web.config, how and where do I place the connection string?
...
101
votes
3
answers
132k
views
Escape quote in web.config connection string
I have a connection string in my web config:
<add name="MyConString" connectionString="Server=dbsrv;User ID=myDbUser;Password=somepass"word" providerName="System.Data.SqlClient" />
As you see, ...
94
votes
9
answers
176k
views
keyword not supported data source
I have an ASP.NET MVC application with the default membership database. I am accessing it by ADO.NET Entity Framework.
Now I want to move it to IIS, but several problems showed up. I had to install ...
93
votes
4
answers
119k
views
How to check if connection string is valid?
I'm writing an application where a user provides a connection string manually and I'm wondering if there is any way that I could validate the connection string - I mean check if it's correct and if ...
89
votes
13
answers
153k
views
Entity Framework change connection at runtime
I have a web API project which references my model and DAL assemblies. The user is presented with a login screen, where he can select different databases.
I build the connection string as follows:
...
89
votes
4
answers
72k
views
The connection string 'MyConnection' in the application's configuration file does not contain the required providerName attribute."
I use Entity Framework Code First,
My connection string is in a configuration file:
<connectionStrings>
<clear/>
<add name="ApplicationServices" connectionString="Data Source=...
89
votes
3
answers
272k
views
Should I set max pool size in database connection string? What happens if I don't?
This is my database connection string. I did not set max pool size until now.
public static string srConnectionString =
"server=localhost;database=mydb;uid=sa;pwd=mypw;";
So ...
83
votes
10
answers
95k
views
Array Join vs String Concat
Which method is faster?
Array Join:
var str_to_split = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z";
var myarray = str_to_split.split(",");
var output=myarray.join("");
String Concat:
...
73
votes
2
answers
117k
views
Persist Security Info Property=true and Persist Security Info Property=false
For the properties:
Persist Security Info=true
and
Persist Security Info=false
Can you tell me what is the difference between them, and if I don't put it in my connection what will happen?
...
71
votes
6
answers
100k
views
connection string for sqlserver in Docker container
I'm using Visual Studio 2017 for mac with dotnet Core and EF Core. After setting up the mssql image in Docker container , I was trying to add the connection string but throwing connection error. I ...
70
votes
8
answers
209k
views
What is the connection string for localdb for version 11
I'm trying to do the Code First Walkthrough of the entity framework ( http://blogs.msdn.com/b/adonet/archive/2011/09/28/ef-4-2-code-first-walkthrough.aspx ).
I have the latest SQL Server Express and ...
70
votes
6
answers
87k
views
How to handle special characters in the password of a Postgresql URL connection string?
Using a Postgresql URL connection string in the format of:
postgresql://user:secret@localhost
How do I handle special characters in that string (e.g., $) so that it will actually function when I ...
65
votes
18
answers
471k
views
How to fix "The ConnectionString property has not been initialized"
When I start my application I get: The ConnectionString property has not been initialized.
Web.config:
<connectionStrings>
<add name="MyDB"
connectionString="Data ...
64
votes
9
answers
67k
views
How do I set a connection string config programmatically in .net?
I'd like to set a connection string programmatically, with absolutely no change to any config files / registry keys.
I have this piece of code, but unfortunately it throws an exception with "the ...
62
votes
4
answers
71k
views
How to get database url from java.sql.Connection?
For given Connection instance how do I find out url that the Connection uses to connect the database ? Is it somewhere in Properties returned by Connection.getClientInfo() method?
If there you need ...
61
votes
5
answers
230k
views
Create a jTDS connection string
my sql server instance name is MYPC\SQLEXPRESS and I'm trying to create a jTDS connection string to connect to the database 'Blog'. Can anyone please help me accomplish that?
I'm trying to do like ...
61
votes
2
answers
46k
views
connectionStrings configSource in App.config not working
I'm trying to separate my connection string from my App.config, and as you can't do transformations like with Web.config, I thought may I could use the configSource attribute to point to another ...
60
votes
5
answers
110k
views
Possible to set default schema from connection string?
With SQL Server 2005 and 2008 is it possible to set the default schema from the connection string? It'd be a lot easier if we didn't have to manually set the schema with SQL code.
58
votes
20
answers
275k
views
System.Data.SqlClient.SqlException: Login failed for user
Working with my project in debug I have no issues. However running it in IIS I am getting this error:
System.Data.SqlClient.SqlException: Login failed for user 'domain\name-PC$'.
Stack Trace
[...
57
votes
4
answers
106k
views
Quick ways to test OLE DB Connection String
For debugging purpose I'd like to know ways to test OLE DB connection string quickly.
I've found this free software, it works on my machine, tested successfully.
Is there a even quicker way to do so,...
55
votes
2
answers
114k
views
SQL providerName in web.config
We are using ASP.NET (Framework 2) and setting database connection strings (SQL2005) in web.config.
We are currently using "providerName=SqlServer".
All our data accesses are done using System.Data....
54
votes
3
answers
11k
views
How to hide connection string, user name, pw when using source control?
I'm working on a small side-project and I'm using connection strings and also api keys and values that should not be seen or used by other people. I use a public GitHub account for source control. ...
54
votes
1
answer
260k
views
A network-related or instance-specific error occurred while establishing a connection to SQL Server [closed]
I deployed my asp.net web application on somee.com, whenever I login into this site (ipc.somee.com) it gives me a network related error like:
A network-related or instance-specific error occurred ...
53
votes
10
answers
68k
views
No connection string named 'MyApplicationEntities' could be found in the application config file
I just install EF 4.3 and trying to upgrade my project with migration. however I am getting issues with trying to execute add-migration initial to my project via Package Manager console.
It is ...
53
votes
5
answers
106k
views
Default Schema in Oracle Connection URL
I'd like to set default database schema in Oracle Connection URL
jdbc:oracle:thin:@<server>:<port1521>:<sid>
My sample SQL statement:
select monkey_name from animals.monkey
I ...
51
votes
7
answers
275k
views
Connect to SQL Server Database from PowerShell
I have looked around online for a while now and found many similar problems but for some reason I can't seem to get this working.
I am just trying to connect to a SQL server database and output the ...
50
votes
7
answers
72k
views
SQL Express connection string: mdf file location relative to application location
I am using SQL Express databases as part of a unit test project in c#. My databases is located here:
./Databases/MyUnitTestDB.mdf
I would like to use a relative path or variable in the app.config ...
50
votes
5
answers
16k
views
Azure connection string best practices
I have an application that I am just migrating to Azure. Currently I use web.config transformation to manage changing the database connecting string dev/staging/prod environments. How is it best to ...
47
votes
6
answers
46k
views
Entity Framework Core 7 connection certificate trust exception
I recently upgraded to Entity Framework Core 7 in development and I'm getting an exception:
A connection was successfully established with the server, but then an error occurred during the login ...
46
votes
1
answer
42k
views
SQL Server Connection Strings - dot(".") or "(local)" or "(localdb)"
I've recently had to install SQL Server and restore a database to 2 laptops, the first took me a couple of days to figure out, the second I'm still struggling on.
On both I was getting this error ...
45
votes
2
answers
46k
views
How do I use Web.Config transform on my connection strings?
In my current project, I have some connection strings that are valid for local development machines:
<configuration>
<connectionStrings>
<add name="ApplicationServices"
...
42
votes
8
answers
202k
views
Error: "Could Not Find Installable ISAM"
I've written some VBA code in an Excel workbook to retrieve data from an Access database in the same directory on a desktop. It works fine on my machine and several other machines running Windows XP, ...