[
https://issues.apache.org/jira/browse/TUSCANY-1355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508717
]
wangful commented on TUSCANY-1355:
----------------------------------
I have co the latest codes and mvn them into jar, with this new jar:
if I didn't use the config file, I got the following error:
Exception in thread "main" java.lang.RuntimeException: Unable to obtain table
information from JDBC. DAS configuration must specify ResultDescriptors
at
org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata.<init>(ResultMetadata.java:77)
at
org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata.<init>(GraphBuilderMetadata.java:64)
at
org.apache.tuscany.das.rdb.impl.ReadCommandImpl.buildGraph(ReadCommandImpl.java:81)
at
org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery(ReadCommandImpl.java:63)
at TestDAS.main(TestDAS.java:61)
So I think this error message can tell me that, the new jar can work in my env.
But when I specify the config file,
DAS das =
DAS.FACTORY.createDAS(Thread.currentThread().getContextClassLoader().getResourceAsStream("config.xml"),
conn);
I got the following error:
Exception in thread "main" java.lang.UnsupportedOperationException
at
org.apache.tuscany.sdo.impl.DataObjectBase.getStaticType(DataObjectBase.java:363)
at
org.apache.tuscany.sdo.impl.DataObjectBase.eStaticClass(DataObjectBase.java:358)
at
org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.eClass(ExtensibleDataObjectImpl.java:118)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processObject(XMLHandler.java:2161)
at
org.eclipse.emf.ecore.xmi.impl.SAXXMLHandler.processObject(SAXXMLHandler.java:93)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFeatureType(XMLHandler.java:1926)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHandler.java:1791)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1569)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createDocumentRoot(XMLHandler.java:1237)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1165)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1247)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:883)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
at
org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:362)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
at
org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:538)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
at
org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:259)
at
org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:232)
at
org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:85)
at
org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
at
org.apache.tuscany.das.rdb.util.ConfigUtil.loadConfig(ConfigUtil.java:52)
at org.apache.tuscany.das.rdb.impl.DASImpl.<init>(DASImpl.java:100)
at
org.apache.tuscany.das.rdb.impl.DASFactoryImpl.createDAS(DASFactoryImpl.java:39)
at TestDAS.main(TestDAS.java:55)
And I don't think there is error in my config file, if I even use the sample
config file as below, the error still come out:
<?xml version="1.0" encoding="ASCII"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
<!--Uncomment below for derby test-->
<ConnectionInfo>
<ConnectionProperties
driverClass="org.apache.derby.jdbc.EmbeddedDriver"
databaseURL="jdbc:derby:target/dastest; create = true"
loginTimeout="600000"/>
</ConnectionInfo>
<!--Uncomment below for db2 test-->
<!--<ConnectionInfo dataSource="java:comp/env/jdbc/dastest"
contextAvailable="false">
<ConnectionProperties
dataSourceClass="COM.ibm.db2.jdbc.DB2DataSource"
user="amita"
password="14-174-58-79-82-202-237-108-121-203-238-10-54-180-181-42"
key="193-155-248-97-234-56-100-241"
databaseName="DASTEST"
loginTimeout="600000">
</ConnectionProperties>
</ConnectionInfo>-->
<!--Uncomment below for MySQL test-->
<!--<ConnectionInfo dataSource="java:comp/env/jdbc/dastest"
contextAvailable="false">
<ConnectionProperties
dataSourceClass="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
user="root"
password="192-8-16-141-148-100-119-119"
key="193-155-248-97-234-56-100-241"
databaseName="DASTEST"
loginTimeout="600000">
</ConnectionProperties>
</ConnectionInfo>-->
<Command name="AllCustomers" SQL="select * from CUSTOMER" kind="Select"/>
<Table tableName="CUSTOMER">
<Column columnName="ID" primaryKey="true"/>
</Table>
<Command name="NamedCustomers" SQL="{call GETNAMEDCUSTOMERS(?,?)}"
kind="procedure">
<Parameter direction="IN" index="1"
columnType="commonj.sdo.String"/>
<Parameter direction="OUT" index="2"
columnType="commonj.sdo.IntObject"/>
</Command>
</Config>
Regards.
Frank
> DAS-RDB does not support Oracle or SqlServer well
> -------------------------------------------------
>
> Key: TUSCANY-1355
> URL: https://issues.apache.org/jira/browse/TUSCANY-1355
> Project: Tuscany
> Issue Type: Bug
> Components: Java DAS RDB
> Affects Versions: Java-DAS-M2
> Environment: DAS-RDB to access the database of Oracle
> Reporter: wangful
>
> I have used the following simple codes to use DAS to access an Oracle
> database.
> //String url =
> "jdbc:db2j:D:/RAD6/runtimes/base_v6/cloudscape/DAS";
> String url = "jdbc:oracle:thin:wcs/wcs1@//raptor08:1521/g10";
> String query = "select * from MYCUSTOMER";
> String query_result="";
> Connection conn = null;
> // Class.forName("com.ibm.db2j.jdbc.DB2jDriver").newInstance();
> DriverManager.registerDriver(new
> oracle.jdbc.driver.OracleDriver());
> conn = DriverManager.getConnection(url);
> conn.setAutoCommit(false);
> DAS das =
> DAS.FACTORY.createDAS(conn);
> Command readStores = das.createCommand(query);
> DataObject root = (DataObject)readStores.executeQuery();
> DataObject cus1 = root.getDataObject("MYCUSTOMER[1]");
>
> System.out.println(root.getInt("MYCUSTOMER[1]/ID"));
> System.out.println(root.getString("MYCUSTOMER[1]/NAME"));
> It will caused the following error:
> Exception in thread "main" java.lang.IllegalArgumentException: Class
> 'DataGraphRoot' does not have a feature named 'MYCUSTOMER'
> at
> org.apache.tuscany.sdo.util.DataObjectUtil.getOpenFeature(DataObjectUtil.java:1804)
> at
> org.apache.tuscany.sdo.util.DataObjectUtil.getProperty(DataObjectUtil.java:2367)
> at
> org.apache.tuscany.sdo.impl.DataObjectImpl.getProperty(DataObjectImpl.java:1287)
> at
> org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.setFeatureName(DataObjectUtil.java:2054)
> at
> org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.process(DataObjectUtil.java:2161)
> at
> org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.init(DataObjectUtil.java:1940)
> at
> org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.create(DataObjectUtil.java:1860)
> at
> org.apache.tuscany.sdo.util.DataObjectUtil.get(DataObjectUtil.java:744)
> at
> org.apache.tuscany.sdo.impl.DataObjectImpl.get(DataObjectImpl.java:216)
> at
> org.apache.tuscany.sdo.impl.DataObjectImpl.getDataObject(DataObjectImpl.java:326)
> at TestDAS.main(TestDAS.java:47)
> But the same code and same config will work well for cloudscape database.
> There are also some other problems for Oracle, seems DAS can't work for
> oracle.
> Will someone look into this problem?
> Thanks.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]