1. Check this string: *String connectionUrl = "jdbc:sqlserver:MAY BE PORT NUMBER MISSING //localhost;**database=AdventureWorks;**integratedSecurity=true;";*Like for Mysql server the port number is 3306.
2. Do you have Connector. Check that you have the right connector for jdbc. To avoid this complexity you can try NetBeans JavaDB for initial purpose. Its quite easy to handle. Or just search in google with this key word "*jdbc:sqlserver+connector+jar*" and download your appropriate connector [which is *Sql server 2000 driver for JDBC* ]. i guess these are two possible unchecked which causing that error. Oh dont forget to add the driver.jar to your project library..thats all. Regards. Sher.. On Fri, Dec 25, 2009 at 11:00 AM, bijesh shyanth <shyanth_1...@yahoo.co.in>wrote: > Hi > > I was just trying to run this program > > import java.sql.*; > public class JDBCDemo { > // private Connection con; > public static void main(String[] str){ > new JDBCDemo().connect(); > } > private void connect(){ > try{ > Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); > String connectionUrl = > "jdbc:sqlserver://localhost;database=AdventureWorks;integratedSecurity=true;"; > Connection con = DriverManager.getConnection(connectionUrl); > System.out.println("Connection Established"); > }catch(Exception e){ > e.printStackTrace(); > } > } > } > > and i got exception > > 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.java:188) > at java.lang.ClassLoader.loadClass(ClassLoader.java:307) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > at java.lang.ClassLoader.loadClass(ClassLoader.java:252) > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Class.java:169) > at Chapter1.JDBCDemo.connect(JDBCDemo.java:20) > at Chapter1.JDBCDemo.main(JDBCDemo.java:16) > > > > Can anyone out there please help me what should i do am new to JDBC > programming > > > Thanks in advance > > Bijesh > > ------------------------------ > The INTERNET now has a personality. YOURS! See your Yahoo! > Homepage<http://in.rd.yahoo.com/tagline_yyi_1/*http://in.yahoo.com/>. > > > -- > You received this message because you are subscribed to the Google > Groups "Java EE (J2EE) Programming with Passion!" group. > To post to this group, send email to > java-ee-j2ee-programming-with-passion@googlegroups.com > To unsubscribe from this group, send email to > java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com<java-ee-j2ee-programming-with-passion%2bunsubscr...@googlegroups.com> > For more options, visit this group at > > http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en -- Sher-E-Alam [Sajib] @dept. of Computer Science & Engineering University of Dhaka. -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en