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
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en

Reply via email to