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:
I keep getting this error however - Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection..Code:
String url = "jdbc:sqlserver://localhost:1433;database=tempdb;";
String user = "sa";
String pw = "";
Connection con = DriverManager.getConnection( url, user, pw );
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