I am trying to set a JDBC connection to Sql Server 2008. I have created a database in Sql Server with this information:
CREATE LOGIN xtest WITH PASSWORD = 'berenjenas7(((';
GO
CREATE USER samxtest FOR LOGIN xtest;
GO
GRANT SELECT TO samxtest;
GO
GRANT INSERT TO samxtest;
GO
GRANT UPDATE TO samxtest;
GO
GRANT DELETE TO samxtest;
GO
I installed the JDBC driver from here: http://www.microsoft.com/en-us/download/details.aspx?id=11774
and I used the connectURL class from this link: http://msdn.microsoft.com/en-us/library/aa342339.aspx
in order to test the connection.
I left the default port 1433 in the code. The following picture should be proof that this is really the port:

And of course I changed the connection string to:
String connectionUrl = "jdbc:sqlserver://localhost:1433;databaseName=XTest;user=samxtest;password=berenjenas7(((";
I don’t understand what is wrong?
The error I get is:
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user
‘samxtest’. ClientConnectionId:2344af….. at
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
at
com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:254)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2908)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2234)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2220)
at
com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1326)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at
com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at java.sql.DriverManager.getConnection(Unknown Source) at
java.sql.DriverManager.getConnection(Unknown Source) at
connectURL.main(connectURL.java:18)
Misread:
Make sure that Authentication Mode of the SQL server “Mixed Mode (Windows Authentication and SQL Server Authentication)”.
Run following script to change the authentication