Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with JDBC + mysql delete query

 
Victor Naumenko
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day.
Explain what is wrong:
Delete-query does not work in java-application, and a mysql-client - all works fine?
Here's the code:



A slightly different query:
Code:


-the same situation. In java NOT work ...

Help me? please!
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Presuming you aren't getting any exceptions.
I can think of 2 options,

1) I have heard about debugging statements have you tried using one of those and seeing the actual string that is being used by the JDBC, then try running that yourself and see if it works.
2) you aren't comitting the work to the database, We can't see your connection, so you may have turned off autocomit, or not turned it on.


 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And Welcome to the ranch.
 
Victor Naumenko
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wendy Gibbons wrote:Presuming you aren't getting any exceptions.
I can think of 2 options,

1) I have heard about debugging statements have you tried using one of those and seeing the actual string that is being used by the JDBC, then try running that yourself and see if it works.
2) you aren't comitting the work to the database, We can't see your connection, so you may have turned off autocomit, or not turned it on.



Thank's.

autocommit=true.

I tried this:


all the same does not work ...
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Victor Naumenko wrote:
Wendy Gibbons wrote:Presuming you aren't getting any exceptions.
I can think of 2 options,

1) I have heard about debugging statements have you tried using one of those and seeing the actual string that is being used by the JDBC, then try running that yourself and see if it works.
2) you aren't comitting the work to the database, We can't see your connection, so you may have turned off autocomit, or not turned it on.



Thank's.

autocommit=true.

I tried this:


all the same does not work ...


In the example above you are setting autocommit=false, so turning it off oops.
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wendy Gibbons wrote:In the example above you are setting autocommit=false, so turning it off oops.

But in the example above, commit is used too. It should work the same. I assume Victor was just trying it the other way just for sure.

I'm slightly suspicious of binding date values as Strings. Is the inputData.period column a VARCHAR or other text format? If it is actually declared as DATE, an implicit conversion takes place, which is prone to problems.
 
Victor Naumenko
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martin Vajsar wrote:
Wendy Gibbons wrote:In the example above you are setting autocommit=false, so turning it off oops.

But in the example above, commit is used too. It should work the same. I assume Victor was just trying it the other way just for sure.

I'm slightly suspicious of binding date values as Strings. Is the inputData.period column a VARCHAR or other text format? If it is actually declared as DATE, an implicit conversion takes place, which is prone to problems.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic