egorkos
17.11.2009, 04:16
Вот код:
String connectionUrl = "jdbc:sqlserver://198.162.1.4:1433;databaseName=VideoClub;";
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
// Establish the connection.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection(connectionUrl, "sa", "");
// Create and execute an SQL statement that returns some data.
String SQL = "SELECT TOP 10 * FROM Clientes.Contact";
stmt = con.createStatement();
rs = stmt.executeQuery(SQL);
// Iterate through the data in the result set and display it.
while (rs.next()) {
System.out.println(rs.getString(4) + " " + rs.getString(6));
}
}
Выдаёт такую ошибку:
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 198.162.1.4, port 1433 has failed. Error: "connect timed out. 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.".
Брандмауэр выключил вообще, в базе данных в опциях протокол ТСП/ИП включен, порт 1433 прописан. Антивирус на всяк провсяк вообще удалил. Если чё у меня подключение через роутер. Сюда(http://192.168.1.1) заходил в настройках там полазил где можно этот порт прописал. Короче вообще не знаю что ещё можно сделать, помогите кто может. Буду оч. благодарен.
ЗЫ: винда ХР, сервис пак 3.
String connectionUrl = "jdbc:sqlserver://198.162.1.4:1433;databaseName=VideoClub;";
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
// Establish the connection.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection(connectionUrl, "sa", "");
// Create and execute an SQL statement that returns some data.
String SQL = "SELECT TOP 10 * FROM Clientes.Contact";
stmt = con.createStatement();
rs = stmt.executeQuery(SQL);
// Iterate through the data in the result set and display it.
while (rs.next()) {
System.out.println(rs.getString(4) + " " + rs.getString(6));
}
}
Выдаёт такую ошибку:
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 198.162.1.4, port 1433 has failed. Error: "connect timed out. 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.".
Брандмауэр выключил вообще, в базе данных в опциях протокол ТСП/ИП включен, порт 1433 прописан. Антивирус на всяк провсяк вообще удалил. Если чё у меня подключение через роутер. Сюда(http://192.168.1.1) заходил в настройках там полазил где можно этот порт прописал. Короче вообще не знаю что ещё можно сделать, помогите кто может. Буду оч. благодарен.
ЗЫ: винда ХР, сервис пак 3.