I am running my database locally in Microsoft SQL Server on Linux for Docker Engine I can successfully connect to it using mssql-cli -U username -P password -d dbname however I am struggling to connect to it using SchemaSpy e.g.
$ java -jar schemaspy-6.0.0.jar -t mssql -u username -p password -o . -host localhost -port 1433 -db dbname
INFO - Started Main in 1.183 seconds (JVM running for 1.556)
INFO - Configuration file not found
INFO - Starting schema analysis
INFO - Failed to validate png renderer ':cairo'. Reverting to default renderer for png.
WARN - Connection Failure
Any idea what I can do to fix the Connection Failure?
I started SQL server with this:
I'd check that you've given your Docker Desktop enough RAM. When I first started SQL Server with Docker configured for < 2GB RAM, the container started, but I couldn't connect, when I looked in the logs:
(sqlserver is the name of the exited Docker container)
I saw:
Once I'd updated my Docker Desktop to have 2GB of RAM again (I'd dropped it to 1GB a while ago), it came up fine.
One that was up, I could use
nmap localhost -p 1433to validate that the port was open.I then checked that SQL Server was up-and-running by starting an interactive shell on the running container:
Inside the interactive shell I could use
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P BadPassword1to access the SQL server shell. In the mssql shell you have to type what you want, then inputGOon its own line to execute everything you've entered.So, to list the dbs:
To list the tables:
I then created a DB and a table to run SchemaSpy against:
Then, I ran the parameters you listed on SchemaSpy and it didn't work for me either.
Once I'd used the -debug flag, I saw that the
mssqlsetting wasn't enough:So, I downloaded the JDBC driver from https://www.microsoft.com/en-us/download/details.aspx?id=57782 and unarchived it in the same folder as my other scripts.
I was then able to work out the right combination of parameters based on the docs:
The dp flag links to the JAR file within the Microsoft SQL Server JDBC driver.
After that, it worked perfectly.