• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQL Server 2008r2 Connection Failed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the jdbc jar entry present in the CLASSPATH?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic