I'm learning Java EE, and I'm trying to open a connection to my SQL Server database running on a Docker image. I obviously get the
Cannot create PoolableConnectionFactory (The TCP/IP connection to the host localhost/DB_DEMO, port 1433 has failed.
With
docker ps -a
I get 0.0.0.0:1433->1433/tcp
under "Ports" for my SQL Server image.
I know that we can use SQL Server Configuration Manager to allow TCP/IP connections, but I can't seem to find how to install it without installing the full SQL Server suite.
So, is there a way to enable TCP/IP on my SQL Server running in a Docker container? Or something I don't get in the whole "TCP/IP" thing?
EDIT [SOLVED]: I get this error with this url (Microsoft docs said 1433 is used by default if port isn't specified):
url="jdbc:sqlserver://localhost/DB_DEMO"
It worked using the {property=key} format:
url="jdbc:sqlserver://localhost;databaseName=DB_DEMO"
I've been doing too much tweeking at once while going back and forth these two formats, and my bad, I thought the problem wasn't there (I took the server/DBName format from a a documentation though). Lesson learned!
Like Mark Rotteveel replied, the TCP/IP is certainly enabled by default on the Docker image anyway.