miércoles, 4 de noviembre de 2015

Conectar java por jdbc a Sql Server Express 2012


Si intentas conectar java a la base de datos SQL Server Express por medio del jdbc de microsoft dice que no se puede establecer la conexión: cannot establish a connection to jdbc.

Luego de intentar varias cosas, reinicios de maquina y preguntar a varios, comencé a realizar pruebas, llegué a la conclusión que había que activar el puerto en la parte de configuración de protocolo para SQL SQLEXPRESS, que ya había tenido un problema similar y no recordaba bien. Comencé a buscar y encontre esta solución en un foro.

open SQL Server Configuration Manager -> Protocols for SQL SQLEXPRESS, select Properties of TCP/IP. In the tab IP Addresses, set the TCPPort in section IPAll to 1433.


Espero les sirva.



John wrote:My problem is the same as yours. I spent all day crawling from site to site to find the answer but the result is still the same: "The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect". Enable Name pipes, TCP/IP, change Authentication mode, change localhost to 127.0.0.1 or ., add the Instance Name to the url, change the port, enable port and Apps in the firewall... almost everything. Its horrible! But the answer for MY problem is: open SQL Server Configuration Manager -> Protocols for SQL SQLEXPRESS, select Properties of TCP/IP. In the tab IP Addresses, set the TCPPort in section IPAll to 1433. And everthing 's OK. 
Again, i would like to say: it's the answer to my problem and may be not yours. 
Thanks!

Fuente: http://www.coderanch.com/t/306316/JDBC/databases/SQLServerException-TCP-IP-connection-host



No hay comentarios: