I think what Victor meant is that you should show the *output* from a System.out.println() that displays the exact contents of the SQL string that you are executing.
Can someone refresh my memory: isn't it normal practice to use apostrophes (also known as "single quotes") around literals in SQL statements? That's the SQL standard as I recall. Then again, I am still relatively new to MySQL which may be more liberal and accept apostrophes.... Also, I think Victor is on to something. Prepared statements are probably a better choice in Java programs in most cases. There is a bit more code to write to set the values of all the parameters but you have far fewer problems with blanks, apostrophes, or quotes embedded within the literals. Rhino ----- Original Message ----- From: "Shaffin Bhanji" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, August 11, 2004 4:02 PM Subject: RE: HELP!!! SEVERE: VendorError: 1064 during INSERT > The statement is from a System.out.println() and my code is as follows: > > public boolean insert(String sql) { > > try { > > System.out.println("Executing INSERT SQL Statement -> " > + sql); > statement = conn.createStatement(); > boolean rs = statement.execute(sql); > System.out.println("Completed Executing INSERT SQL > Statement."); > > return true; > > } catch (SQLException ex) { > // handle any errors > constant.log.log("SQLException: " + ex.getMessage(), > Constants.LOG_SEVERE); > constant.log.log("SQLState: " + ex.getSQLState(), > Constants.LOG_SEVERE); > constant.log.log("VendorError: " + ex.getErrorCode(), > Constants.LOG_SEVERE); > return false; > } > } > > The value of sql is: > > INSERT INTO dirxml.emp > (fld_ind_id,fld_frname,fld_srname,fld_init,fld_sh_name1,fld_sh_name2,fld > _posnacty_cd,fld_posnacty_name1,fld_posnacty_name2,fld_emp_job_desc1,fld > _emp_job_desc2,fld_statrsn_cd,fld_statrsn_name1,fld_statrsn_name2,fld_rs > n_cd,fld_aflgrp_cd,fld_aflgrp_name1,fld_aflgrp_name2,fld_city_t_name1,fl > d_city_t_name2,fld_manager_indv_id,fld_comm_lang) > VALUES("100000087","SANIA","RANCOURT","","Miss","Mlle","TFR","T L VISION > FRAN AISE R GIONALE","T L VISION FRAN AISE R GIONALE","MAKE-UP > ARTIST","MAQUILLEUR (EUSE)","R01","RETURN TO ACTIVE STATUS","REMISE EN > ACTIVIT ","019","U2R","STARF","STARF","QUEBEC","QUEBEC","SYSM63","F"); > > Shaffin. > > > > >>> Victor Pendleton <[EMAIL PROTECTED]> 08/11/04 3:41 PM >>> > Can you system.out.println the sql statement to verify what you have is > correct? Also, are you using prepared statements? > > -----Original Message----- > From: Shaffin Bhanji > To: [EMAIL PROTECTED] > Sent: 8/11/04 2:07 PM > Subject: HELP!!! SEVERE: VendorError: 1064 during INSERT > > Hello All, > > I have the following environment: > > MySQL 4.1.3-beta-standard > Connector/J 3.0.14 > SUN Java JDK 1.4.2 > SUSE Linux 9.1 > > I have written a java program to insert information into an "emp" table > as follows: > > INSERT INTO dirxml.emp > (fld_ind_id,fld_frname,fld_srname,fld_init,fld_sh_name1,fld_sh_name2,fld > _posnacty_cd,fld_posnacty_name1,fld_posnacty_name2,fld_emp_job_desc1,fld > _emp_job_desc2,fld_statrsn_cd,fld_statrsn_name1,fld_statrsn_name2,fld_rs > n_cd,fld_aflgrp_cd,fld_aflgrp_name1,fld_aflgrp_name2,fld_city_t_name1,fl > d_city_t_name2,fld_manager_indv_id,fld_comm_lang) > VALUES("100000087","SANIA","RANCOURT","","Miss","Mlle","TFR","T L VISION > FRAN AISE R GIONALE","T L VISION FRAN AISE R GIONALE","MAKE-UP > ARTIST","MAQUILLEUR (EUSE)","R01","RETURN TO ACTIVE STATUS","REMISE EN > ACTIVIT ","019","U2R","STARF","STARF","QUEBEC","QUEBEC","SYSM63","F"); > > When I run this statement from MySQL Control Center, it work without any > errors but when I execute it via java code, I get the following error: > -- > SEVERE: SQLException: Syntax error or access violation, message from > server: "You have an error in your SQL syntax; check the manual that > corresponds to your MySQL server version for the right syntax to use > near '"QUEB' at line 1" > -- > SEVERE: SQLState: 42000 > -- > SEVERE: VendorError: 1064 > > Can someone please help what I may be doing wrong... > > Thanks, > Shaffin. > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]