• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Insert statement

 
Abdul Sameer
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using MS-Access as back end for an application that I am developing using java.I have a HTML form which consists of two input boxes.I want to take the values typed in input boxes and add them to the table.I tried using Insert statement but it is not working.I think there is some problem with the code.Though the insert statement is working in MS-Access query but it is not working when I am trying to insert values into the table from the java code.Can anyone please help me?
Thanks.
 
Pranav Jaidka
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi abdul
your query doesnt explain where in your code you are actually going wrong .......
anyway try doing all of the following
1> Register a driver using the Class.forName("driver") statement this drive should be compatible for use with the database you are using;
2> Create a connection to the database using DriverManager.getConnection();
3>
Create an sql statements using the Connection.CreateStatement() method
4> use the executeUpdate() method on the statement to fire the insert statement......
this should work
luck
pranav
 
Rajesh Hegde
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
what is the error or exception u are getting u are getting. Also please post the code that is doing the job of insertion.
Rajesh
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i got the same error too. i have got perfect connection with msaccess and my java code queries well, infact it do all the reading stuff from the database very well. the problem arise only when i try to write somethign to the database, either thru INSERT or CREATE, the error msg it gives is
suitable driver not found
n then it dont connect to the database, but its compiled without any errors. only give runtime errors. someone suggested to me not to use msaccess for these kinda purposes. so i am gonna try SQL SERVER and advise u to do the same too , adios
 
Abdul Sameer
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajesh,
My code is neither showing any error nor throwing any exceptions.Here is the code.

Please help me.Also Im using servlets.
Added UBB CODE tags to preserve indentation
[This message has been edited by Frank Carver (edited October 25, 2000).]
 
Monty Ireland
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check you JDBC driver doc...
You are using a JDBC ver 2.0 feature...
Make sure you driver is JDBC ver 2.0 compatiable...
Hope this helps...


------------------
We learn more from our mistake's than from our success's.
a.k.a. monty6
 
Alfred
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try rs.next() before all use of row
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic