[JBoss JIRA] (TEIID-1933) 0 size CLOBs in teiid cause unexpected problems
by Graeme Gillies (JIRA)
Graeme Gillies created TEIID-1933:
-------------------------------------
Summary: 0 size CLOBs in teiid cause unexpected problems
Key: TEIID-1933
URL: https://issues.jboss.org/browse/TEIID-1933
Project: Teiid
Issue Type: Bug
Affects Versions: 7.6
Environment: java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.10) (rhel-1.23.1.9.10.el5_7-x86_64)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)
Running on RHEL 5, teiid 7.6 inside of JBoss EAP 5.1.1
teiid has had the fix in TEIID-1927 applied
Reporter: Graeme Gillies
Assignee: Steven Hawkins
Hi,
this issue is similar to the issue in TEIID-1927, but this time, we are experiencing similar problems when other code is inadvertently calling getSubString on 0 sized CLOB objects from teiid
An example is below that takes some data from teiid and tries to put it into a mysql database
{code}
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Iterator;
import org.teiid.jdbc.TeiidDataSource;
public class TestMain {
private static final String host = "vdb.example.com";
private static final String port = "31000";
private static final String vdb = "EngVDBR";
private static final String user = "user";
private static final String password = "user";
private static final int batchSize = 50000;
public static void main(String[] args) throws Exception {
new TestMain();
}
public TestMain() {
try {
System.out.println("Executing using the TeiidDriver");
Connection connSrc = getSrcConnection();
Connection connTar = getTarConnection();
ArrayList<String> batches = getBatches(getCount(connSrc, "Bugzilla.bugs", "1 = 1"));
System.out.println(batches.size());
Iterator<String> it = batches.iterator();
while (it.hasNext()) {
String str = "select keywords from Bugzilla.bugs order by bug_id "
+ it.next();
System.out.println(str);
execute(connSrc, str, connTar);
}
} catch (Exception e) {
e.printStackTrace();
}
}
static Connection getSrcConnection() throws Exception {
String url = "jdbc:teiid:" + vdb + "@mms://" + host + ":" + port
+ ";showplan=on";
Class.forName("org.teiid.jdbc.TeiidDriver");
return DriverManager.getConnection(url, user, password);
}
static Connection getTarConnection() throws Exception {
String url = "jdbc:mysql://localhost:3306/test";
Class.forName("com.mysql.jdbc.Driver");
return DriverManager.getConnection(url, "test", "test");
}
static Connection getDataSourceConnection() throws Exception {
TeiidDataSource ds = new TeiidDataSource();
ds.setDatabaseName(vdb);
ds.setUser(user);
ds.setPassword(password);
ds.setServerName(host);
ds.setPortNumber(Integer.valueOf(port));
ds.setShowPlan("on");
return ds.getConnection();
}
public static void execute(Connection connSrc, String sql,
Connection connTar) throws Exception {
try {
Statement statement = connSrc.createStatement(
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
// statement.setFetchSize(5000);
ResultSet results = statement.executeQuery(sql);
ResultSetMetaData metadata = results.getMetaData();
int columns = metadata.getColumnCount();
connTar.setAutoCommit(false);
PreparedStatement ps = connTar
.prepareStatement("insert into bugs values("
+ getColStr(columns) + ")");
System.out.println("insert into bugs values(" + getColStr(columns)
+ ")");
for (int row = 1; results.next(); row++) {
for (int i = 1; i <= columns; i++) {
// System.out.println(results.getObject(i));
ps.setObject(i, results.getObject(i));
}
ps.executeUpdate();
}
connTar.commit();
results.close();
statement.close();
} catch (SQLException e) {
e.printStackTrace();
System.exit(1);
} finally {
}
}
public ArrayList<String> getBatches(int tabCnt) {
ArrayList<String> batches = new ArrayList<String>();
int batchLen = 0;
int init = 0;
int endNum = 0;
if (tabCnt % batchSize == 0) {
batchLen = tabCnt / batchSize;
} else {
batchLen = tabCnt / batchSize + 1;
}
for (int i = 0; i < batchLen; i++) {
batches.add(" limit " + init + ", " + batchSize);
endNum = init + batchSize;
init = endNum;
}
return batches;
}
public int getCount(Connection conn, String table, String condition) {
try {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select count(1) from "
+ table + " where " + condition);
if (rs.next()) {
return rs.getInt(1);
}
} catch (Exception e) {
}
return 0;
}
public static String getColStr(int columnCount) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < columnCount; i++) {
sb.append("?,");
}
String str = sb.toString();
return str.substring(0, str.length() - 1);
}
}
{code}
Which throws the following error
{noformat}
Executing using the TeiidDriver
13
select keywords from Bugzilla.bugs order by bug_id limit 0, 50000
insert into bugs values(?)
javax.sql.rowset.serial.SerialException: Invalid position in BLOB object set
at javax.sql.rowset.serial.SerialClob.getSubString(SerialClob.java:246)
at com.mysql.jdbc.PreparedStatement.setClob(PreparedStatement.java:3553)
at com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:3979)
at com.redhat.com.hss.etl.util.TestMain.execute(TestMain.java:93)
at com.redhat.com.hss.etl.util.TestMain.<init>(TestMain.java:40)
at com.redhat.com.hss.etl.util.TestMain.main(TestMain.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
at org.apache.tools.ant.taskdefs.Java.run(Java.java:764)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:218)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
{noformat}
On closer inspection it looks like inside the mysql driver it's calling getSubString(1, 0) on the object because the CLOB object is size 0, which is the problem in the first place.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month
[JBoss JIRA] (TEIID-1903) count() function with salesforce adaptor not behaving correctly
by Graeme Gillies (JIRA)
Graeme Gillies created TEIID-1903:
-------------------------------------
Summary: count() function with salesforce adaptor not behaving correctly
Key: TEIID-1903
URL: https://issues.jboss.org/browse/TEIID-1903
Project: Teiid
Issue Type: Bug
Components: Salesforce Connector
Affects Versions: 7.5
Environment: java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.10) (rhel-1.23.1.9.10.el5_7-x86_64)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)
on
Red Hat Enterprise Linux Server release 5.7 (Tikanga)
Reporter: Graeme Gillies
Assignee: Steven Hawkins
Hi,
I noticed the following strange behaviour with the salesforce connector. In the below example, Bugzilla is normal JDBC datasource to a mysqldb, while SFDC is a salesforce.com datasource
{noformat}
EngVDBR=> select count(*) from Bugzilla.bugs;
count
--------
604680
(1 row)
EngVDBR=> select count(*) from SFDC.salesforce.Case_;
count
--------
455487
(1 row)
EngVDBR=> select count(1) from SFDC.salesforce.Case_;
ERROR: SalesforceAPI: The number of result rows has exceeded the maximum result rows "100,000"
DETAIL: org.teiid.jdbc.TeiidSQLException: SalesforceAPI: The number of result rows has exceeded the maximum result rows "100,000"
EngVDBR=> select count(1) from Bugzilla.bugs;
count
--------
604680
(1 row)
EngVDBR=>
{noformat}
I would have expected count(1) on salesforce to work the same as count(*), but it returns the maxrows error even though it should only return one row.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month
[JBoss JIRA] (TEIID-1906) Settting a VDB with data roles from Teiid Designer 7.5 iand deploying to Teiid 8 get a parser error
by Sunil Varma (JIRA)
Sunil Varma created TEIID-1906:
----------------------------------
Summary: Settting a VDB with data roles from Teiid Designer 7.5 iand deploying to Teiid 8 get a parser error
Key: TEIID-1906
URL: https://issues.jboss.org/browse/TEIID-1906
Project: Teiid
Issue Type: Bug
Components: Common, Tools
Affects Versions: 8.0
Reporter: Sunil Varma
Assignee: Steven Hawkins
When I try to deploy a VDB with data roles set via teiid Designer to Teiid 8 I get a parser error and the VDB fails to deploy. If I remove the data roles then the VDB deploys and I can access it.
Below is the stack trace: Iam using Teiid Designer 7.5 & Teiid 8 Alpha1 on Jboss AS 7.1.0.CR1b.
///////
04:15:42,233 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) Starting deployment of "H2Northwind.vdb"
04:15:42,244 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.unit."H2Northwind.vdb".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."H2Northwind.vdb".PARSE: Failed to process phase PARSE of deployment "H2Northwind.vdb"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) [jboss-as-server-7.1.0.CR1b.jar:7.1.0.CR1b]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_27]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_27]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_27]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[19,13]
Message: Unexpected element 'allow-alter' encountered
at org.teiid.jboss.VDBParserDeployer.parseVDBXML(VDBParserDeployer.java:117)
at org.teiid.jboss.VDBParserDeployer.scanVDB(VDBParserDeployer.java:84)
at org.teiid.jboss.VDBParserDeployer.scanVDB(VDBParserDeployer.java:79)
at org.teiid.jboss.VDBParserDeployer.deploy(VDBParserDeployer.java:68)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.1.0.CR1b.jar:7.1.0.CR1b]
... 5 more
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[19,13]
Message: Unexpected element 'allow-alter' encountered
at org.teiid.adminapi.impl.VDBMetadataParser.parsePermission(VDBMetadataParser.java:179)
at org.teiid.adminapi.impl.VDBMetadataParser.parseDataRole(VDBMetadataParser.java:140)
at org.teiid.adminapi.impl.VDBMetadataParser.parseVDB(VDBMetadataParser.java:94)
at org.teiid.adminapi.impl.VDBMetadataParser.unmarshell(VDBMetadataParser.java:63)
at org.teiid.jboss.VDBParserDeployer.parseVDBXML(VDBParserDeployer.java:107)
... 9 more
04:15:42,247 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."H2Northwind.vdb".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."H2Northwind.vdb".PARSE: Failed to process phase PARSE of deployment "H2Northwind.vdb"
///////////end stack trace
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month
[JBoss JIRA] (TEIID-1851) run.bat in simpleclient for teiid 7.5 incorrect path
by Mike Bailey (Created) (JIRA)
run.bat in simpleclient for teiid 7.5 incorrect path
----------------------------------------------------
Key: TEIID-1851
URL: https://issues.jboss.org/browse/TEIID-1851
Project: Teiid
Issue Type: Bug
Components: Common
Affects Versions: 7.5
Environment: Windows 7
Reporter: Mike Bailey
Assignee: Steven Hawkins
Priority: Minor
following the instructions in the quick start guide and the README for the simpleclient, the command fails when run on windows.
run.bat localhost 31000 dynamicportfolio "select * from tables"
This part of the run.bat is incorrect:
rem Second one adds the Teiid client
set TEIID_PATH=../lib/teiid-7.5.0.Final-client.jar
should be:
rem Second one adds the Teiid client
set TEIID_PATH=../../lib/teiid-7.5.0.Final-client.jar
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month
[JBoss JIRA] (TEIID-1819) Reading multi entity data from a single data file
by Peter Larsen (Created) (JIRA)
Reading multi entity data from a single data file
-------------------------------------------------
Key: TEIID-1819
URL: https://issues.jboss.org/browse/TEIID-1819
Project: Teiid
Issue Type: Feature Request
Components: Connector API
Environment: Any
Reporter: Peter Larsen
Assignee: Steven Hawkins
A common problem for data files is the concept of multiple data sets inclosed in the same file. An example is a data file of accounts receivable orders. You'll export at least two logical entities: Orders and OrderLines. Each of the two entities have very different data sets; the relate (OrderLines belong to a particular Order) and there are a dynamic number of OrderLines per Order.
A common way to differentiate is to put a special "record type" selector as the first field in each record. Ie. A and B. The load program will based on this selector apply different templates to map the columns, and it will also know that the OrderLines are associated with the Order above it and create that relation column ID in the out put.
Example:
;selector=A,orderdate,ordernumber,customernumber,ordertotal,ordertax
;selector=B,lineno,itemno,description,quantity,priceach,pricetotal
A,10-dec-2011,12345,3322,3000,222
B,1,123,Sprockets Black,30,50,1500
B,2,333,Sprockets Blue,300,5,1500
A,11-dec-2011,12346,3311,.....
etc.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month
[JBoss JIRA] (TEIID-1829) Clarify source warnings
by Steven Hawkins (Created) (JIRA)
Clarify source warnings
-----------------------
Key: TEIID-1829
URL: https://issues.jboss.org/browse/TEIID-1829
Project: Teiid
Issue Type: Quality Risk
Components: JDBC Driver
Affects Versions: 7.0
Reporter: Steven Hawkins
Assignee: Steven Hawkins
Fix For: 7.6
When a warning is added through an ExecutionContext, the client receives the exception wrapped by a SourceException, then wrapped as a SQLException. The issues with this are that the SourceException class is not expressly public and there is an unnecessary level of wrapping.
We should introduce a TeiddSQLWarning for non-partial results warnings that would contain source/model information and prevent the unnecessary wrapping.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 1 month