DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2004
    Posts
    1

    Logging in to MS SQL Server using JDBC (JAVA)

    Hello,

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

    osql -U aberglas2
    password:
    1> Select * from ajbtable
    2> go
    etc.

    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.SQLServerDriver;

    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.

  2. #2
    Join Date
    Sep 2004
    Location
    Surrey, UK
    Posts
    21

    Question

    aberglas,

    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?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links