title: How to fix it: com.microsoft.sqlserver.jdbc.SQLServerException?
body: <p>I want to connect to sql server express. 
  I downloaded <a href="http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&amp;id=11774" rel="nofollow">this</a> driver.
  I read the help file and this is my code:</p>
  
  <pre><code>        try 
          {
              Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
              String connectionUrl = "jdbc:sqlserver://localhost;database=ActorsDb;integratedSecurity=true;";
              Connection con = DriverManager.getConnection(connectionUrl);
              PreparedStatement st = con.prepareStatement("INSERT INTO Actors(FirstName,LastName,Age) VALUES(?,?,?)");
              st.setString(1, "Robert");
              st.setString(2, "de Niro");
              st.setInt(3,45);
              st.executeUpdate();     
              con.close();
          } 
          catch (SQLException | ClassNotFoundException e) 
          {
              e.printStackTrace();
          }   
  </code></pre>
  
  <p>I get this exception:<code>com.microsoft.sqlserver.jdbc.SQLServerException: 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></p>
  
  <p>I turned off firewall but nothing changed.</p>
  
  <ol>
  <li><p>I went to SQL Server Configuration Manager and i enabled TCP/IP</p></li>
  <li><p>I went to IP Adresses, IP1 and set the properties</p></li>
  </ol>
  
  <p>Active:Yes ;  Enabled:Yes ; TCP Dynamic Ports:[empty] ; TCP Port:1433</p>
  
  <p>Any tips of what i am missing?
  Thanks.</p>