Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: connectivity problem

  1. #1
    Member
    Join Date
    Jan 2012
    Posts
    57
    My Mood
    Fine
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default connectivity problem

    hii guys here is the simple code through which i am trying to make the connection but it still getting error .. i followed each and every step given in the netbeans tutorial but still having connection problem dont know what to do ..plzz help ..

     
    import java.sql.*;
    public class samp {
     
        /**
         * @param args the command line arguments
         */
         public samp() {
        }
        public static void main(String[] args) {
            try{ 
            Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
            }catch(ClassNotFoundException e){
                System.out.println(e);
            }
     
            try{
            Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/career", "admin", "admin");
            Statement stmt = con.createStatement();
     
            ResultSet rs = stmt.executeQuery("SELECT * FROM APP.STUDENTSS");
     
            while (rs.next()) {
            String s = rs.getString("name");
            String n = rs.getString("college");
            System.out.println(s + "   " + n);
        }
            }catch(SQLException e){
                System.err.println(e);
            }                 
     
        }
    }

    error :
     run:
    java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
    java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/career
    BUILD SUCCESSFUL (total time: 0 seconds)


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: connectivity problem

    Make sure the library that contains the Derby driver is on your classpath. I do not use Netbeans and do not know if the driver comes with the software...if not you can download the driver from the Derby project.

  3. #3
    Member
    Join Date
    Jan 2012
    Posts
    57
    My Mood
    Fine
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default Re: connectivity problem

    will you please elaborate .. how to do that ??

  4. #4
    Member
    Join Date
    Jan 2012
    Posts
    57
    My Mood
    Fine
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default Re: connectivity problem

    i downloaded the derby 10.8.2.1 and added the jar file to my project but still it has now only one error that is :
     run:
    java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/career
    BUILD SUCCESSFUL (total time: 0 seconds)
    now i am not getting the ClassNotFoundException but have this exception only that i mentioned.. how to eliminate that please specify
    thanks

  5. #5
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: connectivity problem

    Try loading the ClientDriver rather than the EmbeddedDriver. eg Class.forName("org.apache.derby.jdbc.ClientDriver" )

  6. #6
    Member
    Join Date
    Jan 2012
    Posts
    57
    My Mood
    Fine
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default Re: connectivity problem

    that i have done already but the problem persists.. its really a kind of hitch

Similar Threads

  1. regarding connectivity
    By deependeroracle in forum AWT / Java Swing
    Replies: 7
    Last Post: March 8th, 2012, 12:36 PM
  2. webservice connectivity?????
    By rachana in forum Java ME (Mobile Edition)
    Replies: 0
    Last Post: February 3rd, 2011, 08:52 AM
  3. Help regarding JDBC connectivity in JSP
    By Lovable_Kumar in forum JDBC & Databases
    Replies: 0
    Last Post: May 30th, 2010, 11:53 AM
  4. Connectivity problem:MySQL and Java
    By Pragya in forum JDBC & Databases
    Replies: 2
    Last Post: January 22nd, 2010, 03:58 AM
  5. Database connectivity problem-Oracle
    By Entrant in forum JDBC & Databases
    Replies: 3
    Last Post: October 11th, 2009, 10:08 AM