[teiid-issues] [JBoss JIRA] (TEIID-3989) PartialResultsWarning not being returned
Tom Arnold (JIRA)
issues at jboss.org
Mon Feb 22 11:03:00 EST 2016
[ https://issues.jboss.org/browse/TEIID-3989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13166467#comment-13166467 ]
Tom Arnold commented on TEIID-3989:
-----------------------------------
Any idea why I'm seeing different behavior between a JBoss AS datasource and a standalone driver/datasource connection?
{code:sql}
select count(*) from (
select item_id from test1.items union all
select item_id from test2.items
) x
{code}
{code:java}
Connection conn = ...
PreparedStatement ps = conn.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
rs.next();
int count = rs.getInt(1);
Assert.assertEquals(3, count);
SQLWarning warn = ps.getWarnings();
Assert.assertNotNull(warn);
Assert.assertTrue("Expected PartialResultsWarning but got " + warn.getClass(),
warn instanceof PartialResultsWarning);
PartialResultsWarning prWarning = (PartialResultsWarning) warn;
Iterator<String> failed = prWarning.getFailedConnectors().iterator();
while (failed.hasNext()) {
System.out.println(failed.next());
}
{code}
If I get the connection using the DriverManager or by creating a {{TeiidDataSource}} then the code works as documented.
{code:java}
conn = DriverManager.getConnection(
"jdbc:teiid:test at mm://localhost:31000;partialResultsMode=true",
"teiid",
"Teiid-123"
);
{code}
or
{code:java}
TeiidDataSource ds = new TeiidDataSource();
ds.setUser("teiid");
ds.setPassword("Teiid-123");
ds.setServerName("localhost");
ds.setPortNumber(31000);
ds.setDatabaseName("test");
ds.setPartialResultsMode("true");
conn = ds.getConnection();
{code}
With the JBoss AS datasource I get TeiidSQLWarning and the code does not work.
{code:java}
DataSource ds = (DataSource) new InitialContext().lookup("java:/teiidDS");
conn = ds.getConnection();
{code}
> PartialResultsWarning not being returned
> ----------------------------------------
>
> Key: TEIID-3989
> URL: https://issues.jboss.org/browse/TEIID-3989
> Project: Teiid
> Issue Type: Bug
> Components: JDBC Driver
> Affects Versions: 8.11.3, 9.0
> Reporter: Tom Arnold
> Assignee: Steven Hawkins
> Attachments: TeiidTest.zip, Test-vdb.xml, translator-test.zip
>
>
> I'm trying to follow the example [here|https://docs.jboss.org/author/display/TEIID/Partial+Results+Mode] to return source failure information to my app. Partial results mode does work, but when used with a JBoss AS datasource (as opposed to standalone) {{TeiidSQLWarning}} is returned instead of the expected {{PartialResultsWarning}}.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the teiid-issues
mailing list