Using this connection string
jdbc:sqlserver://localhost\\SQLEXPRESS:1433;database=mydb;user=username;password=psw
I am getting the following error that I cannot figure out how to solve it:
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.
I looked at the registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\<Instance Name>\MSSQLServer\SuperSocketNetLib\Tcp
, the port is set, and the firewall is disabled, the instance is running and the user does have master default access privilege!, So what was wrong?
jdbc:sqlserver://localhost;instanceName=SQLEXPRESS;database=mydb;user=username;password=psw'
– Ja9ad335hcom.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "mydb" requested by the login. The login failed
. – TiyebMmydb
exists? with given username and password permissions? – Ja9ad335hsa
with its password it works, I don't know what was wrong then?! – TiyebMsa
on this db?, please put an answer for this whole problem now, @JAG, thanks. – TiyebM