Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to use hsqldb read data from xml file

    I am using gwt 2.4, smartgwt 3.1d EE, IE 9, Java 1.7 and Eclipse indigo.
    my full version is SNAPSHOT_v8.3d_2012-07-23/PowerEdition Deployment (built 2012-07-23)

    I am try to follow smartgwtEE include sample built-in-ds to use hsqldb to read data from xml data file.

    My datasource xml file like this;
    Code:
     
     <DataSource ID="dynamicDSNameDS" 
               tableName="datasourceName"
                serverType="sql" 
                recordName="datasource"
                    dbName="ETIDB"
              testFileName="c:/tmp/datasourceName.data.xml">
      
      <fields>
        <field name="name"    nativeName="name"      type="text" primaryKey="true"  />
      </fields>  
      
    </DataSource>
    On my pc c:/tmp directory, have a datasource.name.xml file like this:
    Code:
     
    <List>
      <datasource>
        <name>networksDS</name>
      </datasource>
    
      <datasource>
        <name>networkElementDS</name>
      </datasource>
    
      <datasource>
        <name>networkViewDS</name>
      </datasource>
    </List>
    
    
    My client side java code like this:
    [CODE] 
     private final DataSource  myDSNameDS = DataSource.get("dynamicDSNameDS");
     myDSNameDS.fetchData(null, null);
    When I do my test, I got error pop up like this:
    Table not found in statement [SELECT datasourceName.name FROM datasourceName]

    And log like this:
    === 2012-12-11 12:53:59,783 [l0-2] DEBUG RPCManager - Processing 1 requests.
    === 2012-12-11 12:53:59,790 [l0-2] DEBUG RPCManager - Request #1 (DSRequest) payload: {
    criteria:{
    },
    operationConfig:{
    dataSource:"dynamicDSNameDS",
    operationType:"fetch"
    },
    appID:"builtinApplication",
    operation:"dynamicDSNameDS_fetch",
    oldValues:null
    }
    === 2012-12-11 12:53:59,791 [l0-2] INFO IDACall - Performing 1 operation(s)
    === 2012-12-11 12:53:59,791 [l0-2] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
    === 2012-12-11 12:53:59,791 [l0-2] DEBUG DeclarativeSecurity - DataSource dynamicDSNameDS is not in the pre-checked list, processing...
    === 2012-12-11 12:53:59,791 [l0-2] DEBUG AppBase - [builtinApplication.dynamicDSNameDS_fetch] No userTypes defined, allowing anyone access to all operations for this application
    === 2012-12-11 12:53:59,791 [l0-2] DEBUG AppBase - [builtinApplication.dynamicDSNameDS_fetch] No public zero-argument method named '_dynamicDSNameDS_fetch' found, performing generic datasource operation
    === 2012-12-11 12:53:59,791 [l0-2] INFO SQLDataSource - [builtinApplication.dynamicDSNameDS_fetch] Performing fetch operation with
    criteria: {} values: {}
    === 2012-12-11 12:53:59,792 [l0-2] INFO SQLWhereClause - [builtinApplication.dynamicDSNameDS_fetch] empty condition
    === 2012-12-11 12:53:59,792 [l0-2] INFO SQLDataSource - [builtinApplication.dynamicDSNameDS_fetch] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
    === 2012-12-11 12:53:59,794 [l0-2] INFO SQLDataSource - [builtinApplication.dynamicDSNameDS_fetch] Executing SQL query on 'ETIDB': SELECT datasourceName.name FROM datasourceName WHERE ('1'='1')
    === 2012-12-11 12:53:59,793 [l0-0] INFO DSResponse - [builtinApplication.fetchUserOrgDS_fetch] DSResponse: List with 2 items
    === 2012-12-11 12:53:59,795 [l0-0] DEBUG SQLConnectionManager - About to close PoolableConnection with hashcode "443774024"
    === 2012-12-11 12:53:59,796 [l0-0] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
    === 2012-12-11 12:53:59,797 [l0-2] INFO PoolManager - [builtinApplication.dynamicDSNameDS_fetch] SmartClient pooling started for 'ETIDB' objects
    === 2012-12-11 12:53:59,798 [l0-0] DEBUG RPCManager - non-DMI response, dropExtraFields: false
    === 2012-12-11 12:53:59,799 [l0-2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.dynamicDSNameDS_fetch] Initializing SQL config for 'ETIDB' from system config - using DriverManager: org.hsqldb.jdbcDriver
    === 2012-12-11 12:53:59,799 [l0-2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.dynamicDSNameDS_fetch] org.hsqldb.jdbcDriver lookup successful
    === 2012-12-11 12:53:59,800 [l0-2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.dynamicDSNameDS_fetch] DriverManager fetching connection for ETIDB via jdbc url jdbc:hsqldb:hsql://localhost/isomorphic
    === 2012-12-11 12:53:59,800 [l0-2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.dynamicDSNameDS_fetch] Passing JDBC URL only to getConnection
    === 2012-12-11 12:53:59,801 [l0-0] INFO Compression - /triad40/sc/IDACall: 294 -> 203 bytes
    === 2012-12-11 12:53:59,812 [l0-2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.dynamicDSNameDS_fetch] Returning pooled Connection '1570679478'
    === 2012-12-11 12:53:59,812 [l0-2] DEBUG SQLConnectionManager - [builtinApplication.dynamicDSNameDS_fetch] Returning borrowed connection '1570679478'
    === 2012-12-11 12:53:59,812 [l0-2] DEBUG SQLDriver - [builtinApplication.dynamicDSNameDS_fetch] About to execute SQL query in 'ETIDB' using connection '1570679478'
    === 2012-12-11 12:53:59,812 [l0-2] INFO SQLDriver - [builtinApplication.dynamicDSNameDS_fetch] Executing SQL query on 'ETIDB': SELECT datasourceName.name FROM datasourceName WHERE ('1'='1')
    execute(): eti.client.toolbarfeatures.changedatabase.ChangeDatabaseDialogPresenter$FetchUserOrgCallback@520b56ea
    === 2012-12-11 12:53:59,819 [l0-2] INFO SQLDriver - [builtinApplication.dynamicDSNameDS_fetch] Execute of select: SELECT datasourceName.name FROM datasourceName WHERE ('1'='1') on db: ETIDB threw exception: java.sql.SQLException: Table not found in statement [SELECT datasourceName.name FROM datasourceName] - assuming stale connection and retrying query.
    === 2012-12-11 12:53:59,820 [l0-2] DEBUG SQLConnectionManager - [builtinApplication.dynamicDSNameDS_fetch] About to close PoolableConnection with hashcode "1570679478"
    === 2012-12-11 12:53:59,820 [l0-2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.dynamicDSNameDS_fetch] DriverManager fetching connection for ETIDB via jdbc url jdbc:hsqldb:hsql://localhost/isomorphic
    === 2012-12-11 12:53:59,820 [l0-2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.dynamicDSNameDS_fetch] Passing JDBC URL only to getConnection
    === 2012-12-11 12:53:59,821 [l0-2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.dynamicDSNameDS_fetch] Returning pooled Connection '1249481825'
    === 2012-12-11 12:53:59,822 [l0-2] DEBUG SQLConnectionManager - About to close PoolableConnection with hashcode "1249481825"
    === 2012-12-11 12:53:59,823 [l0-2] WARN RequestContext - dsRequest.execute() failed:
    java.sql.SQLException: Table not found in statement [SELECT datasourceName.name FROM datasourceName]
    at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
    at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
    at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
    at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
    at com.isomorphic.sql.SQLDriver.getTransformedResults(SQLDriver.java:592)
    at com.isomorphic.sql.SQLDriver.executeQuery(SQLDriver.java:848)
    at com.isomorphic.sql.SQLDataSource.executeNativeQuery(SQLDataSource.java:407)
    at com.isomorphic.sql.SQLDataSource.executeNativeQuery(SQLDataSource.java:401)
    at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1367)
    at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:306)
    at com.isomorphic.sql.SQLDataSource.executeFetch(SQLDataSource.java:250)
    at com.isomorphic.datasource.DataSource.execute(DataSource.java:1342)
    at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:726)
    at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
    at com.isomorphic.application.AppBase.execute(AppBase.java:491)
    at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1979)
    at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:216)
    at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:173)
    at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:138)
    at com.isomorphic.servlet.IDACall.doPost(IDACall.java:74)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097)
    at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
    === 2012-12-11 12:53:59,825 [l0-2] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
    === 2012-12-11 12:53:59,827 [l0-2] DEBUG RPCManager - non-DMI response, dropExtraFields: false


    So, my question is, where (what directory) I should put my data.xml file and what is the name for this file?

    Thanks a lot for your help!



    [/CODE]

    #2
    Right now the table does not exist at all. If you want to have a table created in HSQL DB from XML data, you use the Admin Console to do this.

    Comment


      #3
      Thanks a lot for your quick reply. But I am very sorry since I dont know how to use Admin Console to create table. Would you please show me how to do it or gave some document to teach me how to do it.

      Thanks

      Comment


        #4
        The doc is literally titled "Admin Console". Like all overviews except the QuickStart itself, it's in the special "docs" package in JavaDoc.

        Comment

        Working...
        X