File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes question about JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "question about JDBC" Watch "question about JDBC" New topic

question about JDBC

Salman Faraz

Joined: Feb 14, 2005
Posts: 28
Respected Friends,
I am trying to write a very simple JDBC application with MS-Access at the back end as a database.This application takes two arguments from the command line while running and than insert these arguments in two different columns of the database.The name of the database is db10 and it contains two columns namely "id"(its data type is Integer) and "name"(its data type is Text).The problem which I am facing is that while running this program I get exceptions which shows that nither of the two arguments at run time are accepted by MS-Access.The source code is as follows:



Can you please tell what mistake I am making.

Thanking You,
Salman Faraz.

[edited to add code tags]
[ August 16, 2005: Message edited by: Jeanne Boyarsky ]
praveen kanakarajan
Ranch Hand

Joined: Apr 27, 2005
Posts: 54
im not an expert .

("insert into db10 ( id, name ) values ( id1, string1 )"

instead can u try this

("insert into db10 ( id, name ) values ("+ id1+",'"+ string1+"'" )

hope it may help you
Dave Salter
Ranch Hand

Joined: Jul 20, 2005
Posts: 293

I would recommend you have a look at Prepared Statements. They will help you overcome this problem and you don't have to worry about putting quotes etc into your SQL.
I agree. Here's the link:
subject: question about JDBC
jQuery in Action, 3rd edition