Results 1 to 14 of 14
Thread: insert a row into the DB
- 06-18-2010, 12:13 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 50
- Rep Power
- 0
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)
- 06-18-2010, 12:16 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
I believe "Table not found" is pretty self-explanatory.
- 06-18-2010, 12:22 PM #3
Member
- Join Date
- Mar 2010
- Posts
- 50
- Rep Power
- 0
i have the table tack a look at my screen
UploadFile.org
- 06-18-2010, 12:23 PM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
- 06-18-2010, 12:26 PM #5
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
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.
- 07-08-2010, 10:26 AM #6
Member
- Join Date
- Feb 2010
- Posts
- 80
- Rep Power
- 0
make sure it really is in your database..check in sql..
[why are you annoyed with my sig?]
- 07-08-2010, 10:41 AM #7
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
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.
- 07-08-2010, 06:56 PM #8
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Oh God, not again. Stop posting this trash all over the place.
- 07-08-2010, 07:26 PM #9
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
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.
- 07-08-2010, 09:43 PM #10
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 ~-'
- 07-09-2010, 12:36 AM #11
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
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.
- 07-09-2010, 08:46 AM #12
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
This is the definition of spamming...
- 07-11-2010, 12:40 PM #13
Member
- Join Date
- Feb 2010
- Posts
- 80
- Rep Power
- 0
really spam..just search the forums for good questions..itll help
[why are you annoyed with my sig?]
-
The spam has been removed and poster has been banned.
Similar Threads
-
How to insert '{'
By izrydka in forum New To JavaReplies: 3Last Post: 05-18-2010, 08:38 PM -
insert records
By rudravaram in forum JDBCReplies: 3Last Post: 01-03-2010, 05:54 PM -
How to insert large data into database using one insert query
By sandeepsai39 in forum New To JavaReplies: 3Last Post: 02-28-2009, 09:17 AM -
Help with sql insert
By jmorris in forum New To JavaReplies: 6Last Post: 12-02-2008, 07:05 PM -
SQL Insert Help!!!!
By shaungoater in forum New To JavaReplies: 1Last Post: 06-14-2008, 03:14 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks