• JDBC ResultSet

    By Luis Gonzalez Garcia 3 years ago

    Hi,

    How do I insert a new record in an empty resultset? The table in the database is empty, the SQL statement returns no records and I want to insert the first record.

    Thanks in advance,

    Luis 

    • Sorry,JDBC RowSet

      By Luis Gonzalez Garcia 3 years ago
      • Take a look at JDBC_RowSetDatasource.xsp

        By Andrejus Chaliapinas 3 years ago

        Take a look at JDBC_RowSetDatasource.xsp inside XPagesJDBC.nsf. There you'll find this method used:

        jdbcData1.newRow(getComponent('viewPanel1').getFirst())

        and then also:

        jdbcData1.acceptChanges()

         

        • empty jdbcrowset

          By Luis Gonzalez Garcia 3 years ago

          Hi, thanks for your answer.

          The problem is that the table does not yet have any sql registry, so that the select returns nothing. How do I insert a record in the rowset empty?

          thanks again and best regards,

          Luis

          • this is the error

            By Luis Gonzalez Garcia 3 years ago

            When click on Save button....

             

            The runtime has encountered an unexpected error.
             

            Error source

            Page Name:/hose.xsp
            Control Id: button1
            Property: onclick

             

            Exception

            Error while executing JavaScript action expression
            Script interpreter error, line=1, col=8: Error calling method 'saveRow(com.ibm.xsp.extlib.jdbc.model.JdbcRowSetAccessor$JDBCRecord)' on java class 'com.ibm.xsp.extlib.jdbc.model.JdbcRowSetAccessor'
            Cannot go to row #0
             

            JavaScript code


             

               1: sr_row.saveRow(row);
               2: sr_row.acceptChanges()
            

             

            • Fix provided

              By Philippe Riand 3 years ago

              Will be in the next build

              • empty jdbcrowset

                By Luis Gonzalez Garcia 3 years ago

                Hi Philippe,

                thanks for your response.

                You know approximate dates of the next build?

                 

                Thanks,

                 

                Luis

                • Should be sometimes next week

                  By Philippe Riand 3 years ago

                  I hope early next week, but I'll get a better understanding on Monday :-)

                  • empty jdbcrowset

                    By Luis Gonzalez Garcia 3 years ago

                    ok, I'm still trying things. We are in contact.

                    thank you very much,

                    Luis

              • insert in jdbc empty rowset

                By Luis Gonzalez Garcia 3 years ago

                Hi all,



                how do i insert the first record in a empty table? If select query in jdbcrowset definition results empty,

                when save return the error:



                Error calling method 'saveRow(com.ibm.xsp.extlib.jdbc.model.JdbcRowSetAccessor$JDBCRecord)' on

                java class 'com.ibm.xsp.extlib.jdbc.model.JdbcRowSetAccessor'

                Cannot go to row #0



                In Xpages JDBC Samples nsf database also return this error.



                Thanks in advance,



                Luis

                • How do you reproduce it in the sample DB?

                  By Philippe Riand 3 years ago

                  I added a new button that destroys all the records in the table, but inserting a new record still works.

                  What are the step for reproducing the issue?