Announcement Announcement Module
Collapse
No announcement yet.
Strange Data Access Error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Strange Data Access Error

    I am attempting to depoloy the Spring, JSF, Hibernate My Petstore app from the latest edition of JDJ and I get this error outlined below. When using the sql editor it is clear the table and 5 rows of data exists yet I get the error and a "bad sql grammer error. Can anyone help? :cry:


    INFO: Server startup in 12102 ms
    13:37:46,637 DEBUG ApplicationBean:? - ApplicationBean is created
    13:37:46,684 INFO ServiceLocatorBean:? - Service locator bean is initialized
    13:37:46,694 DEBUG ApplicationBean:? - service locator is set
    13:37:46,696 DEBUG ApplicationBean:? - Initializes ApplicationBean
    13:37:46,896 WARN JDBCExceptionReporter:38 - SQL Error: 1146, SQLState: S1000
    13:37:46,897 ERROR JDBCExceptionReporter:46 - General error, message from server: "Table 'webifyit_2.CATEGORY' doesn't exist"
    13:37:46,903 WARN JDBCExceptionReporter:38 - SQL Error: 1146, SQLState: S1000
    13:37:46,905 ERROR JDBCExceptionReporter:46 - General error, message from server: "Table 'webifyit_2.CATEGORY' doesn't exist"
    13:37:46,917 ERROR JDBCExceptionReporter:38 - Could not execute query
    java.sql.SQLException: General error, message from server: "Table 'webifyit_2.CATEGORY' doesn't exist"
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:1825)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:10 20)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java :1109)
    at com.mysql.jdbc.Connection.execSQL(Connection.java: 2030)
    at com.mysql.jdbc.PreparedStatement.executeQuery(Prep aredStatement.java:1563)
    at org.apache.commons.dbcp.DelegatingPreparedStatemen t.executeQuery(DelegatingPreparedStatement.java:20 5)
    at net.sf.hibernate.impl.BatcherImpl.getResultSet(Bat cherImpl.java:83)

    13:37:46,924 WARN SQLErrorCodeSQLExceptionTranslator:176 - Translating SQLException with SQLState 'S1000' and errorCode '1146' and message [General error, message from server: "Table 'webifyit_2.CATEGORY' doesn't exist"]; SQL was [null] for task [HibernateAccessor]
    13:37:46,926 ERROR CatalogServiceImpl:? - Could not get category list org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [null] in task 'HibernateAccessor'; nested exception is java.sql.SQLException: General error, message from server: "Table 'webifyit_2.CATEGORY' doesn't exist"
    org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [null] in task 'HibernateAccessor'; nested exception is java.sql.SQLException: General error, message from server: "Table 'webifyit_2.CATEGORY' doesn't exist"
    java.sql.SQLException: General error, message from server: "Table 'webifyit_2.CATEGORY' doesn't exist"
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:1825)

  • #2
    Does the user your configured for data access have acces to table 'webifyit_2.CATEGORY' ?

    Comment


    • #3
      Strange Error

      I used this sql to create the database but I didn'
      t give any special grants to the user webifyit_2. Am I missing anything?

      CREATE DATABASE webifyit_2;

      USE webifyit_2;

      CREATE TABLE IF NOT EXISTS supplier (
      suppid int NOT NULL,
      name varchar(80) null,
      status varchar(2) not null,
      addr1 varchar(80) null,
      addr2 varchar(80) null,
      city varchar(80) null,
      state varchar(80) null,
      zip varchar(5) null,
      phone varchar(80) null,
      PRIMARY KEY (suppid));

      CREATE TABLE IF NOT EXISTS signon (
      username varchar(25) not null,
      password varchar(25) not null,
      PRIMARY KEY (username));

      CREATE TABLE IF NOT EXISTS account (
      userid varchar(80) not null,
      email varchar(80) not null,
      firstname varchar(80) not null,
      lastname varchar(80) not null,
      status varchar(2) null,
      addr1 varchar(80) not null,
      addr2 varchar(40) null,
      city varchar(80) not null,
      state varchar(80) not null,
      zip varchar(20) not null,
      country varchar(20) not null,
      phone varchar(80) not null,
      creditcard varchar(80) not null,
      exprdate varchar(7) not null,
      cardtype varchar(80) not null,
      PRIMARY KEY (userid));

      CREATE TABLE IF NOT EXISTS profile (
      userid varchar(80) not null,
      langpref varchar(80) not null,
      favcategory varchar(30),
      mylistopt bool,
      banneropt bool,
      PRIMARY KEY (userid));

      CREATE TABLE IF NOT EXISTS bannerdata (
      favcategory varchar(80) not null,
      bannername varchar(255) null,
      PRIMARY KEY (favcategory));

      CREATE TABLE IF NOT EXISTS orders (
      orderid int not null,
      userid varchar(80) not null,
      orderdate date not null,
      shipaddr1 varchar(80) not null,
      shipaddr2 varchar(80) null,
      shipcity varchar(80) not null,
      shipstate varchar(80) not null,
      shipzip varchar(20) not null,
      shipcountry varchar(20) not null,
      billaddr1 varchar(80) not null,
      billaddr2 varchar(80) null,
      billcity varchar(80) not null,
      billstate varchar(80) not null,
      billzip varchar(20) not null,
      billcountry varchar(20) not null,
      courier varchar(80) not null,
      totalprice decimal(10,2) not null,
      billtofirstname varchar(80) not null,
      billtolastname varchar(80) not null,
      shiptofirstname varchar(80) not null,
      shiptolastname varchar(80) not null,
      creditcard varchar(80) not null,
      exprdate varchar(7) not null,
      cardtype varchar(80) not null,
      locale varchar(20) not null,
      PRIMARY KEY (orderid));

      CREATE TABLE IF NOT EXISTS orderstatus (
      orderid int not null,
      linenum int not null,
      timestamp date not null,
      status varchar(2) not null,
      PRIMARY KEY (orderid, linenum));

      CREATE TABLE IF NOT EXISTS lineitem (
      orderid int not null,
      linenum int not null,
      itemid varchar(10) not null,
      quantity int not null,
      unitprice decimal(10,2) not null,
      PRIMARY KEY (orderid, linenum));

      ALTER TABLE lineitem ADD FOREIGN KEY (orderid)
      REFERENCES orders(orderid)
      ON DELETE RESTRICT
      ON UPDATE RESTRICT;

      CREATE TABLE IF NOT EXISTS category (
      catid varchar(10) not null,
      name varchar(80) null,
      descn varchar(255) null,
      PRIMARY KEY (catid));

      CREATE TABLE IF NOT EXISTS product (
      productid varchar(10) not null,
      category varchar(10) not null,
      name varchar(80) null,
      descn varchar(255) null,
      PRIMARY KEY (productid));

      ALTER TABLE product
      ADD INDEX productCat(category);

      ALTER TABLE product
      ADD INDEX productName(name);

      ALTER TABLE category
      ADD INDEX ixCategoryProduct(catid);

      ALTER TABLE product ADD FOREIGN KEY (category)
      REFERENCES category(catid)
      ON DELETE RESTRICT
      ON UPDATE RESTRICT;

      CREATE TABLE IF NOT EXISTS item (
      itemid varchar(10) not null,
      productid varchar(10) not null,
      listprice decimal(10,2) null,
      unitcost decimal(10,2) null,
      supplier int null,
      status varchar(2) null,
      attr1 varchar(80) null,
      attr2 varchar(80) null,
      attr3 varchar(80) null,
      attr4 varchar(80) null,
      attr5 varchar(80) null,
      PRIMARY KEY (itemid));

      ALTER TABLE item
      ADD INDEX itemProd(productid);

      ALTER TABLE item ADD FOREIGN KEY (productid)
      REFERENCES product(productid)
      ON DELETE RESTRICT
      ON UPDATE RESTRICT;

      ALTER TABLE item ADD FOREIGN KEY (supplier)
      REFERENCES supplier(suppid)
      ON DELETE RESTRICT
      ON UPDATE RESTRICT;

      CREATE TABLE IF NOT EXISTS inventory (
      itemid varchar(10) not null,
      qty int not null,
      PRIMARY KEY (itemid));

      CREATE TABLE IF NOT EXISTS sequence (
      name varchar(20) not null,
      seqnum int not null,
      PRIMARY KEY (name));

      Comment

      Working...
      X