1

I am using jTDS to connect a Liferay instance to an SQL Server 2008 Express server using the SQL Server authentication (instead of the Windows' auth method). I have something like this in my portal-ext.properties:

jdbc.default.driverClassName=net.sourceforge.jtds.jdbc.Driver
jdbc.default.url=jdbc:jtds:sqlserver://127.0.0.1:1433/somedb
jdbc.default.username=someuser
jdbc.default.password=somepassword

(For those that do not know Liferay, it is somewhat alike to call

Class.forName("net.sourceforge.jtds.jdbc.Driver");
con = DriverManager.getConnection("jdbc:jtds:sqlserver://127.0.0.1:1433/somedb",
                                  "someuser", "somepassword");

However, although I pass the correct username and password, it keeps going wrong with the message Login failed for user 'someuser'. I am dead sure the server login, the database user and the database exists and are well configured.

What can be wrong?

1 Answer 1

1

Well, I suppose there can be infinite reasons for such an error. In my case, nonetheless, the solution was the following:

  1. Enable the TCP/IP connection in SQL Configuration Manager.

  2. Open the SQL Server Management Studio (if you do not have it installed, install it; it can have its own pitfalls, however).

  3. Right-click on the database server (as in the picture below) and click in Properties. Right-clicking on the database server

  4. Select the Security option and mark SQL Server and Windows authentication mode. Click in OK. Database server Security properties
  5. Open the SQL Server Configuration Manager and restart the SQL Server service.

After this, I got my connections without problems. This article helped me a lot.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.