# Sql Server connection string in ODBC.jl

**URL:** <https://discourse.julialang.org/t/sql-server-connection-string-in-odbc-jl/50367>\
**Category:** General Usage\
**Tags:** juliadb\
**Created:** [November 18, 2020, 9:29am UTC](https://discourse.julialang.org/t/sql-server-connection-string-in-odbc-jl/50367 "2020-11-18T09:29:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cristian\_Suciava](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cristian_suciava/32/14433_2.png) [@Cristian\_Suciava](https://discourse.julialang.org/u/Cristian_Suciava)\
**Post date:** [November 18, 2020, 9:29am UTC](https://discourse.julialang.org/t/sql-server-connection-string-in-odbc-jl/50367/1 "2020-11-18T09:29:31Z")

</div>

I use this code to connect to a Sql Server database, with no credentials   
All good!

```julia
    ODBC.adddsn("SQL_Server_DSN", "SQL Server"; SERVER="x", DATABASE ="x", Trusted_Connection="True")
	conn = DBInterface.connect(ODBC.Connection, "SQL_Server_DSN")
	cursor = DBInterface.execute(conn, "SELECT * FROM dbo.users")|> DataFrame

```

But when I try to use credentials, somehow I am not able to get how to adapt the connection string.

---

<div class="post-metadata">

**Author:** ![djholiver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djholiver/32/50470_2.png) [@djholiver](https://discourse.julialang.org/u/djholiver)\
**Post date:** [July 14, 2021, 9:02pm UTC](https://discourse.julialang.org/t/sql-server-connection-string-in-odbc-jl/50367/2 "2021-07-14T21:02:52Z")

</div>

Hi,

I found this thread whilst trying to find how to iterate over a cursor from a ODBC connection. Would you know how to do that as opposed to piping direct to a DataFrame?

also - to your original question:  
replace “Trusted\_Connection” with UID=“x”;PWD=“x”

and it should work.

taken from Connection strings website and just worked on my windows machine.

Regards,

---

<div class="post-metadata">

**Author:** ![Cristian\_Suciava](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cristian_suciava/32/14433_2.png) [@Cristian\_Suciava](https://discourse.julialang.org/u/Cristian_Suciava)\
**Post date:** [July 16, 2021, 4:45am UTC](https://discourse.julialang.org/t/sql-server-connection-string-in-odbc-jl/50367/3 "2021-07-16T04:45:39Z")

</div>

Thank you!  
I figured it back then.  
Still strange that I got no answer for such a long time…
