D
D
Denis Kuznetsov2019-12-15 02:33:01
Java
Denis Kuznetsov, 2019-12-15 02:33:01

How to connect to ms sql server?

Hello I am having some difficulty connecting to ms sql from my spring boot application.
I downloaded and installed ms sql and management studio created a table in it and now I want to display data from it on a web page.
in the property i put this :

# ===============================
# DATABASE CONNECTION
# ============== =================
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.url=jdbc:sqlserver://localhost; databaseName=Test
spring.datasource.username=mssql
spring.datasource.password=mssql

with the data from here (I made the password the same as the login name)
5df570b863307930558612.jpeg
but when I try to run the application I get an error
com.microsoft.sqlserver.jdbc.SQLServerException: A TCP/IP connection could not be established to server localhost on port 1433. Error: "Connection refused: connect. Check connection properties.

although everything seems to be correct, what did I do wrong or what did I not do?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Tsvetkov, 2019-12-15
@DennisKingsman

Check if it is enabled and activated ( two settings) for you TCP/IP.
Find where SQLServerManager*.mscand run.
The command where SQLServerManager*.mscis the search. The default file should be in C:\Windows\System32. Must be in all editions, it is impossible to disable the installation.
5df65d6a2e645065735710.png

V
Vladimir Korotenko, 2019-12-15
@firedragon

What is the mssql account type? Windows or SQL?

jdbc:sqlserver://localhost;instanceName=SQLEXPRESS;DatabaseName=test;integratedSecurity=true

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question