-
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)
-
I believe "Table not found" is pretty self-explanatory.
-
i have the table tack a look at my screen
UploadFile.org
-
-
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.
-
make sure it really is in your database..check in sql..
-
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.
-
Oh God, not again. Stop posting this trash all over the place.
-
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.
-
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.
-
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.
-
This is the definition of spamming...
-
really spam..just search the forums for good questions..itll help
-
The spam has been removed and poster has been banned.