wood burning stoves 2.0*
The moose likes JDBC and the fly likes SQL Server 2008r2 Connection Failed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL Server 2008r2 Connection Failed" Watch "SQL Server 2008r2 Connection Failed" New topic
Author

SQL Server 2008r2 Connection Failed

fuad wahyu
Greenhorn

Joined: Oct 31, 2011
Posts: 3
Hi,

I want to try to make the connection sql server 2008 r2 with java using the netbeans IDE. I have downloaded the latest version of jdbc drive (Microsoft SQL Server JDBC Driver 3.0).
I have written the code as below



but I got the following error, the error message like below
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'user'.

how do i fix that?

thanks for help..
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Use a user name and password which the database recognizes as valid.
Rocky Khan
Greenhorn

Joined: Oct 18, 2011
Posts: 11

private final String userName = "user";
private final String password = "password";


Check these details and pass valid username and password in connection string..
fuad wahyu
Greenhorn

Joined: Oct 31, 2011
Posts: 3
thanks for the help,

my username and password are already correct, because i use windows username and password account
My server name is "myinstance", in propersties and security I am using "sql server and windows authentication mode".
but there is still a problem, what should i do now..?



Rocky Khan
Greenhorn

Joined: Oct 18, 2011
Posts: 11

Replace this



By this.



I think that will work...
fuad wahyu
Greenhorn

Joined: Oct 31, 2011
Posts: 3
Rocky Khan wrote:Replace this



By this.



I think that will work...


i have changed the url address but i get the following error message

java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433;databaseName=exampledb;selectMethod=cursor
Rocky Khan
Greenhorn

Joined: Oct 18, 2011
Posts: 11

Is the jdbc jar entry present in the CLASSPATH?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL Server 2008r2 Connection Failed
 
Similar Threads
Hi...jdbc..no active Connections issue...
SQL Server 2000 JDBC Driver Error
JTDS jdbc driver
Why cant connect to another computer in lan?
no active Connection...jdbc newbie