Hi,

I am not fimilar with jdbc. But as a general prinple, you should quote your 
string expl. and it is nearly a must for all language to handle SQL query. 
May be you should try str="'id'" instead of str="id". In some language, you 
must use str = "\'id\'". 

Please check jdbc docs.

Regards,

> I and using mysql-jdbc to do some program.
> 
> I can insert record to my db by following code:
> 
> -----------------------------------------------------
> stmt.executeUpdate("insert into apidbusers values('id',
> 'jp','zhu','em1','jian180')");
> -------------------------------------------------------
> but
> if i use 
> --------------------------------------------------------------
> String str="id";
> stmt.executeUpdate("insert into apidbusers values(str, 'jp',
> 'zhu','em1','jtan180')");
> -------------------------------------------------------------
> it fails.
> why? how can i use java java string to insert a record?
> 
> Thanks 
> 
> --------------------------------
> Jianping Zhu
> Department of Computer Science
> Univerity of Georgia 
> Athens, GA 30602
> Tel 706 5423900
> --------------------------------
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <mysql-unsubscribe-
[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


--
Yours,
KH Chiu
C&A Computer Consultants Ltd.
Tel: 3104 2070 Fax: 3010 0896
Email: [EMAIL PROTECTED]
Website: www.caconsultant.com


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to