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: can any body help to correct this error

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

    Angry can any body help to correct this error

    i get the ff message when i try to connect to a database using the cods below.the message is aparch.jdbc.EmbbededDriver
    the code is


    if (evt.getSource().equals(Enter)) {

    try {
    Class.forName("org.apache.derby.jdbc.EmbbededDrive r");

    String url =" jdbc:derby://localhost:1527/Queens ";
    String userid = "knust";
    String pwd = "knust";
    // Connection con= Connection;
    Connection con= (Connection)
    //Statement statement=connection.createStatement();
    DriverManager.getConnection("url","knust","knust") ;
    Statement stmt=con.createStatement();

    // connection = DriverManager.getConnection(url, userid, pwd);
    int ID = Integer.parseInt(Index.getText());
    String Fnam = Fname.getText();
    String Lnam = Lname.getText();
    // String Department = Depart.getText();
    // String Natio = Nation. getText();
    // String Hal = Hall.getText();
    // int Phon =Integer.parseInt (Phone.getText());
    // int Leve =Integer.parseInt( Level.getText());
    String sql="Insert into ROYALS values('"+(ID)+"','"+(Fnam)+"','"+(Lnam)+"')";
    stmt.executeUpdate(sql);

    Fname.setText("");
    Index.setText("");
    Lname.setText("");
    JOptionPane.showMessageDialog(null, "values added to the database");

    // statement = connection.prepareStatement("INSERT INTO APP.STUDENT" + "(Index No,Fname,Lname,Departmen,Nation,Hall,Phone,Level)" + "VALUES(IndexNo,Fnam,Lnam, Department, Natio, Hal,Phon,Leve )");
    } catch (Exception e) {
    JOptionPane.showMessageDialog(this, e.getMessage());
    }
    // this.setVisible(false);
    // Gesa3 itermloader = new Gesa3();
    // itermloader.setVisible(true);
    }
    can anyone help me solve the problem


  2. #2
    Member
    Join Date
    Feb 2011
    Posts
    31
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default Re: can any body help to correct this error

    Quote Originally Posted by Diyaka View Post
    i get the ff message when i try to connect to a database using the cods below.the message is aparch.jdbc.EmbbededDriver
    the code is


    if (evt.getSource().equals(Enter)) {

    try {
    Class.forName("org.apache.derby.jdbc.EmbbededDriver");

    String url =" jdbc:derby://localhost:1527/Queens ";
    String userid = "knust";
    String pwd = "knust";
    // Connection con= Connection;
    Connection con= (Connection)
    //Statement statement=connection.createStatement();
    DriverManager.getConnection("url","knust","knust") ;
    Statement stmt=con.createStatement();

    // connection = DriverManager.getConnection(url, userid, pwd);
    int ID = Integer.parseInt(Index.getText());
    String Fnam = Fname.getText();
    String Lnam = Lname.getText();
    // String Department = Depart.getText();
    // String Natio = Nation. getText();
    // String Hal = Hall.getText();
    // int Phon =Integer.parseInt (Phone.getText());
    // int Leve =Integer.parseInt( Level.getText());
    String sql="Insert into ROYALS values('"+(ID)+"','"+(Fnam)+"','"+(Lnam)+"')";
    stmt.executeUpdate(sql);

    Fname.setText("");
    Index.setText("");
    Lname.setText("");
    JOptionPane.showMessageDialog(null, "values added to the database");

    // statement = connection.prepareStatement("INSERT INTO APP.STUDENT" + "(Index No,Fname,Lname,Departmen,Nation,Hall,Phone,Level)" + "VALUES(IndexNo,Fnam,Lnam, Department, Natio, Hal,Phon,Leve )");
    } catch (Exception e) {
    JOptionPane.showMessageDialog(this, e.getMessage());
    }
    // this.setVisible(false);
    // Gesa3 itermloader = new Gesa3();
    // itermloader.setVisible(true);
    }
    can anyone help me solve the problem
    Maybe check the spelling on the text in red.


    All intelligent thoughts have already been thought;
    what is necessary is only to try to think them again.



Similar Threads

  1. hi every body!!!!!!!!!........
    By kranthi in forum Member Introductions
    Replies: 2
    Last Post: January 10th, 2012, 05:03 AM
  2. Can anybody correct the code?
    By ur2cdanger in forum What's Wrong With My Code?
    Replies: 8
    Last Post: October 24th, 2011, 12:50 AM
  3. Is this correct? Tips if any please
    By giga97 in forum Object Oriented Programming
    Replies: 1
    Last Post: October 8th, 2011, 10:03 AM
  4. Hello every body
    By sireesha in forum Member Introductions
    Replies: 1
    Last Post: June 6th, 2011, 04:27 AM
  5. Hi Every Body!
    By Xcube in forum Member Introductions
    Replies: 1
    Last Post: March 12th, 2011, 04:27 PM