4 Replies Latest reply on Oct 30, 2016 10:54 PM by liu hf

    org.teiid.jdbc.TeiidSQLException: Group does not exist: employee

    liu hf Newbie

      Hi,

       

       

      I am exploring teiid in embedded, version 9.1.

      vdb file:

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

      <vdb name="nothwind" version="1">

          <model name="northwind" type="PHYSICAL">

              <source name="tissource" translator-name="mysql5" connection-jndi-name="java:/jdbcDS"/>

              <metadata type="NATIVE"><![CDATA[

                      CREATE FOREIGN TABLE employee (

                          employee_id integer,

                          FirstName varchar(25),

                          LastName varchar(25)

                      ) OPTIONS(UPDATABLE TRUE);

              ]]> </metadata>

          </model>

      </vdb>

       

       

      the java code:

      public class DataVirtUtil {

           public void deployJdbcVdb() throws Exception {

              EmbeddedServer es = new EmbeddedServer();

              EmbeddedConfiguration ec = new EmbeddedConfiguration();

              ec.setTransactionManager(EmbeddedHelper.getTransactionManager());

       

       

              MySQL5ExecutionFactory ef = new MySQL5ExecutionFactory();

              ef.setSupportsDirectQueryProcedure(true);

              ef.start();

              es.addTranslator("mysql5", ef);

       

       

              //add a Connection Factory with a third-party connection pool

              DataSource ds = EmbeddedHelper.newDataSource(null, null, null, null);

              es.addConnectionFactory("java:/jdbcDS", ds);

       

       

              es.start(ec);

              es.deployVDB(DataVirtUtil.class.getClassLoader().getResourceAsStream("mysql-vdb.xml"));

       

       

              Connection c = es.getDriver().connect("jdbc:teiid:nothwind", null);

       

       

              JDBCUtils.execute(c, "DELETE FROM employee", false);

              JDBCUtils.execute(c, "INSERT INTO employee(employee_id, FirstName, LastName) VALUES (1, 'Test1', 'Test1')", false);

              JDBCUtils.execute(c, "SELECT * FROM employee", true);

       

       

              System.out.println("before stop.");

       

       

              es.stop();

       

       

          }

       

       

          public static void main(String[] args) {

              DataVirtUtil virt = new DataVirtUtil();

              try {

                  virt.deployJdbcVdb();

              } catch (Exception e) {

                  e.printStackTrace();

              }

          }

      }

       

       

      after run, get exception:

      2016-10-28 16:07:54 INFO  COMMAND_LOG:64 - END USER COMMAND: endTime=2016-10-28 16:07:54.25 requestID=sJnQKAgrytGo.0 txID=null sessionID=sJnQKAgrytGo principal=anonymous vdbName=nothwind vdbVersion=1 finalRowCount=-1

      org.teiid.jdbc.TeiidSQLException: Group does not exist: employee

        at org.teiid.jdbc.TeiidSQLException.create(TeiidSQLException.java:135)

        at org.teiid.jdbc.TeiidSQLException.create(TeiidSQLException.java:71)

        at org.teiid.jdbc.StatementImpl.postReceiveResults(StatementImpl.java:723)

        at org.teiid.jdbc.StatementImpl.access$100(StatementImpl.java:65)

        at org.teiid.jdbc.StatementImpl$2.onCompletion(StatementImpl.java:561)

        at org.teiid.client.util.ResultsFuture.addCompletionListener(ResultsFuture.java:148)

        at org.teiid.jdbc.StatementImpl.executeSql(StatementImpl.java:557)

        at org.teiid.jdbc.StatementImpl.execute(StatementImpl.java:1076)

        at org.teiid.jdbc.StatementImpl.execute(StatementImpl.java:339)

        at com.tongtech.tis.resourceaccess.util.JDBCUtils.execute(JDBCUtils.java:85)

        at com.tongtech.tis.resourceaccess.util.DataVirtUtil.deployJdbcVdb(DataVirtUtil.java:73)

        at com.tongtech.tis.resourceaccess.util.DataVirtUtil.main(DataVirtUtil.java:86)

      Caused by: org.teiid.api.exception.query.QueryResolverException: Group does not exist: employee

        at org.teiid.query.resolver.util.ResolverUtil.handleUnresolvedGroup(ResolverUtil.java:880)

        at org.teiid.query.resolver.util.ResolverUtil.resolveGroup(ResolverUtil.java:959)

        at org.teiid.query.resolver.ProcedureContainerResolver.resolveGroup(ProcedureContainerResolver.java:219)

        at org.teiid.query.resolver.ProcedureContainerResolver.resolveCommand(ProcedureContainerResolver.java:141)

        at org.teiid.query.resolver.QueryResolver.resolveCommand(QueryResolver.java:281)

        at org.teiid.query.resolver.QueryResolver.resolveCommand(QueryResolver.java:127)

        at org.teiid.dqp.internal.process.Request.resolveCommand(Request.java:283)

        at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:413)

        at org.teiid.dqp.internal.process.Request.processRequest(Request.java:481)

        at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:655)

        at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:338)

        at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51)

        at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:275)

        at org.teiid.dqp.internal.process.DQPCore.executeRequest(DQPCore.java:313)

        at org.teiid.dqp.internal.process.DQPCore.executeRequest(DQPCore.java:245)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:497)

        at org.teiid.transport.LocalServerConnection$1$1.call(LocalServerConnection.java:179)

        at java.util.concurrent.FutureTask.run(FutureTask.java:266)

        at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:276)

        at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:260)

        at org.teiid.transport.LocalServerConnection$1.invoke(LocalServerConnection.java:177)

        at com.sun.proxy.$Proxy18.executeRequest(Unknown Source)

        at org.teiid.jdbc.StatementImpl.execute(StatementImpl.java:689)

        at org.teiid.jdbc.StatementImpl.executeSql(StatementImpl.java:555)

       

       

      My question is:

      1. Can teiid create table automatic? or must create by manual.

      2. If create by manual, why need vdb file's "CREATE FOREIGN TABLE..." .

       

       

      Thanks!

       

       

      liuhf