Hi Prasad and Cristiano, Thanks for your help. A whitespace created the problem.
Thanks, Venkata On Fri, Jun 11, 2010 at 6:06 AM, prasad khatavkar <prasadkhatav...@gmail.com > wrote: > Hi, > > Its related to some syntax error u might typed 1 sumwhr in the program, > remove it and check. > > On Tue, Jun 8, 2010 at 4:47 PM, venkata sukumar kommuru < > venkatasukum...@gmail.com> wrote: > >> Hi, >> >> In the home work of creating tables using jdbc, I am getting the following >> error. >> >> Syntax error: Encountered "1" at line 1, column 27. >> I have created 4 separate files. one for creating cdtable, one for >> creating location table, one for inserting data into location and one for >> inserting data into cd table. The first three have been sucessfully >> executed. But in the last one, I am getting the above error. Please look at >> the following code and let me know my mistake. >> >> >> public static void main(String [] args) >> { >> String url ="jdbc:derby://localhost:1527/sample"; >> Connection con; >> Statement stmt; >> try >> { >> Class.forName("org.apache.derby.jdbc.ClientDriver"); >> } >> catch(java.lang.ClassNotFoundException e) >> { >> System.err.print("classnotfoundexception :" + e.getMessage()); >> } >> try >> { >> con = DriverManager.getConnection(url,"app","app"); >> stmt = con.createStatement(); >> stmt.executeUpdate(" INSERT INTO CDTABLE" + >> *"values(1,'Rock and Roll Aint Noise >> Pollution','AC/DC',1980,1,9)");* >> stmt.executeUpdate(" INSERT INTO CDTABLE" + >> *"VALUES(2,'Shake a Leg','AC/DC',1980,1,6)");* >> stmt.executeUpdate(" INSERT INTO CDTABLE" + >> *"VALUES(3,'Have a Drink on Me','AC/DC',1980,2,5)");* >> stmt.executeUpdate(" INSERT INTO CDTABLE" + >> * "VALUES(4,'You Shook Me All Night Long','AC/DC',1980,1,8)"); >> * >> stmt.executeUpdate(" INSERT INTO CDTABLE" + >> *"VALUES(5,'Back in Black','AC/DC',1980,4,9)");* >> stmt.executeUpdate(" INSERT INTO CDTABLE" + >> * "VALUES(6,'Let Me Put My Love into You','AC/DC',1980,4,9)"); >> * >> stmt.close(); >> con.close(); >> } >> catch(SQLException ex) >> { >> System.err.print(ex.getMessage()); >> } >> } >> >> Thanks, >> Venkata >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Java EE (J2EE) Programming with Passion!" group. >> To post to this group, send email to >> java-ee-j2ee-programming-with-passion@googlegroups.com >> To unsubscribe from this group, send email to >> java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com<java-ee-j2ee-programming-with-passion%2bunsubscr...@googlegroups.com> >> For more options, visit this group at >> >> http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en >> > > > > -- > BR > Pervazive Automation Solutions Pvt Ltd > #3060, 1st floor, 9th Main, > Banashankari 2nd Stage, > Bangalore - 560070 > Ph. 080-42196414 > > Mobile : +919036488648 > +919481328069 > > -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en