Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-10-2007, 06:08 PM
Member
 
Join Date: Aug 2007
Posts: 2
mxb7642 is on a distinguished road
connecting to a database
this is probably a really stupid question, but this i my first time working with databases so here it goes. I'm trying to connect to a database using the following code:

Code:
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); String url = "jdbc:sqlserver://localhost:1433;database=tempdb;"; String user = "sa"; String pw = ""; Connection con = DriverManager.getConnection( url, user, pw );
I keep getting this error however - Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection..
I've checked the database and this is deffinitely a valid username. I've also tried several other databases with various usernames and i keep getting the same error.

Is there something horribly wrong with my code? Please help
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-05-2007, 05:14 PM
Member
 
Join Date: Dec 2007
Posts: 1
ksbrother is on a distinguished road
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbcdbc:dsname" ,"username","password");
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting to a database peiceonly New To Java 2 04-06-2008 03:28 PM
problem in connecting to mysql database nancyv Java Servlet 6 04-02-2008 12:33 PM
Specifying the character set while connecting to the database Java Tip Java Tips 0 02-13-2008 12:26 PM
Error while connecting to a database Fukushuusha Database 2 12-16-2007 10:40 AM
connecting to mysql database javagal NetBeans 2 08-04-2007 01:36 PM


All times are GMT +3. The time now is 02:56 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org