View Single Post
  #1 (permalink)  
Old 08-10-2007, 06:08 PM
mxb7642 mxb7642 is offline
Member
 
Join Date: Aug 2007
Posts: 2
mxb7642 is on a distinguished road
connecting to a database
this is probably a really stupid question, but this i my first time working with databases so here it goes. I'm trying to connect to a database using the following code:

Code:
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); String url = "jdbc:sqlserver://localhost:1433;database=tempdb;"; String user = "sa"; String pw = ""; Connection con = DriverManager.getConnection( url, user, pw );
I keep getting this error however - Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection..
I've checked the database and this is deffinitely a valid username. I've also tried several other databases with various usernames and i keep getting the same error.

Is there something horribly wrong with my code? Please help
Reply With Quote
Sponsored Links