title: Cannot connect jdbc to sql server 2008 r2
body: <p>I am using sql server 2008 r2 sql express.
  I usually connect to my sql like this:
  <img src="https://i.stack.imgur.com/k1PWH.jpg" alt="enter image description here"></p>
  
  <p>Now I want to connect to sql server 2008 r2 from my eclipse.</p>
  
  <p>I searched google and I found that I have to download a jar file and I did and I added it to my project in eclipse.</p>
  
  <p>my code is</p>
  
  <pre><code>Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
              String connectionUrl = "jdbc:sqlserver://localhost:1433;"
                      + "databaseName=DATABASE;user=User-PC\\User;password=;";
  </code></pre>
  
  <p>To be honest: I don't know if i should put <code>localhost</code> or <code>sqlexpress</code> and I don't know the password because as I should you in the image or I just use it empty.</p>
  
  <p>the exception is :</p>
  
  <pre><code>The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
  </code></pre>
  
  <p>I enable TCP/IP in my sql configuration </p>
  
  <p>please help me</p>