• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with JDBC + mysql delete query

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And Welcome to the ranch.
 
Victor Naumenko
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.



 
You would be much easier to understand if you took that bucket off of your head. And that goes for the tiny ad too!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic