Estou com um problema na minha conexão com o banco de dados sql server.
Usando o mysql consigo conectar normalmente, mas com sql não.
O meu código é
import java.sql.*;
public class ConnectionFactory {
public static Connection getConnection()throws SQLException
{
try
{
Class.forName("net.sourceforge.jtds.jdbc.Driver");
System.out.println("Conectando ao banco");
return DriverManager.getConnection("jdbc:jtds:sqlserver://IP/DWTBOX","login","senha");
}
catch(ClassNotFoundException erro)
{
throw new SQLException(erro.getMessage(), erro);
}
}
}
O erro que dá é esse:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.sql.SQLException: Network error IOException: Connection refused: connect
br.com.syncrobot.dibcentral.servlet.exibepacotes.service(exibepacotes.java:64)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.sql.SQLException: Network error IOException: Connection refused: connect
net.sourceforge.jtds.jdbc.ConnectionJDBC2.
net.sourceforge.jtds.jdbc.ConnectionJDBC3.
net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182)
java.sql.DriverManager.getConnection(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
br.com.syncrobot.dibcentral.connectionfactory.ConnectionFactory.getConnection(ConnectionFactory.java:17)
br.com.syncrobot.dibcentral.dao.ContatoDao.getLista(ContatoDao.java:16)
br.com.syncrobot.dibcentral.servlet.exibepacotes.service(exibepacotes.java:39)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
O driver que eu peguei é jtds-1.2.2.
Será que alguém poderia me ajudar?