connection-string

Accessing SQL on a different port number (classic ASP connection string)

I've got an old classic ASP site that connects to a local sql server 2000 instance. We're moving the db to a new box, and the port is non standard for sql (out of my control). .NET connection strings handle the port number fine by adding it with ,1999 after the server name/IP. The classic ASP connection string isn't working with the same...

What is the connection string for odbc connections?

I've always done web apps and now I need to do a console app. I need to use both an odbc connection and a regular connection. In the past I would have used: <add name="LinkConnectionString" connectionString="Data Source=SERENITY\SQLEXPRESS;Initial Catalog=Link;Integrated Security=True" providerName="System.Data.SqlClient"/> In the w...

Sql Server 2005 only accessible in ASP.NET 1.1 when I specify protocol and port

My company is currently migrating some of their really old db's to sql server 2005. Some legacy apps have problems connecting to the new server. The connection string works in Asp.NET 2.0, probably because it assumes tcp:1433 automatically. I have to construct the connection string like this in ASP.NET 1.1 for it to work: "Server=tcp:m...

Connections will not close when using Transaction Binding=Explicit Unbind; in connection string

I´m using Transaction Binding=Explicit Unbind in the connection string as recommended here since I´m also using TransactionScope with timeout. The problem is that the connections does not seem to close after being disposed and eventually there are no more connections available in the connection pool. I got the same result when I modified...

With System.Data.SQLite how do you specify a database file in the connect string using a relative path

Wanting to deploy my project on different servers I would prefer to be able to specify a connect string using a relative path. I can't seem to get that to work and want to know if there is some trick to it...? ...

What is the best way to centralize and secure connection strings?

What is the best way to centralize and secure the connections strings used by applications? In my environment we have many internal applications. Each application requires one or more connection strings in order to access the database. We have a goal of centralizing all these connection strings (particularly SQL logins and passwords) ...

SQL Server: Modifying the "Application Name" property for auditing purposes

As we do not implement the users of our applications as users in SQL server, when the application server connects to a database each application always uses the same credentials to attach to each database. This presents an auditing problem. Using triggers, we want to store every update, insert and delete and attribute each to a particul...

What's best way to secure a database connection string?

I am writing a set of database-driven applications in PHP. These applications will run on a Linux server as its own user. Other users will likely be on the system at times, but have very controlled access. Other servers they will not have access to at all. I will also expose a limit stored procedure API to developers who need to writ...

Encrypting connection string in classic asp

Is it possible to store encrypted connection string so it can be used from server-side vbscript? Was there an equivalent of web.config in 'the good old days'? ...

Does anyone know the .net odbc driver connection string for excel 2003's xml spreadsheets?

I know this has a certain "send me teh codes" quality, but the internet has really been letting me down on this one. I have an excel file in excel 2003's xml format that I want to attach an odbc connection to. And I can't seem to find the right connection string. connectionstrings.com has let me down, and other questions here on SO (s...

Can I Add ConnectionStrings to the ConnectionStringCollection at Runtime?

Is there a way where I can add a connection string to the ConnectionStringCollection returned by the ConfigurationManager at runtime in an Asp.Net application? I have tried the following but am told that the configuration file is readonly. ConfigurationManager.ConnectionStrings.Add(new ConnectionStringSettings(params)); Is there anot...

How do I set a connection string config programatically 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 configuration is read only". ConfigurationManager.ConnectionStrings.Clear(); string connectionString = "Server=myserver;Port=8080;Database=my_...

How do I refer to APP_Data from another project

I have the following project solution: There is a ASP.NET MVC Web Application where I have a SQL database (mdf file) in the App_Data directory. There is a class library where I have some migrations from migratordotnet. In my build file I have to specify where the SQL database is so it can run the migrations. For the moment on the mig...

Open Microsoft.practices.EnterpriseLibrary database with just a connection string

I am using the Microsoft.Practices.EnterpriseLibrary Database tools and I'm having trouble creating a new database using just the connection string information. Ideally I would like to do the following: Database dbEngine = DatabaseFactory.CreateDatabase( "Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SS...

Best practices re sharing IDbConnection or connection string/factory in your .Net code

Hi guys, 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 create a database connection and propagate it throughout my application, or would it be better to just pass connection strings/fac...

How to check if connection string is valid?

i'm writing an application where user provides a conenction string manually and i'm wondering if there is any way that i could validate the connection string - i mean check if it's proper and if the database exists. ...

Point to localhost\sqlexpress using only localhost

Working on a common codebase, one developer is running SQL Server Express 2005 and the other 2 are running SQL Server 2005. Everything is working fine, but the connection strings differ. To maintain common configuration and build scripts we're looking to mask "localhost\sqlexpress" to just "localhost" like the other 2 developers. Can th...

Change connection string from class library in main application at run-time

You can change the connection string at run-time like this. You make the connection string setting available for writing as a separate property inside the MySettings class: Partial Friend NotInheritable Class MySettings Public WriteOnly Property RunTimeConnectionString() Set(ByVal value) My.Settings("MyConnectionString") = value ...

.Net PostgreSQL Connection String

I am using PostgreSQL in a project I am working on, and one of the queries is timing out. I need to increase the timeout on the database connection, but since I am using my DAO through a complex wrapper to Active Record and NHibernate, I am not able to adjust the timeout of the command object - so I am hoping you can change the timeout ...

Connection String to Local DB file is not working.

connectionString="AttachDbFilename=C:\Documents and Settings\nmartin\My Documents\PS_Upload\TimeTrack\src\TimeTracker\TimeTrack\App_Data\ASPNETDB.MDF;Integrated Security=True; User Instance=True" providerName="System.Data.SqlClient" /> This is the connection string that is provided to me from the Server Explorer for my local MDF f...