quarks
quarks

Reputation: 35276

How to connect my web application to SQL Server / SQL Server Express

I am working with a web application that connects to a SQL Server database with this:

jdbc.url=jdbc:jtds:sqlserver://127.0.0.1/MyDatabase
jdbc.username=sa
jdbc.password=password

I am relatively new to SQL Server, however I have successfully accessed a SQLEXPRESS instance through the SQL Server Management Studio.

I can see from the Security->Login folder there is a "sa" entry

However when I run the web application I am getting this error:

PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'dataSource' threw exception; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Network error IOException: Connection refused: connect)

I seems that the user: "sa" is not authenticated to access the database?

If so, how can I use the SQL Server management studio to fix this?

Upvotes: 0

Views: 6750

Answers (3)

Mohammed Rafeeq
Mohammed Rafeeq

Reputation: 2694

To check whether TCP/IP is enabled and the port is not blocked you can use "telnet 1433". Until telnet doesn't connect, jTDS won't either.

e.g, c:>telnet servername 1433

to enable telnet client on windows

http://social.technet.microsoft.com/wiki/contents/articles/910.how-to-enable-telnet-client-in-windows-7.aspx

Upvotes: 0

wmz
wmz

Reputation: 3685

Make sure authentication mode is set to Mixed. It's set to Windows authentication mode as default which disables sa account. See here: http://msdn.microsoft.com/en-us/library/ms143705%28v=sql.90%29.aspx

Edit: as Jacob suggested, make sure you can connect via TCP/IP (I assume it's used by the driver). To do so launch SQL Management Studio and in connection preferences set: Authentication - SQL Server authentication, login - sa, password - your password. Then click Options, connection properties and select tcp/ip as protocol. Check if you can login.

Upvotes: 5

Related Questions