aspose file tools*
The moose likes JDBC and the fly likes Trouble Connectiing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Trouble Connectiing" Watch "Trouble Connectiing" New topic
Author

Trouble Connectiing

Adam Smithison
Greenhorn

Joined: Feb 08, 2011
Posts: 3
Every time I try to connect to my database, I get the following error: Login failed for user 'sa'. Does anyone know what is wrong? Is the user name wrong? Is the password wrong? I have been having this problem for a while now and I have no idea why this s happening.

I have SQL Server and Windows Authentication mode selected.
I am using SQL Express 2008.
My username and password is for the database, not my windows login.



Has only one come across this problem before?
Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18563
    
    8

Adam Smithison wrote:I have SQL Server and Windows Authentication mode selected.


This is the problem. You aren't using "Windows authentication" in your code (and you can't). You have to configure your SQL Server application to accept connections via TCP/IP.
Adam Smithison
Greenhorn

Joined: Feb 08, 2011
Posts: 3
Alrighty, so I changed my connection string to:





I am now getting following error:
The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".

- I know SQL server is running because I have a program that is already connected to the database

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18563
    
    8

Paul Clapham wrote: You have to configure your SQL Server application to accept connections via TCP/IP.


And when I said that, I didn't mean your Java application. I meant you have to configure SQL Server. It's clear from the error message that you haven't done that.
Adam Smithison
Greenhorn

Joined: Feb 08, 2011
Posts: 3
In the TCP/IP Properties tab in the Sql Server Congifuration Manager.
Listen all is set to 'Yes', so in the IPALL section :
TCP Dynamic Ports was already set to 58314
I set the TCP Port to 1433.

I turned off my firewall and my anti-virus program.

I dont know what else I would need to do to set up the server to allow this to work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trouble Connectiing