[teiid-issues] [JBoss JIRA] (TEIID-3998) EDS 5.3 jdbc driver virtual procedure call against JDV 6.2.3

Filip Elias (JIRA) issues at jboss.org
Wed Feb 24 11:18:00 EST 2016


Filip Elias created TEIID-3998:
----------------------------------

             Summary: EDS 5.3 jdbc driver virtual procedure call against JDV 6.2.3
                 Key: TEIID-3998
                 URL: https://issues.jboss.org/browse/TEIID-3998
             Project: Teiid
          Issue Type: Bug
    Affects Versions: 8.12
         Environment: eds-5.3.1_1_2015-jdbc
            Reporter: Filip Elias
            Assignee: Steven Hawkins


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:
{code}
<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>
{code}
NPE excepton:
{code}
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)
{code}

Client code:
{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);
    }
{code}

Server log is in the attachment.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the teiid-issues mailing list