Connect to MSSQL Database with instance

Hi, i try connect to MSSQL server with instance.
How write right the connection ?

Thanks

You have to pass the instance name in a connection parameter.
In the current version of Studio (2.0), you should do the following:

  1. On the Project Properties page add the “instance” parameter to the database name after semicolon, e.g. “mydb;instance=myinstance”. The database name field is the last field on the Database URL row.
  2. Open build.gradle in a text editor and add the following lines to the createDb task definition:

masterUrl = "jdbc:jtds:sqlserver://192.168.0.1/master;instance=myinstance"
dropDbSql = "drop database mytest;"
createDbSql = "create database mytest;"

So the task should look like:


task createDb(dependsOn: assembleDbScripts, description: 'Creates local database', type: CubaDbCreation) {
    dbms = 'mssql'
    host = 'localhost'
    dbName = 'mytest;instance=myinstance'
    dbUser = 'sa'
    dbPassword = 'saPass1'
    masterUrl = "jdbc:jtds:sqlserver://192.168.0.1/master;instance=myinstance"
    dropDbSql = "drop database mytest;"
    createDbSql = "create database mytest;"
}

The next version of Studio (2.1) will support connection parameters explicitly, so no changes in build.gradle will be needed.

Thanks you :slight_smile: