• 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

insert statement is not working

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

insert statement is not working it is not giving any error
it giving correct result when i giving select statement
thanks
from
deepak mehta
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


nsert statement is not working it is not giving any error
it giving correct result when i giving select statement


I'm confused - you say the insert is not working, but you can select the data as expected? Can you explain?
 
Ranch Hand
Posts: 45
Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Deepak,
What is the values printed when you do

If it is non-zero then definitely your insert statement is working. I guess

it giving correct result when i giving select statement


means when you execute select you can actually see the data which you are trying to insert. If this is the case how can you say that your insert statement is not working?
 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Sturrock wrote:


nsert statement is not working it is not giving any error
it giving correct result when i giving select statement


I'm confused - you say the insert is not working, but you can select the data as expected? Can you explain?



I think he means that when he uses the commented out "select" statement in his code, he gets some results. In other words, his connection works.

This code works fine for me. The only thing I can think of is that you are trying to insert a duplicate key and are somehow not seeing the error message.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the reason for this error?
 
deepak mehta
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
select statement is working
connection made to database successfully but when i inserting it is returning n=1 but when i saw in the database for changes no changes occured in database table
please please solve it
from
Deepak Mehta
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

deepak mehta wrote:select statement is working
connection made to database successfully but when i inserting it is returning n=1 but when i saw in the database for changes no changes occured in database table
please please solve it
from
Deepak Mehta



is it possible that these transactions are not being committed? This used to happen to me sometimes that the insert would run and I'd check it with a select and not see the new data.... and then remember to issue a commit.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try class loader with "newInstance()" method.

i.e.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();

Regards,
Prasenjit
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

prasenjit.svnit das wrote:try class loader with "newInstance()" method.

i.e.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();

Regards,
Prasenjit


Why?
reply
    Bookmark Topic Watch Topic
  • New Topic