Results 1 to 14 of 14
  1. #1
    miko5054 is offline Member
    Join Date
    Mar 2010
    Posts
    50
    Rep Power
    0

    Default insert a row into the DB

    im trinig to

    the conetion is ok...

    this is the code

    ublic void updateDataBase() {

    try {
    String query="INSERT INTO cusInfo (cusId,pass,cusName,clinetStatus,addrese,email,pho neNum,comments )values (?,?,?,?,?,?,?,?)";
    ps =connection.prepareStatement(query);
    ps.setInt(1, getCusId());
    ps.setString(2, getPass());
    ps.setString(3, getCusName());
    ps.setString(3, getClinetStatus());
    ps.setString(4, getEmail());
    ps.setString(5, getAddrese());
    ps.setInt(6, getPhoneNum());
    ps.setString(7, getComments());
    ps.executeUpdate();





    } catch (SQLException e) {
    // TODO Auto-generated catch block
    System.out.println("updateDataBase eroor");
    e.printStackTrace();
    }
    finally {
    try {
    ps.close();
    } catch (SQLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }



    and that is the output////

    conection ok
    updateDataBase eroor
    java.sql.SQLException: Table not found in statement [INSERT INTO cusInfo (cusId,pass,cusName,clinetStatus,addrese,email,pho neNum,comments )values (?,?,?,?,?,?,?,?)]
    at org.hsqldb.jdbc.Util.throwError(Unknown Source)
    at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unkno wn Source)
    at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Un known Source)
    at dbexemple.DataBaseAction.updateDataBase(DataBaseAc tion.java:70)
    at dbexemple.DataBaseActionMain.main(DataBaseActionMa in.java:16)
    Exception in thread "main" java.lang.NullPointerException
    at dbexemple.DataBaseAction.updateDataBase(DataBaseAc tion.java:92)
    at dbexemple.DataBaseActionMain.main(DataBaseActionMa in.java:16)

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    I believe "Table not found" is pretty self-explanatory.

  3. #3
    miko5054 is offline Member
    Join Date
    Mar 2010
    Posts
    50
    Rep Power
    0

    Default

    i have the table tack a look at my screen
    UploadFile.org

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

  5. #5
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Okay? That shows a table with the name "cusName". It does not prove that it is in the same schema in which the user with which your app attaches uses per default, nor even that it is in the same db. Like I said, "Table Not Found" is pretty self-explanatory.

  6. #6
    clydedoris is offline Member
    Join Date
    Feb 2010
    Posts
    80
    Rep Power
    0

    Default

    make sure it really is in your database..check in sql..
    [why are you annoyed with my sig?]

  7. #7
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Has already been solved in the cross-post referenced above. The OP is simply too uncaring to notify the people here of that fact.

    Then again I would hope that the problem would already have been solved in the three weeks since the last post anyway.

  8. #8
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Oh God, not again. Stop posting this trash all over the place.

  9. #9
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    What's wrong is your spamming this all over the place. In most of these forums there is an "announements" (or something similar) forum section. Post a single thread there and leave it alone. But stop this spamming.

  10. #10
    Sno's Avatar
    Sno
    Sno is offline Senior Member
    Join Date
    Apr 2010
    Posts
    196
    Rep Power
    5

    Default

    No, I'm pretty sure your spamming the site. Why don't you place it in the Java Tips!!! Liek OMG great idea right!? When people search jdbc or whatever they need, they can refer to the Tips! Boo Yea.
    :rolleyes: ~ Sno ~ :rolleyes:
    '-~ B.S. Computer Science ~-'

  11. #11
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    You still don't get it, do you? I couldn't care less whether your "sources" are any good, or not. I don't care. But you're spamming is getting ludicrous.

  12. #12
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default

    This is the definition of spamming...

  13. #13
    clydedoris is offline Member
    Join Date
    Feb 2010
    Posts
    80
    Rep Power
    0

    Default

    really spam..just search the forums for good questions..itll help
    [why are you annoyed with my sig?]

  14. #14
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. How to insert '{'
    By izrydka in forum New To Java
    Replies: 3
    Last Post: 05-18-2010, 08:38 PM
  2. insert records
    By rudravaram in forum JDBC
    Replies: 3
    Last Post: 01-03-2010, 05:54 PM
  3. Replies: 3
    Last Post: 02-28-2009, 09:17 AM
  4. Help with sql insert
    By jmorris in forum New To Java
    Replies: 6
    Last Post: 12-02-2008, 07:05 PM
  5. SQL Insert Help!!!!
    By shaungoater in forum New To Java
    Replies: 1
    Last Post: 06-14-2008, 03:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •