我正在使用sql server 2008 r2 sql express。 我通常连接到我的SQL是这样的: 无法连接jdbc到sql server 2008 r2
现在我想从我的eclipse连接到sql server 2008 r2。
我搜索谷歌,我发现我必须下载一个jar文件,我做了,我把它添加到我的项目在日食。
我的代码是
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl = "jdbc:sqlserver://localhost:1433;"
+ "databaseName=DATABASE;user=User-PC\\User;password=;";
说实话:我不知道我是否应该把localhost
或sqlexpress
,我不知道密码,因为我要你的图像或我只是用它是空的。
的例外是:
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.".
我在SQL配置启用TCP/IP
请帮我
您使用的是root用户? – 2013-04-28 07:01:47
yes,................ – 2013-04-28 07:12:29
'我读过根用户不能在JDBC中使用,所以首先你必须创建一个新的'Login'在你的sql server中,然后创建新的'User'。之后,请尝试再次连接并告诉我发生了什么。 – 2013-04-28 07:14:12