jdbc MSSQL 2005 connection problem

I am trying to connect to a database I created with Microsoft SQL Sever Studio Management Express 2005 and I am receiving the following error:

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

I first tried connecting to the server M$ Management Express set up on my machine. Afterward, I got a test server and rebuilt the database on it and still can't connect. The server I tried to connect to has TCP/IP connections enabled.

Here is part of the code I have:

publicstaticfinal String DRIVER ="com.microsoft.sqlserver.jdbc.SQLServerDriver";

//jdbc:sqlserver://localhost:1433;databaseName=SLD;selectMethod=cursor

publicstaticfinal String DATABASE ="jdbc:sqlserver://Footprints-test:1433;databaseName=SLD;selectMethod=cursor";

public Connection getConnection(){

Connection c =null;

try{

Class.forName(DRIVER);

//DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver());

c = DriverManager.getConnection(DATABASE,"adam","liszka");

}catch (ClassNotFoundException ex){

ex.printStackTrace();

}catch (SQLException ex){

ex.printStackTrace();

}

return c;

}

publicstaticvoid main(String[] args){

test test =new test();

Connection c;

c = test.getConnection();

}

I also tried going through the runtime window and adding the database through that but I get the same error.

As a side note, I am able to connect to other databases because I was able to successfully add the Footprints main server through runtime.

I am using NetBeans IDE 5.5 and Java 1.6

[2700 byte] By [Sideina] at [2007-11-27 7:51:56]
# 1
The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connectEnable TCP/IP protocol. Also the port number for SQL Server 2005 is not 1433.Refer http://www.ftponline.com/special/sqlserver/dvohra/
dvohra09a at 2007-7-12 19:33:08 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

To quote my first post:

> I first tried connecting to the server M$ Management

> Express set up on my machine. Afterward, I got a test

> server and rebuilt the database on it and still can't

> connect. The server I tried to connect to has TCP/IP

> connections enabled.

Since the server I was trying to connect to is not connected to the internet, every possible connection was enabled including TCP/IP.

After reading most of your article, the problem was the port. Now I am getting a user name password error but that's ok because I haven't set anything up yet. I'll have to inform my boss since he insisted on port 1433.

Thank you

Sideina at 2007-7-12 19:33:08 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...