javasql-serverjdbcfitnessedbfit

SQLServerException while trying to use Fitnesse and DbFit and SQL Server


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 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?


Solution

  • I'm hoping lingo_journey already had worked out the issue by now. For others who may have same problem, I initially also couldn't make the named instance work with the multi-parameter Connect.

    To solve the issue, I switched to connection string as parameter for Connect:

    1) ensured that the SQL Server Browser service is running (as mentioned in the comments above)

    2) changed the Connect parameter as below:

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

    The following worked as well using the SQL Server authentication (which is probably more applicable to lingo_journey:

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

    Note than in some examples I saw on the web, the sqlserver: has been omitted from the connection string which did not work for me.