]
RH Bugzilla Integration updated TEIID-3998:
-------------------------------------------
Bugzilla References:
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
Attachments: server1.log
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.