| Author |
insert statement is not working
|
deepak mehta
Greenhorn
Joined: Jan 25, 2005
Posts: 15
|
|
insert statement is not working it is not giving any error
it giving correct result when i giving select statement
thanks
from
deepak mehta
|
deepak kr.
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
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?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Smitesh Shinde
Ranch Hand
Joined: Feb 16, 2008
Posts: 44
|
|
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?
|
 |
Tim McGuire
Ranch Hand
Joined: Apr 30, 2003
Posts: 819
|
|
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.
|
 |
wang lei
Greenhorn
Joined: Mar 09, 2010
Posts: 12
|
|
|
what is the reason for this error?
|
 |
deepak mehta
Greenhorn
Joined: Jan 25, 2005
Posts: 15
|
|
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
Joined: Apr 30, 2003
Posts: 819
|
|
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.
|
 |
prasenjitkumar das
Greenhorn
Joined: Mar 17, 2010
Posts: 12
|
|
try class loader with "newInstance()" method.
i.e.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
Regards,
Prasenjit
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
prasenjit.svnit das wrote:try class loader with "newInstance()" method.
i.e.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
Regards,
Prasenjit
Why?
|
 |
 |
|
|
subject: insert statement is not working
|
|
|