jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes Failed to set Database Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Failed to set Database Connection" Watch "Failed to set Database Connection" New topic
Author

Failed to set Database Connection

Melissa Goh
Greenhorn

Joined: May 21, 2009
Posts: 4
The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect

Hi, I've got the above error message when I was trying to set my database connection in JDeveloper, a jsp editor.

What I did what this:-

jdbc:sqlserver://myIPAdd:1433;SelectMethod=cursor;DatabaseName=Z_Test

What I've done:-
- Since when I ran my jsp page during (performed without setting database connection) testing and saw that the address bar displayed "http://myIPAdd:8988/untitled1.jsp", I changed my port in sqlserver to 8988 and I still get the error so I change back.

- Tried to connect to a database from another IP address, it was successful.

Can anyone tell where is my mistake?

P/S I hope I'm in the right category of this forum.

-
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

Melissa Goh wrote:Since when I ran my jsp page during (performed without setting database connection) testing and saw that the address bar displayed "http://myIPAdd:8988/untitled1.jsp", I changed my port in sqlserver to 8988 and I still get the error so I change back.


That 8988 port is HTTP port use to connect to your Application/Web server. SQL Server port is different which your configuaration for the database must be using.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Melissa Goh
Greenhorn

Joined: May 21, 2009
Posts: 4
Vijitha Kumara wrote:That 8988 port is HTTP port use to connect to your Application/Web server. SQL Server port is different which your configuaration for the database must be using.


Okay..I changed back my sqlserver port to 1433 and still can't set the connection.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Is your SQL Server instance configured to accept TCP/IP connections? Out the box for 2005 up this is not the case.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Melissa Goh
Greenhorn

Joined: May 21, 2009
Posts: 4
Paul Sturrock wrote:Is your SQL Server instance configured to accept TCP/IP connections? Out the box for 2005 up this is not the case.


I'm using SQL Server 2000. I've checked in Server Network Utility, my TCP/IP is enabled. Is this what you mean?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Yes. Are you running a Firewall?
Melissa Goh
Greenhorn

Joined: May 21, 2009
Posts: 4
Nope..I'm not using firewall
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Failed to set Database Connection
 
Similar Threads
Problem with localhost
Just installed MS SQL Server 5 Express. JDBC connection failing
Error with servlets in runtime
Alert Message in B&S
TCP/IP connection to the host has failed