Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

SQL Server 2008r2 Connection Failed  RSS feed

 
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..
 
Sheriff
Posts: 23714
50
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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!