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 05-19-2008, 10:52 AM
Member
 
Join Date: May 2008
Posts: 9
rmaadil is on a distinguished road
Exception
Following is the code that I have written to get connection to SQL Server:


public class Main {


public static void main(String[] args) {

try
{

Class.forName("com.microsoft.sqlserver.jdbc.SQLSer verDriver");
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlser ver://localhost:1433;DATABASENAME=Test","mimdad","aaa");
}
catch (Exception e)
{
e.printStackTrace();
}

}
}



and following is the exception that I am getting at the Class.forName().


java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at sqlserver.Main.main(Main.java:39)


Can anybody help me.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-19-2008, 01:45 PM
Member
 
Join Date: Dec 2007
Posts: 32
felixtfelix is on a distinguished road
hi,

It is clear that you dont have the sqljdbc.jar in your class path. This is the jar file which supports the JDBC 3 Driver to connect with Database.

Regards

Felix T
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
Exception! rameshraj Advanced Java 1 05-05-2008 02:39 PM
exception Oktam New To Java 2 03-23-2008 08:01 PM
Trouble with factory method - unhandled exception type Exception desmond5 New To Java 1 03-08-2008 07:41 PM
Need help on Exception Deon New To Java 5 01-26-2008 09:27 AM
Exception Camden New To Java 2 11-27-2007 12:50 AM


All times are GMT +3. The time now is 11:34 AM.


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