Announcement

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

    Oracle Database Connection

    I need some help regarding a connection to an oracle database.

    Testing the connection with the admin console works but I get a nullpointer exception after starting the console and during the refresh. The database connection also does not shine up.

    Here's my server.properties content:
    Code:
    sql.defaultDatabase: Oracle
    
    sql.Oracle.driver.context: null
    sql.Oracle.driver.serverName: localhost
    sql.Oracle.interface.credentialsInURL: false
    sql.Oracle.driver.driverType: thin
    sql.Oracle.driver.networkProtocol: tcp
    sql.Oracle.driver.portNumber: 1521
    sql.Oracle.useURL: true
    sql.Oracle.driver: oracle.jdbc.driver.OracleDriver
    sql.Oracle.driver.url: jdbc:oracle:thin:@NKGMCSDB:1521/MCSDB
    sql.Oracle.driverName: oracle
    sql.Oracle.database.type: oracle
    sql.Oracle.autoJointTransactions: true
    sql.Oracle.interface.type: driverManager
    sql.Oracle.dbName: MCSDS
    sql.Oracle.driver.name: null
    sql.Oracle.driver.user: mcs
    sql.Oracle.driver.password: mcs
    Here's the exception I get when I hit the save button in the admin console after verifying the database connection with "Test" (The test of the db connection is successful):

    Code:
    16:43:43,780 INFO  [STDOUT:388] === 2011-06-01 16:43:43,780 [80-3] INFO  JNDI - Listing: java:comp/env/security
    16:43:43,780 INFO  [STDOUT:406] === 2011-06-01 16:43:43,780 [80-3] DEBUG JNDI - got NameClassPair with name: securityMgr, class: 'javax.naming.LinkRef'
    16:43:43,780 INFO  [STDOUT:406] === 2011-06-01 16:43:43,780 [80-3] DEBUG JNDI - got NameClassPair with name: subject, class: 'javax.naming.LinkRef'
    16:43:43,780 INFO  [STDOUT:411] === 2011-06-01 16:43:43,780 [80-3] DEBUG RPCDMI - Invocation threw exception
    java.lang.NullPointerException
    	at com.isomorphic.naming.JNDI.searchTreeForClass(JNDI.java:125)
    	at com.isomorphic.naming.JNDI.searchTreeForClass(JNDI.java:131)
    	at com.isomorphic.naming.JNDI.searchTreeForClass(JNDI.java:131)
    	at com.isomorphic.naming.JNDI.searchTreeForClass(JNDI.java:84)
    	at com.isomorphic.sql.SQLConnectionManager.getDefinedDatabaseNames(SQLConnectionManager.java:304)

    #2
    This indicates you've got a null value registered under the name "subject". This may indicate some other subsystem is misconfigured or may indicate a JNDI usage bug in your servlet engine. If you can't find a way to fix this, you can grab the next nightly build to continue using the Admin Console with your servlet engine as it stands, since we've added a check to safely ignore this condition.

    Note that this would affect the Admin Console's autodetection of JNDI-registered database configurations only, not database connectivity in general, even if done via JNDI.

    Comment


      #3
      That's fine. I tried to use the Admin Console in order to create a database connection and to retrieve the smartgwt xml mappings for my entities that I already have defined in my ejb container. -> to bind them to my listgrid.
      I hope that's the right way to do it ...

      The data from the database I get via a JNDI lookup for my ejb service facade with hibernate. This already works. It's just about the mapping files I need.

      Finally, where can I download the latest nightly build? Is that a jar file I have to replace in the WEB-INF/lib then?

      Thank you.

      Comment


        #4
        The Admin Console is for configuring connections for use with SQLDataSource. For Hibernate it's basically auto-detected, or you may have to tell us the ID of the Spring bean that has the config if that's how you're doing it - more details here.

        Nightly builds are at smartclient.com/builds and consist of a complete installation package. Do not attempt to just swap in selected .jars (this won't work) follow the normal installation procedure.

        Comment


          #5
          I'm not sure if I can drive it the way I want it to then.

          The target is to achieve a lazy fetching listgrid with entities coming not directly via a hibernate configuration in the smartgwt web module, rather coming via a JNDI service call, taking e.g. indizes in order to initiate the lazy fetching. Actually I don't want to have any hibernate or database configuration in the smartgwt web module, just a jndi.properties. The annotated entities and service facades are known because of a ejb-client jar in web-inf/lib folder of the smart gwt project. And of course the mapped xml files should be known.

          I attached some source files in order to demonstrate it.

          Perhaps you could help me that.

          Thank you
          Attached Files

          Comment


            #6
            Wow, this is a record-breaking number of questions to do simple load on demand!

            You seem to have successfully taken the startRow and endRow parameters and passed them to some pre-existing service method. SmartGWT does not require any knowledge of how this method works - it doesn't need the Hibernate information or database configuration.

            So could you articulate what problem you are now trying to solve?

            Comment


              #7
              Yes sure.
              We had the problems with JSF frameworks to push at once e.g. 100.000 records into a grid into the browser. If it makes sense to visualize 100.000 statistic records to the user is another question. The first resolution was to page it, but some customers do not want paging, they like to scroll it.
              On the one hand the browser can not render as many records, that's for sure, on the other hand the JSF framework we used (ICEfaces) did not render a scrollable datagrid (listgrid) correctly.
              So the thought was, to take the advantage of a lazy fetching data listgrid of smartgwt using the ejb service facades.
              That's actually the problem I have.
              I need a lazy fetching grid in combination with the service facades and I'm wondering how in dependency of the ui listgrid pixel height the indizes can be transferred correctly to the BasicDataSource extend.

              Comment


                #8
                Hmm, we're really not sure how many more ways we can rephrase the answer to this question..

                Just to take a guess at your possible misconception - do you realize you're calling setTotalRows() with just the number of rows you're currently returning, not the total number of available rows?

                You must provide a totalRows number that is higher than endRow or you are explicitly telling the grid that you have returned all available rows, no more are available, and so paging on scroll will not be used.

                Provide the actual total of beans available to cause the scrollbar to be correctly sized so the user can see the total size of the dataset. Or, just set totalRows to an arbitrary value that is larger than endRow to enable loading more data by the user scrolling to the bottom (this is called progressive loading and is discussed in more detail under the ResultSet docs).

                Comment


                  #9
                  Ok, I will check this out.

                  Thanks so far for your help!

                  Comment


                    #10
                    Hello!

                    Ok, I got everything working. With your latest nightly build the admin console error is gone now and I got the lazy fetching of the listgrid working. Setting the indizes right the fetch method gets invoked each time the user grabs the scrollbar and drags it down or up.

                    I also map my hibernate entities now with the visual builder datasource wizard. I often have an entity with an id class (hibernate creates it like this). How can I reflect this with the gwt mapping?
                    I attachted to xml files, could you please take a look at this if it is right that way? The target is to load the data via JNDI service facade lookup again and use the two mapping files (the entity and id classes) into one listgrid.

                    Now paging in my listgrid works, but when I page/load on demand for a long time, it could eventually be that I reach thousands of rows/records in my listgrid. Does the listgrid come along with this amount of data or is there a way to just let it display only the partial loaded data?

                    Thank you very much.
                    Attached Files
                    Last edited by schmiuwe; 3 Jun 2011, 05:49.

                    Comment


                      #11
                      You generally should not be using the DataSource wizards, since that's one-time auto-generation whereas the schemaBean property gives you ongoing dynamic generation (see QuickStart Guide, Server Framework chapter, first section).

                      You should not be using separate DataSources for your object's unique ids (aka primaryKey="true" fields), they should just be normal fields. It's not normal that Hibernate would end up generating these as classes instead of just atomic types like String or Long and you should correct this.

                      If you somehow can't, you will need to provide an atomic type to SmartGWT with round-trip get/set calls. For example, your bean will need a getter that returns a String representing the id (encoding the id's fields in some way) and a corresponding setter that parses the string and correctly sets the id object.

                      But again, this should not be necessary and is a last resort - configure Hibernate correctly so it's not creating id classes instead.

                      Comment


                        #12
                        Ok, that worked. Finally before we can close this discussion:
                        I adjusted my listgrid to show the row numbers (first column).

                        Code:
                        this.listGrid.setShowRowNumbers(true);
                        The default value is row 1, that worked.
                        Can I give this column a name like e.g. "Index"?

                        I tried it with before calling layout.draw():
                        Code:
                        this.listGrid.getField(0).setName("Index");
                        But at this point the field is still null ...

                        Thank you very much for your help.

                        Comment


                          #13
                          Try calling listGrid.setFieldTitle(0, "Index") from within a listGrid.addDrawHandler(..)

                          Comment

                          Working...
                          X