Estou tentando acessar uma base de dados SQL Server 2008 Express [color=red]local[/color], mas não estou conseguindo… recebo o seguinte erro:
The connection to the host localhost, named instance sqlexpress/banco has failed. Error: java.net.SocketTimeoutException: Receive timed out. Please verify the server and instance names, check that no firewall is blocking UDP traffic to port 1434, and for SQL Server 2005 or later, verify that the SQL Server Browser service is running on the host.
O que já fiz?
:arrow: Criei as classes abaixo…
:arrow: Adicionei o driver sqljdbs4.jar ao CLASSPATH
:arrow: Adicionei uma exceção no firewall do Windows para as Portas TCP 1433 e UDP 1434
:arrow: Reiniciei os Serviços
:arrow: Depois até desabilitei o Firewall do Windows, mas não adiantou…
:arrow: Estou usando o usuário local, do Windows mesmo, para conexão via Management Studio. Conecto nesta ferramenta, crio Tabela, tudo direitinho!
As classes:
[code]package br.com…jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectionFactory
{
public Connection getConnection() throws SQLException
{
try
{
Class.forName(“com.microsoft.sqlserver.jdbc.SQLServerDriver”);
Connection connection = DriverManager.getConnection(“jdbc:sqlserver://localhost\sqlexpress/banco”, “usuario”, “senha”);
return connection;
} catch (ClassNotFoundException e)
{
throw new SQLException(e.getMessage());
}
}
}[/code]
[code]package br.com…jdbc;
import java.sql.Connection;
import java.sql.SQLException;
import br.com…jdbc.ConnectionFactory;
public class TConnection
{
public static void main(String[] args) throws SQLException
{
Connection connection = new ConnectionFactory().getConnection();
connection.close();
}
}[/code]
Que fazer? :roll: