Connection trouble to MS sql server during setup
Asked by djay rox:

Hello - I'm trying to get through the setup process and trying to connect to an external MS sql server database. I've triple checked the database properties and have ensured that it complies with the prerequisite provided by bamboo.

Properties of direct JDBC connection -

Driver class name - com.microsoft.sqlserver.jdbc.SQLServerDriver

jdbc:sqlserver://localhost:1433;databaseName=\<db name\>

I enter the username and pass. After submitting, it tries to connect and comes back to the database setup screen without throwing any error. Not sure what's going on. Any advice?

Thanks!


Answers:
author: djay rox
body: Figured that the tcp/ip connection is failing to connect to port 1433. Looks like this is something to be corrected in the sql services config manager. We'll look into this!

comments: author: Christian Glockner
body: Hi Djay,

Indeed, by default SQL Server does not have the TCP listener enabled, which is why connections will fail unless you specifically enable the listener.

Cheers,

Christian

Premier Support Engineer

Atlassian


author: djay rox
body: Thanks Christian for the reply. We just confirmed that the port is open and I'm able to telnet to the db from the server. However, the setup is still failing.. Here is the part of the log from the setup process.. Any advice? Thanks a lot!

2018-03-05 14:08:17,905 INFO \[performSetupDatabaseConnectionBackgroundThread\] \[S  
etupDatabaseConnectionAction\] Validating database configuration...  
2018-03-05 14:08:18,137 INFO \[performSetupDatabaseConnectionBackgroundThread\] \[S  
etupDatabaseConnectionAction\] Validating connection to url: \[jdbc:sqlserver://lo  
calhost:1433;databaseName=xxxx\]  
2018-03-05 14:08:20,371 WARN \[http-nio-8085-exec-1\] \[TokenHelper\] Could not find  
token mapped to token name: token  
2018-03-05 14:08:26,049 INFO \[http-nio-8085-exec-2\] \[AccessLogFilter\] 0:0:0:0:0:  
0:0:1 POST http://localhost:8085/setup/performSetupDatabaseConnection.action 405  
957kb  
2018-03-05 14:08:28,254 INFO \[http-nio-8085-exec-3\] \[AccessLogFilter\] 0:0:0:0:0:  
0:0:1 POST http://localhost:8085/setup/performSetupDatabaseConnection.action 402  
188kb  
2018-03-05 14:08:30,317 INFO \[http-nio-8085-exec-4\] \[AccessLogFilter\] 0:0:0:0:0:  
0:0:1 POST http://localhost:8085/setup/performSetupDatabaseConnection.action 401  
246kb  
2018-03-05 14:08:32,339 INFO \[http-nio-8085-exec-5\] \[AccessLogFilter\] 0:0:0:0:0:  
0:0:1 POST http://localhost:8085/setup/performSetupDatabaseConnection.action 400  
304kb  
2018-03-05 14:08:34,363 INFO \[http-nio-8085-exec-6\] \[AccessLogFilter\] 0:0:0:0:0:  
0:0:1 POST http://localhost:8085/setup/performSetupDatabaseConnection.action 399  
361kb  
2018-03-05 14:08:34,707 ERROR \[performSetupDatabaseConnectionBackgroundThread\] \[  
DefaultAtlassianBootstrapManager\] Could not successfully test your database:  
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the ho  
st localhost, port 1433 has failed. Error: "Connection refused: connect. Verify  
the connection properties. Make sure that an instance of SQL Server is running o  
n the host and accepting TCP/IP connections at the port. Make sure that TCP conn  
ections to the port are not blocked by a firewall.".  
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(S  
QLServerException.java:206)  
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExcepti  
onToSQLServerException(SQLServerException.java:257)  
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:23  
85)  
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:567)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLSer  
verConnection.java:1955)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConne  
ction.java:1616)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLS  
erverConnection.java:1447)  
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerCon  
nection.java:788)  
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.  
java:1187)  
at java.sql.DriverManager.getConnection(Unknown Source)  
at java.sql.DriverManager.getConnection(Unknown Source)  
at com.atlassian.config.bootstrap.DefaultAtlassianBootstrapManager.getTe  
stDatabaseConnection(DefaultAtlassianBootstrapManager.java:343)  
at com.atlassian.bamboo.ww2.actions.setup.SetupDatabaseConnectionAction.  
createConnection(SetupDatabaseConnectionAction.java:143)  
at com.atlassian.bamboo.ww2.actions.setup.SetupDatabaseConnectionAction.  
validateDatabase(SetupDatabaseConnectionAction.java:122)  
at com.atlassian.bamboo.ww2.actions.setup.SetupDatabaseConnectionAction.  
validateFields(SetupDatabaseConnectionAction.java:71)  
at com.atlassian.bamboo.ww2.actions.setup.SetupDatabaseConnectionAction.  
execute(SetupDatabaseConnectionAction.java:82)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)  
at java.lang.reflect.Method.invoke(Unknown Source)  
at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:899)  
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1544)  
at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)  
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodW  
ithDebugInfo(XWorkMethodAccessor.java:96)  
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(  
XWorkMethodAccessor.java:88)  
at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1620)  
at ognl.ASTMethod.getValueBody(ASTMethod.java:91)  
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)  
at ognl.SimpleNode.getValue(SimpleNode.java:258)  
at ognl.Ognl.getValue(Ognl.java:470)  
at ognl.Ognl.getValue(Ognl.java:434)  
at com.opensymphony.xwork2.ognl.OgnlUtil$3.execute(OgnlUtil.java:371)  
at com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecuteMethod(OgnlUti  
l.java:423)  
at com.opensymphony.xwork2.ognl.OgnlUtil.callMethod(OgnlUtil.java:369)  
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultA  
ctionInvocation.java:436)  
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(Defa  
ultActionInvocation.java:291)  
at org.apache.struts2.interceptor.BackgroundProcess$1.run(BackgroundProc  
ess.java:58)  
at java.lang.Thread.run(Unknown Source)  
2018-03-05 14:08:34,738 ERROR \[performSetupDatabaseConnectionBackgroundThread\] \[  
SetupDatabaseConnectionAction\] Unable to connect to database: com.microsoft.sqls  
erver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port  
1433 has failed. Error: "Connection refused: connect. Verify the connection pro  
perties. Make sure that an instance of SQL Server is running on the host and acc  
epting TCP/IP connections at the port. Make sure that TCP connections to the por  
t are not blocked by a firewall.".  
com.atlassian.config.bootstrap.BootstrapException: com.microsoft.sqlserver.jdbc.  
SQLServerException: The TCP/IP connection to the host localhost, port 1433 has f  
ailed. Error: "Connection refused: connect. Verify the connection properties. Ma  
ke 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 b  
locked by a firewall.".


author: djay rox
body: [@Christian Glockner](/t5/user/viewprofilepage/user-id/527595)FYI.. Thanks much for your help in advance!

Sincerely!


author: djay rox
body: I figured it out finally. The config file wasn't getting written due to insufficient privileges. ugh.. we can continue on with the process. thank you. Please delete this post if you want! Sorry for the trouble :)


author: Kenneth Karlsson
body: Djay rox, i have the same problem, what rights did you set ?


author: Jay Duraikkannan
body: Kenneth.. My issue was related to insufficient 'folder' privileges. Once I set the permissions correctly (write permission), the system was able to update the config file and I could continue on. Hope this helps. Good luck!


author: Kenneth Karlsson
body: Thanks Jay - i dont seem to be able to find the right folder - is it the application or home folder you set the rights on ? i have given them go+w on both, but still not working.


author: Jay Duraikkannan
body: sorry that you're still having trouble. It was the application install folder that didn't have the correct permission for me. Why don't you just wipe everything off and start from scratch? Sometimes, a clean install just saves a lot of headache. Just a thought.. Good luck!