Logging in to MS SQL Server using JDBC (JAVA)
I have installed SQL Server and can now successfully access it using
osql -U aberglas2
1> Select * from ajbtable
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
java.sql.DriverManager.getConnection("jdbc:microsoft: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 to easy to use for me.
This could be a silly question, but I noticed you are using two different IDs: aberglas2 and aberlgas2, is it just a typo in your posting?
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL