1

I am fairly new to liquibase and try to set it up on my own computer, running Windows 7 with a local MySQL Server. I have installed the JDBC driver (4.2), opened the TCP/IP Port 3306 on my Firewall and the Server, installed liquibase and added it as a PATH in the environment variables.

As a first command i tried using this:

C:\Users\Marius>H:\Liquibase\Liquibase \
--driver=com.microsoft.sqlserver.jdbc.SQLServerDriver \
--classpath="C:\\Program Files\\Microsoft JDBC Driver 6.2 for SQL Server\\sqljdbc_6.2\\enu\\mssql-jdbc-6.2.2.jre7.jar" \
--url="jdbc:sqlserver://localhost:3306; databaseName=Test" \
--changeLogFile="H:\Liquibase\dbchangelog.xml" \
--username=liquibase \
--password=liquibase \
Update

But when executing I only get:

Unexpected error running Liquibase: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 3306 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".

The Server is definitely running since I am able to connect to it with telnet, mySQLWorkbench and several other tools.

When running the command with --url="jdbc:sqlserver:localhost:3306; databaseName=Test", I get a different error code.

Unexpected error running Liquibase: liquibase.exception.DatabaseException: Connection could not be created to jdbc:sqlserver:localhost:3306; databaseName=Test with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Possibly the wrong driver for the given database URL

I tried this again on another computer with a SQL Server 2017, a different JDBC driver (6.0 and 6.2) and Windows 10 as the OS. Deactivating the Firewall doesn't do anything, neither does a clean install of everything.

Any help is appreciated.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Marius_N
  • 13
  • 1
  • 4
  • Check that SQL Server is actually listening on port 3306. The default port for SQL Server is 1433. Also the firewall never blocks connections to localhost. – David Browne - Microsoft Jan 10 '18 at 02:00
  • If you are using a "local MySQL server" then why are you using the JDBC driver for Microsoft SQL Server? The URL for SQL Server would be completely different (for starters SQL Server typically runs on a different port then SQL Server) –  Jan 10 '18 at 09:04
  • If you are using MySQL (as indicated by the intro and the use of port 3306, MySQL Workbench, etc), then use the MySQL Connector/J driver and the correct URL for MySQL. If you are actually using Microsoft SQL Server (as in your title and last paragraph), then use the correct port and JDBC URL for Microsoft SQL Server. – Mark Rotteveel Jan 10 '18 at 13:52

1 Answers1

0

MySQL is a different product to Microsoft SQL Server. Given you have said you can connect using MySQL workbench, this is probably the product you have installed.

Instead of trying to connect to the non-existent Microsoft SQL Server, try using a MySQL driver instead.

podiluska
  • 50,950
  • 7
  • 98
  • 104