Tsohost Knowledge Base

Windows .Net Connection Strings

Modified Friday 22nd May, 2015 at 12:24

Was this helpful?

Connection Strings

Very rarely will you ever have to construct a connection string from scratch for a user on our systems. Most often, you will be taking their existing connection string, and simply modifying it to match the details of the database on our system. So you’d usually just update the server hostname (for example, from localhost -> 10.168.1.53), the username, database name, password. Here’s an example of what that would look like:-

 

Connecting to an MS SQL server

 

<add key="strConnection" value="server=10.168.1.xx;Initial Catalog=database_name;User Id=database_user;Password=password;"/>

 

Server - The server hostname you’re connecting to. This is the IP of the MS SQL server.

Initial Catalog - This is another name for the database name

User Id - The database username

Password - The database password



Connecting to a MySQL Server

There can be a few different versions of MySQL connection strings because there are different Windows ‘drivers’ that allow a .Net application to connect to MySQL. Essentially, they are still basically the same and it’s just a case of updating the relevant details to match our system

 

Driver={MySQL ODBC 5.1 Driver};Server=myServerAddress;Database=myDataBase;

User=myUsername;Password=myPassword;Option=3;

 

Driver - the database driver used to connect to MySQL

Server - the server hostname/IP address

Database - the database name

User - the username

Password - the password

 

Access Databases

Using an Access database is not recommended on the cloud hosting. Because of our network storage system, performance can be poor so where possible we would encourage that if you have a developer to convert your database to MS SQL. If you don’t have a developer, then you can continue to use Access. Access performance is much better on a virtual server, but still, Access databases aren’t very scalable for web applications.

 

Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\PDC1\sites\y\yoursite.com\myDatabase.mdb;

Still can't find what you're looking for?

That's not a problem. Our 24/7 customer support team are friendly and waiting to help answer your questions. The easiest way to get in touch is to raise a support ticket; simply click the button below.

Open Support Ticket