# SQL Server ODBC connection string

*2011-09-19*

> ODBC connection string examples for SQL Server using either a username and password or Windows authentication with a trusted connection.

Use one of the following ODBC connection strings, depending on how you authenticate with SQL Server.

**SQL Server authentication (username and password):**

```text
Driver={SQL Server};Server=Computer\Server;Database=DatabaseName;Uid=user;Pwd=password;
```

**Windows authentication (trusted connection):**

```text
Driver={SQL Server};Server=Computer\Server;Database=DatabaseName;Trusted_Connection=yes;
```

Replace `Computer\Server` with your SQL Server host and instance name, and `DatabaseName` with the database you want to use. For SQL Server authentication, also replace `user` and `password` with your login credentials.

