Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-3998

EDS 5.3 jdbc driver virtual procedure call against JDV 6.2.3

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • None
    • 8.12
    • None
    • None

    Description

      We identified an issue when trying to connect with EDS 5.3 jdbc driver to JDV 6.2.3 instance.
      The problem is caused by virtual procedure execution.
      Query performed:
      EXEC View.hiddenUpdate(456,'changed')
      View definition:

      <model name="View" type="VIRTUAL">
         <metadata type="DDL"><![CDATA[
      	CREATE VIRTUAL PROCEDURE hiddenUpdate(ID integer,CUSTOMERNAME string) AS BEGIN
         MERGE INTO Customers(id,customername) VALUES(ID,CUSTOMERNAME);
      END
      ]]> </metadata>
      </model>
      

      NPE excepton:

      Exception in thread "main" java.lang.NullPointerException
      	at org.teiid.jdbc.StatementImpl.executeUpdate(StatementImpl.java:342)
      	at jdbcdriver.JDBCClient.executeUpdate(JDBCClient.java:59)
      	at jdbcdriver.JDBCClient.main(JDBCClient.java:52)
      

      Client code:

          @Test
          public void procedureInvalidateCacheTest(){
              String sqlSelectAll = "/*+ cache */SELECT * FROM Customers;";
              try{
                  
                  Utils.executeUpdate(con,"INSERT INTO Customers(id,customername) VALUES (456, 'Testing 1');");
                  
                  ResultSet empty = Utils.executeQuery(con, sqlSelectAll);
                  Assert.assertTrue(empty.next(), "ResultSet should be empty");
                  
                  try{
                      Thread.sleep(3000);
                  }catch(InterruptedException ie){
                      
                  } 
                  
                  Utils.executeUpdate(con,"EXEC View.hiddenUpdate(456,'changed')");
                
                  ResultSet full = Utils.executeQuery(con, sqlSelectAll);
                  Assert.assertTrue(full.next(), "ResultSet shouldn't be empty");
                  
                  int custId = full.getInt(1);
                  String custName = full.getString(2);
                  Assert.assertEquals(custId, 456,"Returned row with wrong customer id");
                  Assert.assertEquals(custName,"changed","PROCEDURE with UPDATE query didn't invalidate the cache:returned row with wrong customer name");
                  
                  
              }catch(SQLException se){
                  LOG.error("Error during performing sql query on teiid",se);
                  Assert.fail("Error during performing sql query on teiid", se);
              }
          }
      
          static Connection getTeiidConnectionUser1() throws SQLException {
              LOG.info("Getting Teiid connection for user1.");
              return TeiidDriver.getInstance().connect(TEIID_URL_USER1, null);
          }
      
          static int executeUpdate(Connection con, String sql) throws SQLException{
              LOG.info("Executing update [connection: " + con + "]: " + sql + ".");
              Statement s = con.createStatement();
              return s.executeUpdate(sql);
          }
      

      Server log is in the attachment.

      Attachments

        Activity

          People

            rhn-engineering-shawkins Steven Hawkins
            felias_jira Filip Elias (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: