Logging in via JDBC


I have installed SQL Server and can now successfully access it using

osql -U aberglas2
1> Select * from ajbtable
2> go

However, when I try to use the the JDBC driver I get

[java] java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Login failed for user 'aberlgas2'.

I use the following config
Class.forName("com.microsoft.jdbc.sqlserver.SQLSer verDriver;

java.sql.DriverManager.getConnection("jdbc:microso ft:sqlserver://localhost:1433", "aberlgas2", "XXX");

Any ideas most welcome. This is very frustrating.

I seem to be able to connect to the server OK, because if I change the port number to something meaningless I get
[java] java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.

Anyway to step through the process and find out more about the problem?


Before achieving the above error, I was getting "Not associated with a trusted SQL Server connection".

After much stuffing arround I discoverd that you have to go into the
"Enterprise Manager", and change the properties on the thing under
Server Group to Security | SQL Server and Windows, otherwise User "SQL
Server Authentication" will not be enabled. It is not enough to enable this under Security | Logins, you have to enable "SQL Server" authentication on the entire server as well.

Microsoft products are a bit too easy to use for me.