aspose file tools*
The moose likes JDBC 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
Bookmark "question about JDBC" Watch "question about JDBC" New topic
Author

question about JDBC

Salman Faraz
Greenhorn

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: http://aspose.com/file-tools
 
subject: question about JDBC