I am using sql server 2008 r2 sql express. I usually connect to my sql like this:
Now I want to connect to sql server 2008 r2 from my eclipse.
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.
my code is
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl = "jdbc:sqlserver://localhost:1433;"
+ "databaseName=DATABASE;user=User-PC\\User;password=;";
To be honest: I don't know if i should put localhost
or sqlexpress
and I don't know the password because as I should you in the image or I just use it empty.
the exception is :
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.".
I enable TCP/IP in my sql configuration
please help me