File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't connect to SQL server 2005

 
James Lee
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I used MS SQL server 2005 and tried to connect to it but failed. The error happened in making the connection. Can anyone give a hand?

JDBC code

Error:
[BOLD]db:com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect[/BOLD].

When I installed the SQL server, I chose default so no username/password are needed. The server is on my local computer. I also copied the driver jar to TOMCAT's lib folder and the classpath.

Many thanks.
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the server configured to allow TCP/IP connections?
 
James Lee
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,

I have not done any configurations so everything is by default. Could you tell me where it should be done?

Many thanks.
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can find these settings under Configuration Tools | SQL Server Configuration Manager in the SQL Server start menu folder.
 
Arvind Mahendra
Ranch Hand
Posts: 1162
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
go to SQLServer manager ,click on sqlserver 2005 network configuration, double click on 'protocol for <yourservername>', right click on TCP/IP choose properties, on the protocol tab choose enabled to Yes and on the IP address tab make sure its on port 1433.
 
Shawn Stark
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes set all your settings for your IP Address and stuff properly then from
ODBC data source administrator in adminastrative tools, select the system DSN tab. SQL server is at the bottom of my list. After that select you type your server name now your driver will be detected
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic