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 2 of 2

Thread: connection issue in java desktop database application using derby database

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default connection issue in java desktop database application using derby database

    Hello Java forum members !

    Firstly please forgive my ignorance , I am beginner in java database programming.
    I cannot make connection to Embedded derby database. This is what I did

    1)created derby database with one table using netbeans 7.1.2. And inserted some data in that table via sql command

    Now I want to read data from this database's table from a java class but I am getting this message when I run

    Errorjava.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver

    here is my code of the class

     
     
    package mypackage;
     
    import java.sql.*;
     
     
     
    public class DbConnection {
     
        Connection con;
        Statement st;
        ResultSet rs;
     
        public DbConnection() {
            connect();
     
        }
        public void connect() {
            try{
     
                String driver = "jdbc:derby:fida;user=scott;password=tiger";
                Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
     
     
                con= DriverManager.getConnection(driver);
                st=con.createStatement();
                String sql = "select * from APP.STUDENT";
                rs = st.executeQuery(sql);
                while(rs.next())
                {
                    System.out.println(rs.getInt("ID"));
                    System.out.println(rs.getString("name"));
                    System.out.println(rs.getString("fname"));
     
                }
     
            }catch(Exception ex){
                System.out.println("Error"+ex);
            }
     
     
        }
        public static void main (String args[]){
            new DbConnection();
        }
     
    }


    Please help me out , and forgive my ignorance.


  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: connection issue in java desktop database application using derby database

    Please read the forum rules and do not double post. Keep the discussion to your other thread.
    http://www.javaprogrammingforums.com...onnection.html
    Thread locked.

Similar Threads

  1. problem in Derby embedded database connection
    By brother in forum JDBC & Databases
    Replies: 6
    Last Post: December 24th, 2012, 02:17 PM
  2. How to Create a Desktop Application with Database
    By sahilradotra in forum AWT / Java Swing
    Replies: 2
    Last Post: September 28th, 2012, 04:37 AM
  3. Deploy derby database application
    By Jenny.Palmy in forum JDBC & Databases
    Replies: 0
    Last Post: May 13th, 2012, 12:06 AM
  4. How database connection pooling works in a application
    By JayVirk in forum JDBC & Databases
    Replies: 0
    Last Post: October 10th, 2009, 07:14 AM
  5. Desktop Database Application
    By TCoomer in forum JDBC & Databases
    Replies: 2
    Last Post: June 4th, 2009, 03:51 PM