This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Zero to AI - A non-technical, hype-free guide to prospering in the AI era and have Nicolò Valigi and Gianluca Mauro on-line!
See this thread for details.
Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

SQL Server 2008r2 Connection Failed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Marshal
Posts: 25930
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a user name and password which the database recognizes as valid.
 
Greenhorn
Posts: 11
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Replace this



By this.



I think that will work...
 
fuad wahyu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 11
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the jdbc jar entry present in the CLASSPATH?
 
So there I was, trapped in the jungle. And at the last minute, I was saved by this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic