# How to specify username and password when connect to ODBC using kdb+

**URL:** https://forum.kx.com/t/how-to-specify-username-and-password-when-connect-to-odbc-using-kdb/6755
**Category:** Community Support
**Tags:** kdb-and-q
**Created:** [October 19, 2010, 3:24am UTC](https://forum.kx.com/t/how-to-specify-username-and-password-when-connect-to-odbc-using-kdb/6755 "2010-10-19T03:24:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bovine](https://avatars.discourse-cdn.com/v4/letter/b/e0b2c6/32.png) [@bovine](https://forum.kx.com/u/bovine)
#### Post date: [October 19, 2010, 3:24am UTC](https://forum.kx.com/t/how-to-specify-username-and-password-when-connect-to-odbc-using-kdb/6755/1 "2010-10-19T03:24:00Z")

</div>

Basically I was trying to connect to some database within kdb+following the instructions here:[https://code.kx.com/trac/wiki/Cookbook/ODBC/qclientBut](https://code.kx.com/trac/wiki/Cookbook/ODBC/qclientBut) when I doing the open or load like:q)h:.odbc.open `northwind / open northwind databaseI got an error message said:'28000 [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed foruser ‘’.The user is not associated with a trusted SQL Server connection.Anyone can tell me how to specify the username and password for thatDSN? Thanks in advance!

---

<div class="post-metadata">

### Author: ![hlivni](https://avatars.discourse-cdn.com/v4/letter/h/f4b2a3/32.png) [@hlivni](https://forum.kx.com/u/hlivni)
#### Post date: [October 20, 2010, 6:50pm UTC](https://forum.kx.com/t/how-to-specify-username-and-password-when-connect-to-odbc-using-kdb/6755/2 "2010-10-20T18:50:00Z")

</div>

I believe you have to specify a dsn or a connection stringto .odbc.openI don’t have much experience with DSNs, but if you use a connectionstring, it would look something like this:"Driver=;Database=master;port=1433;Server=\<your\_sql\_server\>;uid=;PWD="On Oct 18, 9:24?pm, bovine \<chenying…\> wrote:\> Basically I was trying to connect to some database within kdb+\> following the instructions here:[https://code.kx.com/trac/wiki/Cookbook/ODBC/qclient&gt;&gt](https://code.kx.com/trac/wiki/Cookbook/ODBC/qclient&gt;&gt); But when I doing the open or load like:\> q)h:.odbc.open `northwind ? ? ? ? ? ? ? / open northwind database\>\> I got an error message said:\> '28000 [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for\> user ‘’.\> The user is not associated with a trusted SQL Server connection.\>\> Anyone can tell me how to specify the username and password for that\> DSN? Thanks in advance!\</chenying…\>\</your\_sql\_server\>

---

<div class="post-metadata">

### Author: ![Luc2](https://avatars.discourse-cdn.com/v4/letter/l/45deac/32.png) [@Luc2](https://forum.kx.com/u/Luc2)
#### Post date: [June 25, 2012, 7:46pm UTC](https://forum.kx.com/t/how-to-specify-username-and-password-when-connect-to-odbc-using-kdb/6755/3 "2012-06-25T19:46:00Z")

</div>

Hi,

How about

h: .odbc.open “Driver={SQL Server};Server=servername;Database=dbname;Uid=user;Pwd=pass”

Name of the driver should have the right spelling.  
Drivers are usually enclosed in curly brackets.?

regards,
