hi,

try replacing your line with following,

Location_id,  Integer(20) not null primary key

or

Location_id,  int not null primary key

thanks
anand


---------- Forwarded message ----------
From: fernando pardo <ingsopor...@gmail.com>
Date: Sun, Nov 22, 2009 at 9:14 PM
Subject: [java ee programming] lab 1020
To: java-ee-j2ee-programming-with-passion@googlegroups.com


Hello:
Anyone could help me?
I am doing the lab 1020,
I have the following file location.java:

import java.sql.*;
public class location {
public static void main(String[] args) {
        // TODO code application logic here
    String url = "jdbc:derby://localhost:1527/sample";
        Connection con;
        String createString;
        createString = "create table location " +

    "(Location_id,  Integer not NULL PRIMARY KEY, " +
    "Location VARCHAR(40))";
    Statement stmt;
    try {
            // Load database driver. This is old method of loading
            // database driver.
            Class.forName("org.apache.derby.jdbc.ClientDriver");
      } catch(java.lang.ClassNotFoundException e) {
            System.err.print("ClassNotFoundException: ");
            System.err.println(e.getMessage());
        }
   try {
            // Create database connection
            con = DriverManager.getConnection(url,
                    "app", "app");

            // Create a statement and execute it
            stmt = con.createStatement();
            stmt.executeUpdate(createString);

            // If there is no exception, the COFFEES table must be
successfully created
            System.out.println("COFFEES table is successfully created");

            // Close statement and connection
            stmt.close();
            con.close();
        } catch(SQLException ex) {
            System.err.println("SQLException: " + ex.getMessage());
    }
}
}

I run this and appears this failure:

SQLException: Error de sintaxis: Encountered "Integer" at line 1, column 38.
BUILD SUCCESSFUL (total time: 2 seconds)

Anyone could help me?
thanks




 --
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



-- 
Regards,

AnAnD,
Software Engineer,
ZEDO AdServing

.

-- 
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