2

I am new to both (Java) FitNesse and SQL Server, I want to have a basic SQL test working with DbFit,

I have the following in root:

!path c:\fitnesse\lib\dbfit.jar
!path c:\fitnesse\lib\fitlibrary.jar
!path c:\fitnesse\lib\sqljdbc4.jar
|Import|
|dbfit.SqlServerTest|

I have the following in my HelloWorldTest,

!contents -R2 -g -p -f -h

!|dbfit.SqlServerTest|

|Connect|LOCALSQLEXPRESS|sa|Password|somePassword:|

|eg.Division|
|numerator|denominator|quotient?|
|10       |2          |5        |
|12.6     |3          |4.2      |
|100      |4          |33       |  

What I have tried:

  • I have double checked my SQLExpress username and password and the SqlServer instance is at localhost.I doubt this is a firewall issue. (My understaning of firewall is quite weak admittedly.)
  • Looking at Sql Server Configuration Manager (SSCM),
    • I see that "SQL Server (SQLEXPRESS) is running as Process with ID 2316,
    • Using the PowerShell command "nestat -a -no | Select-String 2316", I see that the process on port 55618.
  • In SSCM, I then create alias called "LOCALSQLEXPRESS" in both "SQL Native Client 11.0 Configuration (32bit)" and "SQL Native Client 11.0 Configuration" as I have no idea what my JDBC is using. (Apparently, JDBC for SQL Server does not support named instance, I got an exception telling me so when I was trying to connect to \localhost\SQLEXPRESS directly) I have also enabled "TCP/IP" and "Shared Memory" in "Protocols for SQLEXPRESS".

I am getting the following error when I run the test:

com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host LOCALSQLEXPRESS, port 1433 has failed. Error: "null. 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.".

(Note the port number of 1433, despite my alias point to port 55618.)

This is my first post at StackOverflow, please excuse any silliness. Can anyone shed any light?

4

1 回答 1

0

我希望 lingo_journey 现在已经解决了这个问题。对于其他可能有同样问题的人,我最初也无法使命名实例与多参数 Connect 一起工作。

为了解决这个问题,我切换到连接字符串作为 Connect 的参数:

1) 确保 SQL Server Browser 服务正在运行(如上面评论中所述)

2) 将 Connect 参数更改如下:

!| Connect | jdbc:sqlserver://localhost\SQLEXPRESS;databaseName=DB_NAME;integratedSecurity=true |

以下使用 SQL Server 身份验证也可以正常工作(这可能更适用于 lingo_journey:

!| Connect | jdbc:sqlserver://localhost\SQLEXPRESS;databaseName=DB_NAME;user=user1;password=Welcome!|

请注意,在我在网上看到的一些示例中,连接字符串中省略了 sqlserver:,这对我不起作用。

于 2013-12-10T03:13:42.950 回答