Advertisement

01.03.2008 at 01:45PM PST, ID: 23056978
[x]
Attachment Details

JSP and SQL Server 2005 connections, ports and accessibility

Asked by yapsing in MS SQL Server, Java Server Pages (JSP), SQL Server 2005

Tags: JSP, IE , Firefox, SQLException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect SQLState: 08S01 VendorError: 0

Hi Experts!
Please enlighten me on the following problem.

other information:
-copied sqljdbc.jar into lib
-placed Microsoft SQL Server 2005 JDBC Driver in to Program FilesStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<% 
String testd = "";
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
}
catch (Exception E)
	{
	out.println("Unable to load Driver");
	E.printStackTrace();	
	}
try{
	String Surl 	= "jdbc:sqlserver://localhost:1433";
	String Sid 		= "calo";
	String Spass 	= "";
	Connection C	= DriverManager.getConnection(Surl,Sid,Spass);
	
	Statement stmt	= C.createStatement();
	ResultSet rs	= stmt.executeQuery("select * from testTable");
  	if (rs.next()){
	testd = rs.getString("testData");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<%=testd%>
<body>
</body>
</html>
<%}
	rs.close();
	stmt.close();
	C.close();
 }catch (SQLException E){
	out.println("SQLException: " + E.getMessage());
	out.println("SQLState:     " + E.getSQLState());
	out.println("VendorError:  " + E.getErrorCode());
 }
%>
[+][-]01.03.2008 at 02:32PM PST, ID: 20577752

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.03.2008 at 08:21PM PST, ID: 20579967

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.04.2008 at 11:40AM PST, ID: 20585443

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.05.2008 at 04:41AM PST, ID: 20588963

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.05.2008 at 08:20AM PST, ID: 20589485

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, Java Server Pages (JSP), SQL Server 2005
Tags: JSP, IE , Firefox, SQLException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect SQLState: 08S01 VendorError: 0
Sign Up Now!
Solution Provided By: mrcoffee365
Participating Experts: 2
Solution Grade: A
 
 
[+][-]01.05.2008 at 09:09AM PST, ID: 20589674

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.05.2008 at 09:15AM PST, ID: 20589695

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628