Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Failed to set Database Connection

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 4107
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Melissa Goh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your SQL Server instance configured to accept TCP/IP connections? Out the box for 2005 up this is not the case.
 
Melissa Goh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Are you running a Firewall?
 
Melissa Goh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope..I'm not using firewall
 
roses are red, violets are blue. Some poems rhyme and some are a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic