# MS SQLEXPRESS Driver Connection String

**URL:** <https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165>\
**Category:** Classic Servoy\
**Created:** [July 10, 2012, 1:01am UTC](https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165 "2012-07-10T01:01:36Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [July 10, 2012, 1:01am UTC](https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165/1 "2012-07-10T01:01:36Z")

</div>

Version: 6.1.0 - build 1418

Has anyone successfully connected to a Microsoft SQLEXPRESS server using the Microsoft driver (not the jtds driver)? If so, would you mind sharing the connection string?

I used Microsoft SQL Server Management Studio to verify that the TCP connection works over our network (I use the SQLEXPRESS ‘sa’ user account for this). However, I cannot connect from within Developer. Most permutations of the connection strings that I tried resulted in Developer just hanging, thereby forcing a restart. I have tried all the connections strings I could find on the forum to no avail. Nor could I find anything that explicitly states what the string is…just approximations.

I have exhausted my knowledge in this area and need some expert advice. Any help would be most appreciated!

---

<div class="post-metadata">

**Author:** ![juan.cristobo](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@juan.cristobo](https://forum.servoy.com/u/juan.cristobo)\
**Post date:** [July 10, 2012, 7:05am UTC](https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165/2 "2012-07-10T07:05:13Z")

</div>

Why do you want to use MS driver instead of jtds?

---

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [July 10, 2012, 2:31pm UTC](https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165/3 "2012-07-10T14:31:40Z")

</div>

Hi, Juan.

The jtds driver development has not kept us with changes from Microsoft (most notably, see [https://www.servoy.com/forum/viewtopic.php?f=4&t=17597](https://www.servoy.com/forum/viewtopic.php?f=4&t=17597)).

We attempted to use the Microsoft driver last January at one of our customer’s location on a full-blown MSSQL installation but could not get it to work. We ended up using the jtds driver, so we know that works. We started work on a new project and thought we would re-visit the Microsoft driver issue. Articles on the Forum suggest others have, at least, attempted to use the Microsoft driver, and we were hoping someone who succeeded could assist us.

When the Microsoft driver connection fails, Developer hangs and, if you click on Developer when in this state, the Developer screen turns a transparent white, and we have to use the Windows Task Manager to kill the process. There is nothing in the log file, so debugging becomes a guessing game.

We are still looking for that connection string.

---

<div class="post-metadata">

**Author:** ![omar](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@omar](https://forum.servoy.com/u/omar)\
**Post date:** [July 10, 2012, 2:55pm UTC](https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165/4 "2012-07-10T14:55:57Z")

</div>

I understand the datetime / datetime2 incompatibility has been solved in Servoy 6.0.x? Besides that if you do the changes on the SQL Server side and use the datetime column and synchronize the database information you slould also be able to get it working the way you want?

---

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [July 10, 2012, 4:47pm UTC](https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165/5 "2012-07-10T16:47:52Z")

</div>

Hi, Omar.

That’s exactly what we did at the customer’s installation last January…a real pain, because, at the time, we were unaware of the datetime2 incompatability, and when we imported our solution, all datetime columns were created as datetime2 columns, and jtds does not handle datetime2 structures (thus causing our solutuion to fail to run). And, you may be correct that Servoy has fixed this issue on the import.

However, we would like to take advantage of the datetime2 column structure for our current project, and jtds does not yet provide support for datetime2. That’s why we are asking if anyone has successfully used the Microsoft JDBC driver.

It’s supposed to be simple, right? Just drop the JDBC driver into the ‘drivers’ folder, set the connection string, and you’re connected. But, not in our case. We think it has something to do with the connection string nomenclature; for example, when using Studio to connect, we have to use ‘.\SQLEXPRESS’ in the path (note the period before the backslash). In the Microsoft JDBC connection string, we tried with and without the period but could not get a connection either way.

We are hoping someone can provide the proper connection string syntax.

---

<div class="post-metadata">

**Author:** ![omar](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@omar](https://forum.servoy.com/u/omar)\
**Post date:** [July 10, 2012, 8:30pm UTC](https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165/6 "2012-07-10T20:30:53Z")

</div>

I believe the connection string syntax should be:

```auto
jdbc:sqlserver://server:port;DatabaseName=dbname

```

where server can be the server name or an ip-address. The port number is most likely 1433.

---

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [July 11, 2012, 6:05pm UTC](https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165/7 "2012-07-11T18:05:40Z")

</div>

Thank you for the string format; it is nearly the same as the one Servoy displays by default:

```auto
jdbc:sqlserver://localhost:1433;DatabaseName=<database_name>;SelectMethod=cursor

```

Empirically, I did find some measure of success with the following connection string:

```auto
jdbc:sqlserver://localhost:1433;DatabaseName=SQLEXPRESS/ucsdhc_recharge;SelectMethod=cursor

```

I now get a ‘login failed’ message instead of Developer hanging (Windows 7 spinning blue ring), when using the ‘sa’ account:

Using Studio and the same ‘sa’ account and password credentials, I can log into SQLEXPRESS from any computer on our network:

Perhaps, one of the Servoy engineers could comment?

---

<div class="post-metadata">

**Author:** ![omar](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@omar](https://forum.servoy.com/u/omar)\
**Post date:** [July 11, 2012, 8:07pm UTC](https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165/8 "2012-07-11T20:07:19Z")

</div>

Hi Kim,

You should add the username and password to the connectionstring if you are using standard security:

```auto
...; user=UserName;password=Password;

```

---

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [July 11, 2012, 10:15pm UTC](https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165/9 "2012-07-11T22:15:22Z")

</div>

I tried appending the username and password to the connection string, but the connection still fails. I get one of two error messages with each connection attempt:

> Cannot set up server: Cannot open database “SQLEXPRESS/ucsdhc\_recharge” requested by the login. The login failed.

or

> Cannot set up server: Connection reset

If I blank out the username and password fields, I get a thrid error message:

> Cannot set up server: login failed for user ‘’.

EDIT: Are you certain about appending the credentials to the connection string? When I use the jtds driver to connect to SQLEXPRESS, it takes the username and password from the fields and not the connection string.

---

<div class="post-metadata">

**Author:** ![juan.cristobo](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@juan.cristobo](https://forum.servoy.com/u/juan.cristobo)\
**Post date:** [July 12, 2012, 7:39am UTC](https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165/10 "2012-07-12T07:39:37Z")

</div>

Try this:

```auto
jdbc:sqlserver://localhost:1433;DatabaseName=ucsdhc_recharge;instanceName=SQLEXPRESS;SelectMethod=cursor

```

---

<div class="post-metadata">

**Author:** ![lvostinar](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/lvostinar/32/5248_2.png) [@lvostinar](https://forum.servoy.com/u/lvostinar)\
**Post date:** [July 12, 2012, 8:49am UTC](https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165/11 "2012-07-12T08:49:14Z")

</div>

> kwpsd:  
> Version: 6.1.0 - build 1418
> 
> Has anyone successfully connected to a Microsoft SQLEXPRESS server using the Microsoft driver (not the jtds driver)? If so, would you mind sharing the connection string?
> 
> I used Microsoft SQL Server Management Studio to verify that the TCP connection works over our network (I use the SQLEXPRESS ‘sa’ user account for this). However, I cannot connect from within Developer. Most permutations of the connection strings that I tried resulted in Developer just hanging, thereby forcing a restart. I have tried all the connections strings I could find on the forum to no avail. Nor could I find anything that explicitly states what the string is…just approximations.
> 
> I have exhausted my knowledge in this area and need some expert advice. Any help would be most appreciated!

My connection string (from servoy.properties) is:

server.0.URL=jdbc:sqlserver://localhost\SQLEXPRESS:1433;DatabaseName=cloud;SelectMethod=cursor

---

<div class="post-metadata">

**Author:** ![omar](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@omar](https://forum.servoy.com/u/omar)\
**Post date:** [July 12, 2012, 8:53am UTC](https://forum.servoy.com/t/ms-sqlexpress-driver-connection-string/16165/12 "2012-07-12T08:53:51Z")

</div>

I got it to work with SQL Server 2012 using the following connection string (translated to your situation):

```auto
jdbc:sqlserver://tcp:KIM-VAIO\SQLEXPRESS;DatabaseName=ucsdhc_recharge;SelectMethod=cursor;

```

I don’t see why the connection to SQL Server 2012 should be any different from SQLEXPRESS. I trust you have enabled standard security in the server properties?

I downloaded the JDBC SQL driver from Microsoft.
