views:

623

answers:

2

Hey all,

I just installed SQL Server 2005 on my machine and now I am trying to connect to it via SQuirrel SQL, but I am unfortunately running into problems.

When installing SQL Server 2005 I chose mixed mode for authentication and I have set up a new user account with which I am trying to connect. I also have installed the Microsoft SQL Server JDBC Driver and I have successfully used SQuirrel SQL to connect to a remote server before.

Currently I am trying to connect to my database by specifying

jdbc:sqlserver://localhost:1433

for the URL and selecting Microsoft SQL Server JDBC Driver.

After entering my username and password I am getting the following error:

test: The TCP/IP connection to the host  has failed. 
java.net.ConnectException: Connection refused: connect

with the following stack trace:

com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host  has failed. java.net.ConnectException: Connection refused: connect
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
    at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:133)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.execute(OpenConnectionCommand.java:97)
    at net.sourceforge.squirrel_sql.client.mainframe.action.ConnectToAliasCommand$SheetHandler.run(ConnectToAliasCommand.java:279)
    at net.sourceforge.squirrel_sql.fw.util.TaskExecuter.run(TaskExecuter.java:82)
    at java.lang.Thread.run(Unknown Source)

One last thing, I have checked to make sure TCP/IP connections and named pipes are enabled in the SQL Server Configuration Manager.

If anyone has any thoughts on my problem I would be very grateful to hear them.

+2  A: 

Run the surface area configuration tool from:

Start > All Programs > Microsoft SQL Server 2005 > Contifuration Tools > Sql Server Surface Area Configuration

Click on S**urface Area Configuration for Services and Connections** link.

In next window click on Remote Connections item under the server you want to configure. now on right hand side chose 'Local and remote connections' and then select 'Using both TCP/IP and named pipes'.

Hope this solves your problem.

EDIT: You may check these articles at microsoft.

TheVillageIdiot
Thanks for the quick reply. I did what you suggested and also followed all the steps on the page you linked, but unfortunately I am still having the same problem.
BordrGuy108
A: 

So after doing some more research, it turns out that my sql server was not listening to the correct port. For anyone else having this problem I recommend reading the following web page which was very useful:

http://www.databasejournal.com/features/mssql/article.php/3689846/Using-Non-Standard-Port-for-SQL-Server.htm

Basically you need to configure your server to always listen on a certain port (I chose 1433) and restart your server. After that it should work like a charm.

BordrGuy108