aspose file tools*
The moose likes JDBC and the fly likes duplicate row Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "duplicate row" Watch "duplicate row" New topic
Author

duplicate row

paul beppe
Ranch Hand

Joined: Aug 09, 2012
Posts: 86
thi is code:
[Edit - fixed line width]

don't duplicate row...why???
paul beppe
Ranch Hand

Joined: Aug 09, 2012
Posts: 86
i have edit:

[Edit - fixed line width]

but always this problems....nothing copy!!!

why?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

It surprises me you didn't get an error with the first statement. The number of place holders (?) does not match the number of values specified for them.

As far as the second is concerned, are you sure that your SELECT query gives you any results?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
paul beppe
Ranch Hand

Joined: Aug 09, 2012
Posts: 86
yes....i have result in my select!!!

Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4422
    
    8

As Rob says, that first one should have thrown an exception. The fact that you mention it suggests that you're suppressing any exceptions you get (e.g. a catch block that does nothing). If that's the case, fix it, because it's possible your second example is also throwing an exception.

For instance, one thing I can think of that would cause it is a unique constraint on that table for one of the fields you're adding.
paul beppe
Ranch Hand

Joined: Aug 09, 2012
Posts: 86
I would like to copy the same recordset in the same table .... with a selection to the JList

Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4422
    
    8

And are you certain that you're not getting any exceptions?
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

Do you have auto comit turned off?
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

paul beppe wrote:i have edit:

[Edit - fixed line width]

but always this problems....nothing copy!!!

why?


If the table you're trying to insert data into contains primary key(s), then an exception is thrown when trying to do this, because you're trying to insert another row with the same key; make sure you catch that one. Other thing might be that the SELECT does not return any rows, so no rows are inserted either.

paul beppe wrote:yes....i have result in my select!!!

Relax dude, people are trying to help you.


The quieter you are, the more you are able to hear.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: duplicate row