ResultSet - RowSet - RecordSet

Hi there,
I'm a newbie to Flash Remoting. I'm having difficulty
transferring a result set to flash using an intermittent rowset,
can anyone help?
The result to flash is null with either of the
implementations (commented & uncommented).
import java.sql.*;
import javax.sql.rowset.CachedRowSet;
import com.sun.rowset.CachedRowSetImpl;
public class JavaClassService {
public ResultSet getResultSet(){
Connection connection = null;
try{
Class.forName( "com.mysql.jdbc.Driver" );
connection = DriverManager.getConnection(
"jdbc:mysql://localhost/test", "root", "space7107");
Statement stmt = connection.createStatement();
ResultSet resultset = stmt.executeQuery("SELECT * FROM
testdata");
CachedRowSet crs = new CachedRowSetImpl();
//crs.setUsername("root");
//crs.setPassword("space7107");
//crs.setUrl("jdbc:mysql://localhost/test");
//crs.setCommand("SELECT * FROM testdata");
//crs.execute();
crs.populate(resultset);
resultset.close();
stmt.close();
connection.close();
return crs;
}catch(Exception e){
}finally{
try{
if(connection!= null && !connection.isClosed())
connection.close();
}catch(SQLException e){}
return null;

In case anyone has this problem - Sun 1.5 is required to use
CachedRowset - I had been trying to use 1.4 and the rowset.jar,
which wasn't working. Both commented&uncommented java code work
fine with flash remoting.

Similar Messages

  • Create Resultset/Rowset programatically

    How can I create a resultset/rowset programatically from scratch, without connecting to database. Actually I'm designing an N-tier intranet app. The page controller (JSP) has to pass the data of the HTTP request to the buiness tier in a generic form. As our business tier is using resultset for its methods (for efficiency and simplicity we avoided using a pure object oriented business tier whose objects have the state as their fields. Instead we have resultsets of the whole query that has the data of a single business transaction).
    Is it possible to create rowset without database connection? How?

    You can do it using CachedRowSet:
    import java.sql.*;
    import javax.sql.*;
    import sun.jdbc.rowset.*;
    public class RowSetExample
    public static void main(String args[])
    try {
    // create a new rowset and populate it...
    sun.jdbc.rowset.CachedRowSet crs = new sun.jdbc.rowset.CachedRowSet();
    sun.jdbc.rowset.RowSetMetaDataImpl rsmdi = new sun.jdbc.rowset.RowSetMetaDataImpl();
    int colCount = 2;
    rsmdi.setColumnCount(colCount);
    rsmdi.setColumnDisplaySize(1, 5);
    rsmdi.setColumnName(1, "ID");
    rsmdi.setColumnType(1, java.sql.Types.INTEGER);
    rsmdi.setColumnTypeName(1, "INTEGER");
    rsmdi.setTableName(1, "MY_TABLE");
    rsmdi.setAutoIncrement(1, false);
    rsmdi.setSearchable(1, true);
    rsmdi.setColumnDisplaySize(2, 20);
    rsmdi.setColumnName(2, "NAME");
    rsmdi.setColumnType(2, java.sql.Types.VARCHAR);
    rsmdi.setColumnTypeName(1, "VARCHAR");
    rsmdi.setTableName(2, "MY_TABLE");
    rsmdi.setAutoIncrement(2, false);
    rsmdi.setSearchable(2, true);
    crs.setMetaData(rsmdi);
    java.util.Map map = new java.util.HashMap();
    map.put(new Integer(1), "AAA");
    map.put(new Integer(2), "BBB");
    map.put(new Integer(3), "CCC");
    java.util.Iterator iter = map.entrySet().iterator();
    while (iter.hasNext()){
    java.util.Map.Entry entry = (java.util.Map.Entry) iter.next();
    int idx = 0;
    crs.moveToInsertRow();
    crs.updateObject(1, entry.getKey());
    crs.updateObject(2, entry.getValue());
    crs.insertRow();
    crs.moveToCurrentRow();
    crs.beforeFirst();
    while (crs.next()){
    System.out.print(crs.getObject(1));
    System.out.println(": " + crs.getObject(2));
    }catch (SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    }

  • SSRS Tablix not showing full resultset. Recordset seems truncated.

    Hi,
    I have created a tablix for Test Results History as shown below. All components are added inside of a Rectangle (container). 
    Issue:
    1) This table failed to show full resultset; recordset got truncated. The query returns 316 records, table displays only 239 records, where 240th record got truncated. Please see below screenshot.
    Investigations/Analysis:
    1) I tested with another query that returns 54 records; all records are displayed. Another query that returns 585; only 215 records are displayed. It seems that the number of records is not the limiting factor; the length of the tablix, or the Rectangle
    (container) may possibly be the culprit.
    Question:
    How do I fix this? Please help!

    Hi Simon,
    I do have parameter defined but the "Display Test Result history" parameter only sets below behaviors:
    1) If False, the Rectangle (container) becomes invisible, and the query would return no result (to increase performance)
    2) If True, the Rectangle (container) becomes visible, and the query return valid results
    The behavior I'm seeing right now is that the table is visible, and results are shown. However, some results are missing.
    You may refer to below code:
    declare @SelectedTestPlans nvarchar(500) /* Testing purpose */
    -- set @SelectedTestPlans = '104' /* Testing purpose */
    set @SelectedTestPlans = '81, 79' /* Testing purpose */
    declare @ShowTestResultHistory bit /* Testing purpose */
    set @ShowTestResultHistory = 'true' /* Testing purpose */
    declare @SelectedIDs TABLE(IDs integer)
    insert into @SelectedIDs
    select * from master.dbo.fnSplitIDs(@SelectedTestPlans)
    declare @TestCaseIdsTable TABLE
    TestCaseId int
    /* Update #00-1 - Populate Only TestCaseId */
    insert @TestCaseIdsTable (TestCaseId)
    select distinct
    TestCaseId
    from ([Tfs_Warehouse].[dbo].[FactTestResult] ftr
    inner join [Tfs_Warehouse].[dbo].[DimConfiguration] dc
    on dc.ConfigurationSK = ftr.ConfigurationSK
    inner join @SelectedIDs s
    on ftr.TestPlanSK = s.IDs)
    where (@ShowTestResultHistory = 'true')
    declare @HistoryTable TABLE
    TestCaseId nchar(36),
    Test nvarchar(256),
    Result nvarchar(64),
    OutcomeId tinyint,
    ConfigurationId int,
    Configuration nvarchar(256),
    CreationDate datetime,
    Name nvarchar(4000)
    INSERT @HistoryTable (TestCaseId, Test, Result, OutcomeId, ConfigurationId, Configuration, CreationDate, Name)
    SELECT DR.[TestCaseId]
    ,[Test]
    ,[Outcome] as Result
    ,[OutcomeId]
    ,C.[ConfigurationId]
    ,C.[Name] as Configuration
    ,[CreationDate]
    ,DP.[Name] as 'Run By'
    FROM [Tfs_Warehouse].[dbo].[DimTestResult] DR
    inner join [Tfs_Warehouse].[dbo].[FactTestResult] TR on DR.ResultBK = TR.TestResultBK
    join [Tfs_Warehouse].[dbo].DimConfiguration C on TR.ConfigurationSK = C.ConfigurationSK
    join [Tfs_Warehouse].[dbo].[DimPerson] DP on DR.ExecutedBySK = DP.PersonSK,
    @TestCaseIdsTable TCID
    Where DR.[TestCaseId] = TCID.[TestCaseId]
    And (@ShowTestResultHistory = 'true')
    Select * From @HistoryTable
    Order By [TestCaseId]
    Hmm.. What am I missing here?

  • Bug in SAPbobsCOM.Recordset.GetAsXML()?

    I am using the following code:
    string query =
            "SELECT BoxCode as stBoxcode, (CASE WHEN TaxCode = 'B' THEN BaseAmount ELSE Debit + Credit END) AS Amountx " +
            "FROM (SELECT VatTaxBox.BoxCode, VatTaxBox.TaxCode, SUM(dbo.JDT1.Basesum * VatTaxBox.FSign) as BaseAmount, SUM(dbo.JDT1.Debit * VatTaxBox.FSign) AS Debit, SUM(dbo.JDT1.Credit * VatTaxBox.FSign) AS Credit " +
            "FROM  dbo.JDT1 INNER JOIN dbo.OJDT ON dbo.JDT1.TransId = dbo.OJDT.TransId " +
            "INNER JOIN dbo.OVTG ON dbo.JDT1.VatGroup = dbo.OVTG.Code " +
            "inner join (SELECT  (CASE WHEN BOXx IS NULL THEN VatBoxes.Boxcode ELSE BOXx END) AS BoxCode, VATMember, FormulSignx * FormulSign as FSign, OBOX.summayfld AS TaxCode " +
            "FROM (SELECT TOP 100 PERCENT B11.BoxCode AS BOXx, B0.boxcode, B0.BoxMember, B0.VATMember, isnull((select (case when formulSign='M' then -1 else +1 END) as FSignX from box1 b1 " +
            "where b1.boxcode=B0.boxcode and b1.SeqNum = B0.Seqnum-1), +1) AS FormulSignx, isnull((select (case when formulSign='M' then -1 else +1 END) as FSignX from box1 b1 " +
            "where b1.boxcode=B11.boxcode and b1.SeqNum = B11.Seqnum-1), +1) AS FormulSign " +
            "FROM BOX1 B0 LEFT OUTER JOIN BOX1 B11 ON B0.BoxCode = B11.BoxMember " +
            "WHERE (NOT (B0.VATMember IS NULL)) ORDER BY B11.BoxCode, B0.BoxCode, B0.SeqNum) AS VatBoxes " +
            "INNER JOIN OBOX ON VatBoxes.boxcode = obox.boxcode) as VatTaxBox ON JDT1.VatGroup = VatTaxBox.VATMember " +
            "WHERE (dbo.OJDT.RefDate >= '2005/01/01') AND (dbo.OJDT.RefDate <= '2005/07/01') AND OJDT.Series = 4 GROUP BY VatTaxBox.BoxCode, VatTaxBox.TaxCode ) as ResultSet ";
          SAPbobsCOM.Recordset rs = (SAPbobsCOM.Recordset)_sapCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
          try
            rs.DoQuery(query);
            int i = rs.RecordCount;
            int j = i++;
            string s = rs.GetAsXML(); //-> throws an error: "External component has thrown an exception."
          catch (Exception ex)
            System.Windows.Forms.MessageBox.Show(ex.ToString());
    The statement rs.GetAsXML() throws an exception. However when I use a simpler query everything works fine.
    What am I doing wrong?
    Jurgen

    I don't specifically, but one trick I've learned of is to "hide" complex SQL queries in functions or stored procedures.  SBO sometimes has problems with complex SQL queries.  They're aware of this, but until it's fixed, try putting that "monster" in a function or a view. 
    Hope that helps.

  • Ms Access problems with Jdbc Odbc!!!

    Hi again people,
    Im creating a GUI swing project connecting a database (MsAccess) to a dialog using the bridge driver,
    The GUI is coming up but im getting runtime errors and the data does not go to the fields, the dialog and connection are in two files:
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*; //SQL package for the statements
    import javax.swing.*;
    class DatabaseMan
         public ResultSet m_resultSet; //recordset resulting from SQL query
         public ResultSetMetaData m_rsmd; //used to get general info about the columns
         private int m_nNumberOfFields; //number of fields in a recordset
         private Connection conn;
         private Statement stmt;
         public DatabaseMan(String strSQLQuery)
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");          
                   try               //establish connection to the database
                        //try to get connection to the database
                        conn = DriverManager.getConnection("jdbc:odbc:db1");
                        //this is not where we update the database so we make it read only
                        stmt = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE,
                                                                     ResultSet.CONCUR_READ_ONLY);                                   
                        m_resultSet = stmt.executeQuery(strSQLQuery);
                   catch(SQLException exSQL)
                        System.err.println("\n\n\t\t ***SQLException has" +
                                                 "been caught ***\n\n");
                   while ( exSQL != null)
                        System.err.println("\nSQLState : " + exSQL.getSQLState() );
                   System.err.println("\nMessage : " + exSQL.getMessage() );
                             System.err.println("\nVendor code : "+ exSQL.getErrorCode() );
                             System.err.println("\n");
                             exSQL = exSQL.getNextException();
              catch( ClassNotFoundException e)
                   System.err.print("\n\n\tClassNotFoundException has"
                                       +" been caught");
                   System.err.println( e.getMessage());
              catch( java.lang.Exception ex )
                   ex.printStackTrace();
         public void CloseConnection() //close connection to database
              try
                        conn.close();
                        stmt.close();
                        m_resultSet.close(); //release the resources
                   catch (SQLException exSQL )
                        System.out.println("SQL Exception: " + exSQL.getMessage());
                        exSQL.printStackTrace(System.out);
         public int getNoFields()
              return m_nNumberOfFields;
    } //end of DatabaseMan.java
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    import DatabaseMan;
    import javax.swing.*;
    class DBviewer extends JDialog implements ActionListener
         //JButtons to create toolbar
         private JButton m_buttonFirst;
         private JButton m_buttonNext;
         private JButton m_buttonPrevious;
         private JButton m_buttonLast;
         private JButton m_buttonClose;
         private JButton m_mainbuttonClose;
         //textfields to transfer the data from database
         private JTextField m_name;
         private JTextField m_age;
         private JTextField m_weight;
         private JTextField m_professionalism;
         private JTextField m_speed;
         private JTextField m_acceleration;
         private JTextField m_jump;
         private JTextField m_stamina;
         private JTextField m_bravery;
         private JTextField m_fitness;
         private JTextField m_experience;
         //labels to identify the textfields
         private JLabel m_labelname;
         private JLabel m_labelage;
         private JLabel m_labelweight;
         private JLabel m_labelspeed;
         private JLabel m_labelacceleration;
         private JLabel m_labelprofessionalism;
         private JLabel m_labeljump;
         private JLabel m_labelstamina;
         private JLabel m_labelbravery;
         private JLabel m_labelfitness;
         private JLabel m_labelexperience;
         DatabaseMan m_DatabaseMan;
         private String strSQLQuery1;
         private String type1 = new String("");
         public DBviewer(Frame parent, String caption, boolean bModal, String type)
              super(parent,caption,true);
              setSize(600,400);
              setLocation( new Point(150 , 150 )); //position it pops up on screen.
              setResizable(false);
              strSQLQuery1 = new String("");
              type1 = type;
              //SQL query to show the horse database
              if(type =="Horse")
                   strSQLQuery1 ="SELECT *" +
                                  "FROM HORSE";
                   buildHorseGUI();
              if(type =="Jockey")
                   strSQLQuery1 ="SELECT *" +
                                  "FROM JOCKEY"+
                                  " ORDER BY NAME";
                   buildJockeyGUI();                         
              if(type =="Course")
                   strSQLQuery1 ="SELECT *" +
                   "FROM RACECOURSE"+
                                  " ORDER BY NAME";
                   buildCourseGUI();
              m_DatabaseMan = new DatabaseMan(strSQLQuery1);
              /*try
              {//reset values with default move up to top later
                   if(m_DatabaseMan.m_resultSet.first())
                        transferData(type1);
              catch( SQLException exSQL)
                   System.out.println("SQL Exception: " + exSQL.getMessage());
                   exSQL.printStackTrace(System.out);
         public void buildHorseGUI() //construct the horse GUI
              buildDefaultGUI(); //build default buttons and toolbar
              m_labelname = new JLabel(" Horse Name:",JLabel.CENTER);
              m_labelname.setBackground(Color.blue);
              m_labelname.setForeground(Color.white);
              m_labelage = new JLabel("Age: ",JLabel.CENTER);
              m_labelage.setBackground(Color.blue);
              m_labelage.setForeground(Color.white);     
              m_labelweight = new JLabel("Weight(p): ",JLabel.CENTER);
              m_labelweight.setBackground(Color.blue);
              m_labelweight.setForeground(Color.white);
              m_labelspeed = new JLabel("Speed:",JLabel.CENTER);
              m_labelspeed.setBackground(Color.blue);
              m_labelspeed.setForeground(Color.white);
              m_labelacceleration = new JLabel("Acceleration:",JLabel.CENTER);
              m_labelacceleration.setBackground(Color.blue);
              m_labelacceleration.setForeground(Color.white);
              m_labelprofessionalism = new JLabel("Professionalism:",JLabel.CENTER);
              m_labelprofessionalism.setBackground(Color.blue);
              m_labelprofessionalism.setForeground(Color.white);
              m_labeljump = new JLabel("Jump:",JLabel.CENTER);
              m_labeljump.setBackground(Color.blue);
              m_labeljump.setForeground(Color.white);
              m_labelstamina = new JLabel("Stamina:",JLabel.CENTER);
              m_labelstamina.setBackground(Color.blue);
              m_labelstamina.setForeground(Color.white);     
              m_labelbravery = new JLabel("Bravery:",JLabel.CENTER);
              m_labelbravery.setBackground(Color.blue);
              m_labelbravery.setForeground(Color.white);
              m_labelfitness = new JLabel("Fitness:",JLabel.CENTER);
              m_labelfitness.setBackground(Color.blue);
              m_labelfitness.setForeground(Color.white);     
              m_labelexperience = new JLabel("Experience",JLabel.CENTER);
              m_labelexperience.setBackground(Color.blue);
              m_labelexperience.setForeground(Color.white);          
              //creation of textfields to hold the data
              //making them non-editable and b/ground of black with white text
              m_name = new JTextField(20);
              m_name.setEditable(false);
              m_name.setBackground(Color.black);
              m_name.setForeground(Color.white);
              m_age = new JTextField(2);
              m_age.setEditable(false);
              m_age.setBackground(Color.black);
              m_age.setForeground(Color.white);
              m_weight = new JTextField(3);
              m_weight.setEditable(false);
              m_weight.setBackground(Color.black);
              m_weight.setForeground(Color.white);
              m_speed = new JTextField(2);
              m_speed.setEditable(false);
              m_speed.setBackground(Color.black);
              m_speed.setForeground(Color.white);
              m_acceleration = new JTextField(2);
              m_acceleration.setEditable(false);
              m_acceleration.setBackground(Color.black);
              m_acceleration.setForeground(Color.white);
              m_professionalism = new JTextField(2);
              m_professionalism.setEditable(false);
              m_professionalism.setBackground(Color.black);
              m_professionalism.setForeground(Color.white);
              m_jump = new JTextField(2);
              m_jump.setEditable(false);
              m_jump.setBackground(Color.black);
              m_jump.setForeground(Color.white);
              m_stamina = new JTextField(2);
              m_stamina.setEditable(false);
              m_stamina.setBackground(Color.black);
              m_stamina.setForeground(Color.white);
              m_bravery = new JTextField(2);
              m_bravery.setEditable(false);
              m_bravery.setBackground(Color.black);
              m_bravery.setForeground(Color.white);
              m_fitness = new JTextField(2);
              m_fitness.setEditable(false);
              m_fitness.setBackground(Color.black);
              m_fitness.setForeground(Color.white);
              m_experience = new JTextField(2);
              m_experience.setEditable(false);
              m_experience.setBackground(Color.black);
              m_experience.setForeground(Color.white);
              //create a panel to hold this data
              Panel data = new Panel();
              data.setLayout(new GridLayout(0,4));
              data.setBackground(Color.blue);
              data.add(m_labelname);
              data.add(m_name);
              data.add(m_labelage);
              data.add(m_age);
              data.add(m_labelweight);
              data.add(m_weight);
              data.add(m_labelspeed);
              data.add(m_speed);
              data.add(m_labelacceleration);
              data.add(m_acceleration);
              data.add(m_labelprofessionalism);
              data.add(m_professionalism);
              data.add(m_labeljump);
              data.add(m_jump);
              data.add(m_labelstamina);
              data.add(m_stamina);
              data.add(m_labelbravery);
              data.add(m_bravery);
              data.add(m_labelfitness);
              data.add(m_fitness);
              data.add(m_labelexperience);
              data.add(m_experience);
              getContentPane().add(data, BorderLayout.CENTER);
         public void buildDefaultGUI() //construct the default components for GUI
              JToolBar wndToolBar = new JToolBar();
              wndToolBar.setBackground(Color.green);
              wndToolBar.setFloatable(false);
              m_buttonFirst = new JButton( new ImageIcon( "graphic/myFirst.gif" ) );
              m_buttonPrevious = new JButton(new ImageIcon( "graphic/myPrevious.gif" ) );
              m_buttonNext = new JButton(new ImageIcon( "graphic/myNext.gif" ) );
              m_buttonLast = new JButton(new ImageIcon( "graphic/myLast.gif" ) );
              m_buttonClose = new JButton(new ImageIcon( "graphic/myClose.gif" ) );
              m_mainbuttonClose = new JButton("CLOSE");
              // implement action listener
              m_buttonFirst.addActionListener(this);
              m_buttonPrevious.addActionListener(this);
              m_buttonNext.addActionListener(this);
              m_buttonLast.addActionListener(this);
              m_buttonClose.addActionListener(this);
              m_mainbuttonClose.addActionListener(this);
              //set the tool tips for each of the button
              m_buttonFirst.setToolTipText( "Display first record" );
              m_buttonPrevious.setToolTipText( "Display previous record" );
              m_buttonNext.setToolTipText( "Display next record" );
              m_buttonLast.setToolTipText( "Display last record" );
              m_buttonClose.setToolTipText( "Close this window and return to game" );
              m_mainbuttonClose.setToolTipText( "Close this window and return to game" );
              m_mainbuttonClose.setBackground(Color.green);
              //add these buttons to the toolbar
              wndToolBar.add( m_buttonFirst );
              wndToolBar.add( m_buttonPrevious );
              wndToolBar.add( m_buttonNext );
              wndToolBar.add( m_buttonLast );
              wndToolBar.addSeparator(); //separator in the toolbar
              wndToolBar.add( m_buttonClose );
              getContentPane().add(wndToolBar, BorderLayout.NORTH);
              getContentPane().add(m_mainbuttonClose, BorderLayout.SOUTH);
         public void buildCourseGUI() //construct the course GUI
              buildDefaultGUI();
         public void buildJockeyGUI() //construct the jockey GUI
              buildDefaultGUI();
         public void actionPerformed( ActionEvent evt)
              //button first record is pressed
              if( evt.getSource() == m_buttonFirst )
                   try
                        if( m_DatabaseMan.m_resultSet.first() )
                             transferData(type1);
                   catch (SQLException exSQL )
                        System.err.println( exSQL.toString() );
              //button next record is pressed
              if( evt.getSource() == m_buttonNext )
                   try
                        if(!m_DatabaseMan.m_resultSet.isLast())
                             if(m_DatabaseMan.m_resultSet.next())
                                  transferData(type1);
                   catch (SQLException exSQL )
                        System.err.println( exSQL.toString() );
              //previous button is pressed
              if( evt.getSource() == m_buttonPrevious )
                   try
                        if( !m_DatabaseMan.m_resultSet.first())
                             if(m_DatabaseMan.m_resultSet.previous())
                                  transferData(type1);
                   catch (SQLException exSQL )
                        System.err.println( exSQL.toString() );
              //last button is pressed
              if( evt.getSource() == m_buttonLast )
                   try
                        if(m_DatabaseMan.m_resultSet.last())
                             transferData(type1);
                   catch (SQLException exSQL )
                        System.err.println( exSQL.toString() );
              // close button(s) pressed
              if( evt.getSource() == m_buttonClose)
                   setVisible( false );
                   dispose(); //return the dialog window resources
                   m_DatabaseMan.CloseConnection();
              if( evt.getSource() == m_mainbuttonClose)
                   setVisible( false );
                   dispose(); //return the dialog window resources
                   m_DatabaseMan.CloseConnection();
         public void transferData(String type1) throws SQLException //return a String
              if(type1 =="Horse")
                   //transfer horse details
                   m_name.setText(m_DatabaseMan.m_resultSet.getString("NAME"));
                   m_professionalism.setText(m_DatabaseMan.m_resultSet.getString("PROFESSIONALISM"));
                   m_speed.setText(m_DatabaseMan.m_resultSet.getString("SPEED"));
                   m_stamina.setText(m_DatabaseMan.m_resultSet.getString("STAMINA"));
                   m_weight.setText(m_DatabaseMan.m_resultSet.getString("WEIGHT"));
                   m_experience.setText(m_DatabaseMan.m_resultSet.getString("EXPERIENCE"));
                   m_fitness.setText(m_DatabaseMan.m_resultSet.getString("FITNESS"));
                   m_jump.setText(m_DatabaseMan.m_resultSet.getString("JUMP"));
                   m_age.setText(m_DatabaseMan.m_resultSet.getString("AGE"));
                   m_bravery.setText(m_DatabaseMan.m_resultSet.getString("BRAVERY"));
                   m_acceleration.setText(m_DatabaseMan.m_resultSet.getString("ACCELERATION"));
              if(type1 =="Jockey")
                   m_name.setText(m_DatabaseMan.m_resultSet.getString("NAME"));
                   m_age.setText(m_DatabaseMan.m_resultSet.getString("AGE"));
              if(type1 =="Course")
                   //transfer course details not implemented yet
    } //end of class DBviewer
    I ve set up an odbc driver and the database has data in it but I still get this run time error an no data is transfered to the dialog box
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1525)
    at sun.jdbc.odbc.JdbcOdbcResultSet.reWordAsCountQuery(JdbcOdbcResultSet.java:6268)
    at sun.jdbc.odbc.JdbcOdbcResultSet.calculateRowCount(JdbcOdbcResultSet.java:6061)
    at sun.jdbc.odbc.JdbcOdbcResultSet.initialize(JdbcOdbcResultSet.java:150)
    at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet(JdbcOdbcStatement.java:420)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:250)
    at DatabaseMan.<init>(DatabaseMan.java:34)
    at DBviewer.<init>(DBviewer.java:83)
    at MainWindow.actionPerformed(MainWindow.java:266)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:216)
    at java.awt.Component.processMouseEvent(Component.java:3715)
    at java.awt.Component.processEvent(Component.java:3544)
    at java.awt.Container.processEvent(Container.java:1164)
    at java.awt.Component.dispatchEventImpl(Component.java:2593)
    at java.awt.Container.dispatchEventImpl(Container.java:1213)
    at java.awt.Component.dispatchEvent(Component.java:2497)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
    at java.awt.Container.dispatchEventImpl(Container.java:1200)
    at java.awt.Window.dispatchEventImpl(Window.java:914)
    at java.awt.Component.dispatchEvent(Component.java:2497)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
    Im really stuck!!! any suggestions? thanks in advance

    Thank you for your response and sorry for the length
    of code,
    Thats was my first idea that it was asking for
    or something I dont have but I checked my database and
    I dont have any unusually large data entries (most
    between 8-15 letters, the others are numbers) could it
    be something wrong with how I've entered the database
    in MsAccess, or am i barking up the wrong tree again!
    Many thanks
    RobI think you've misunderstood me. This has nothing to do with unusually large data entries, but rather the opposite. You are wrongly expecting data that is shorter than you think. When you call rs.getString(i) to retrieve a column value of a field, and you only want the first 5 characters in the column (instead of 10 or whatever the column size is), you would do something similar to the following:
    String column_value = rs.getString(1).subtstring(0,5);The above expects a String that is at least 5 characters. Your problem is when your column value returned is less than the specified substring index ( in this case 5 ) it will throw an exception. If you changed your code to this, the error will not occur:
    String column_value = rs.getString( 1 ).subtstring( 0, 5);
    if ( column_value.length() > 5 )
    column_value = column_value.substring( 0, 5 );
    }Jamie

  • Problem in generating a xml

    i am developing a application in which i am creating a xml when i am doing it with tomcat it is working but when i am doing it with sun application server it is not creating xml i think it is because of all the files are bundled in war file.i am attaching that file also if u have some sol. plz. tell me thanks in advanced.
    package view.action;
    import datasources.*;
    import view.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Text;
    import org.w3c.dom.NamedNodeMap;
    import org.w3c.dom.Node;
    import org.w3c.dom.ProcessingInstruction;
    import org.w3c.dom.Attr;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    public class BeanGenerateXML
    private String sfilename = "";
    private String sSQLWhere = "";      //To store the Filename
    private Document doc;               //To store the XML doc
              private ResultSet rst;               //Recordset from which the XML doc has to be built
              private FileWriter fs;               //File writer
              private BrowseSession session;
              private DBConnectorImpl dbDataSource;     //This for using database API's
              public BeanGenerateXML(BrowseSession session){
              this.session = session;
              //Set the Condition
         public void setSQLWhere(String pSQLWhere) {
                   if (pSQLWhere!=null && pSQLWhere != "")
                        sSQLWhere = " WHERE " + pSQLWhere;
              //Set the filename
         public void setFileName(String pfilename) {
                   sfilename = pfilename;
              //Get the filename
         public String getFileName(String x) {
                   return sfilename;
              //Generate XML Document from the recordset
         public void Generate()
         try
    //Create Document
    DocumentBuilderFactory dbf =DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    doc = db.newDocument();
         Element main,root,item;
         //the Top element
         main = doc.createElement("faqs");
         main.appendChild(doc.createTextNode("\n"));
         String nfaqid = "";
         String sfaq = "";
         String sfaqans = "";
    //               String sfaqgroup = "";
                   int icounter=1;
                   String field = "";
                   while (rst.next())
         //should check whether there is data not implemented
         nfaqid = rst.getString(1);
         sfaq = rst.getString(2);
         sfaqans = rst.getString(3);
    //                    sfaqgroup = rst.getString(4);
         root = doc.createElement("faq");
         root.appendChild(doc.createTextNode("\n"));
         //add nfaqid Element
         item = doc.createElement("nfaqid");
         item.appendChild(doc.createTextNode(nfaqid));
         root.appendChild(item);
         root.appendChild(doc.createTextNode("\n"));
         //add sfaq Element
         item = doc.createElement("sfaq");
         item.appendChild(doc.createTextNode(sfaq));
         root.appendChild(item);
         root.appendChild(doc.createTextNode("\n"));
         //add sfaqans Element
         item = doc.createElement("sfaqans");
         item.appendChild(doc.createTextNode(sfaqans));
         root.appendChild(item);
         root.appendChild(doc.createTextNode("\n"));
         //add sfaqroup Element
    //      item = doc.createElement("sfaqgroup");
    //      item.appendChild(doc.createTextNode(sfaqgroup));
    //      root.appendChild(item);
    //     root.appendChild(doc.createTextNode("\n"));
                        field = "idMenuItem" + icounter;
         //add sfaqans Element
         item = doc.createElement("lfaqname");
         item.appendChild(doc.createTextNode(field));
         root.appendChild(item);
         root.appendChild(doc.createTextNode("\n"));     
                        field = "idMenuItem" + icounter + "Detail";
         //add sfaqans Element
         item = doc.createElement("lfaqans");
         item.appendChild(doc.createTextNode(field));
         root.appendChild(item);
         root.appendChild(doc.createTextNode("\n"));          
                        icounter = icounter + 1;
         //add to the Top Element
         main.appendChild(root);
         main.appendChild(doc.createTextNode("\n"));
         }//end of for
         doc.appendChild(main);
                   //close the resultset and connection after the use
                   rst.close();
                   dbDataSource.Close();
         catch(Exception e)
         System.out.println("Error " + e);
         }//end of generate
         //walk the DOM tree and Build as you go
         private void Walk(Node node) throws IOException
         int type = node.getNodeType();
         switch(type)
         case Node.DOCUMENT_NODE:
         fs.write("<?xml version=\"1.0\" encoding=\""+ "UTF-8" + "\"?>");
         break;
         }//end of document
         case Node.ELEMENT_NODE:
         fs.write('<' + node.getNodeName() );
         NamedNodeMap nnm = node.getAttributes();
         if(nnm != null )
    int len = nnm.getLength() ;
    Attr attr;
    for ( int i = 0; i < len; i++ )
    attr = (Attr)nnm.item(i);
    fs.write(' ' + attr.getNodeName() + "=\"" + attr.getNodeValue() + '"' );
         fs.write('>');
         break;
         }//end of element
         case Node.ENTITY_REFERENCE_NODE:
         fs.write('&' + node.getNodeName() + ';' );
         break;
         }//end of entity
         case Node.CDATA_SECTION_NODE:
    fs.write( "<![CDATA[" + node.getNodeValue() + "]]>" );
    break;
         case Node.TEXT_NODE:
         fs.write(node.getNodeValue());
         break;
         case Node.PROCESSING_INSTRUCTION_NODE:
         fs.write("<?" + node.getNodeName() ) ;
         String data = node.getNodeValue();
         if ( data != null && data.length() > 0 ) {
         fs.write(' ');
         fs.write(data);
         fs.write("?>");
         break;
         }//end of switch
         //recurse
         for(Node child = node.getFirstChild(); child != null; child = child.getNextSibling())
         Walk(child);
         //without this the ending tags will miss
         if ( type == Node.ELEMENT_NODE )
         fs.write("</" + node.getNodeName() + ">");
         }//end of Walk
         private void LoadData()
         try {
                        dbDataSource = new DBConnectorImpl(this.session);
                        //open database connection
                        dbDataSource.DBConnect();
                        //Set SQL to be executed
                        dbDataSource.setSQL("SELECT nFAQid, sFAQ, sFAQans FROM FAQ" + sSQLWhere);
                        //Store the result for in a local copy
                        rst = dbDataSource.getResultSet();
         catch (ClassNotFoundException ex) {
         System.out.print(ex.getMessage());
         catch (SQLException ex) {
         System.out.print(ex.getMessage());
         catch (Exception ex) {
         System.out.print(ex.getMessage());
         }//end of LoadData
              //Build the XML file
         public void BuildXML() throws IOException
         fs = new FileWriter(sfilename); //Enter the file name
                   LoadData();     //Load data fro FAQ
                   Generate(); //Generate the XML File
         Walk(doc); //Output the Doc XML into a file
                   fs.close();
         }//end of BuildXML
    }

    To achieve what you'd like to do, you will need to use Data Templates as a data source. The data template can then reference the JDBC connection to the BI Server. Using data templates will allow you to solve both of your problems (non-flat result sets and linked queries).
    Using Answers as a data source or using SQL against the BI Server will always result in a flat XML structure getting generated.
    Bryan
    Message was edited by:
    bwise

  • Using TimesTen in a heterogeneous  environment

    TimesTen works as a standalone server or in conjunction with Oracle and other TimesTen datastores.
    Since TimesTen uses native odbc connections (or possibly others) is there anyway one can connect TimesTen to other RDBMS as oposed to Oracle. If so what connection mechanisms can be used for this purpose.
    Tthanks,
    Mich

    OK with tracing enabled including to the client screen (driver manager has a GUI interface from Sybase to turn on tracing etc I get):
    Table CACHEADM.SALES2:
    Columns:
    PROD_ID NUMBER NOT NULL
    CUST_ID NUMBER NOT NULL
    TIME_ID DATE NOT NULL
    CHANNEL_ID NUMBER NOT NULL
    PROMO_ID NUMBER NOT NULL
    QUANTITY_SOLD NUMBER (10,2) NOT NULL
    AMOUNT_SOLD NUMBER (10,2) NOT NULL
    Ok this table has only 10 rows. I bet the cause is that time_id column conversion!
    1> select PROD_ID, CUST_ID,CHANNEL_ID, PROMO_ID, QUANTITY_SOLD, AMOUNT_SOLD from sales2
    2> go
    PROD_ID CUST_ID CHANNEL_ID PROMO_ID QUANTITY_SOLD AMOUNT_SOLD
    13.000000 987.000000 3.000000 999.000000 1.00 1283.26
    13.000000 1660.000000 3.000000 999.000000 1.00 1283.26
    13.000000 1762.000000 3.000000 999.000000 1.00 1283.26
    13.000000 1843.000000 3.000000 999.000000 1.00 1283.26
    13.000000 1948.000000 3.000000 999.000000 1.00 1283.26
    13.000000 2273.000000 3.000000 999.000000 1.00 1283.26
    13.000000 2380.000000 3.000000 999.000000 1.00 1283.26
    13.000000 2683.000000 3.000000 999.000000 1.00 1283.26
    13.000000 2865.000000 3.000000 999.000000 1.00 1283.26
    13.000000 4663.000000 3.000000 999.000000 1.00 1283.26
    Results processing ended, MaxResultSize limit, [1000], reached.
    (10 rows affected)
    Now let us try the date field time_id
    1> select TIME_ID from sales2
    2> go
    Explicit or implicit COMMIT failed.
    Results Processing, Conversion Error
    Results Processing, Conversion Error
    Results Processing, Conversion Error
    Results Processing, Conversion Error
    Results Processing, Conversion Error
    Results Processing, Conversion Error
    Results Processing, Conversion Error
    Results Processing, Conversion Error
    Results Processing, Conversion Error
    Results Processing, Conversion Error
    TIME_ID
    (10 rows affected)
    And the trace file shows:
    TraceEvents 03/22/2010 11:42:03.321187 TimesTen 12 cacheadm isql [slcon.cpp(814)] > smConnectionConcrete::Language
    TraceEvents 03/22/2010 11:42:03.321263 TimesTen 12 cacheadm isql [slcon.cpp(1634)] > smConnectionConcrete::SqlTransform: mode [passthrough]
    TraceEvents 03/22/2010 11:42:03.321282 TimesTen 12 cacheadm isql [sqlxform.cpp(69)] > dcplus::SqlTransform-0280-: [|0|select TIME_ID from sales2 ]
    TraceEvents 03/22/2010 11:42:03.321310 TimesTen 12 cacheadm isql [sqlxform.cpp(95)] < dcplus::SqlTransform-0282-: TSQL0 Finished
    TraceEvents 03/22/2010 11:42:03.321378 TimesTen 12 cacheadm isql [slcon.cpp(1792)] < smConnectionConcrete::SqlTransform: [1]
    TraceEvents 03/22/2010 11:42:03.321414 TimesTen 12 cacheadm isql [smdcamsg.cpp(468)] L½» ttimdb1_client 10009488 NULL NULL > smConnectionConcrete::executeSql
    TraceEvents 03/22/2010 11:42:03.321435 TimesTen 12 cacheadm isql [dcalang.cpp(137)] > smConnectionConcrete::executeSql
    TraceEvents 03/22/2010 11:42:03.321459 TimesTen 12 cacheadm isql [smdcamsg.cpp(468)] L½» ttimdb1_client 10009488 NULL NULL > smConnectionConcrete::connectTarget[work/oracle/TimesTen_store/ttimdb1]
    TraceEvents 03/22/2010 11:42:03.321502 TimesTen 12 cacheadm isql [smdcamsg.cpp(468)] L½» ttimdb1_client 10009488 NULL NULL smConnectionConcrete::dcaLanguage: Request contains [1] statements.
    TraceEvents 03/22/2010 11:42:03.321529 TimesTen 12 cacheadm isql [smdcamsg.cpp(468)] L½» ttimdb1_client 10009488 NULL NULL smConnectionConcrete::dcalanguage: statement [select TIME_ID from sales2]
    TraceEvents 03/22/2010 11:42:03.321557 TimesTen 12 cacheadm isql [smdcamsg.cpp(468)] L½» ttimdb1_client 10009488 NULL NULL > smConnectionConcrete::buildStatement
    TraceEvents 03/22/2010 11:42:03.321623 TimesTen 12 cacheadm isql [smdcamsg.cpp(468)] L½» ttimdb1_client 10009488 NULL NULL < smConnectionConcrete::buildStatement, deleteStatement status: 1
    TraceInterface 03/22/2010 11:42:03.321673 TimesTen 12 cacheadm isql [slcon.cpp(2223)] Trace API Level ENTER odbcBaseStatement():SQLAllocStmt [99d2d80]
    TraceInterface 03/22/2010 11:42:03.321696 TimesTen 12 cacheadm isql [slcon.cpp(2223)] Trace API Level EXIT odbcBaseStatement():SQLAllocStmt [9b054e0] with return code 0
    TraceInterface 03/22/2010 11:42:03.321718 TimesTen 12 cacheadm isql [slcon.cpp(2223)] Trace API Level ENTER odbcBaseStatement():SQLSetStmtAttr [9b054e0 | 1 | 1000]
    TraceInterface 03/22/2010 11:42:03.321740 TimesTen 12 cacheadm isql [slcon.cpp(2223)] Trace API Level EXIT odbcBaseStatement():SQLSetStmtAttr with return code 0
    TraceEvents 03/22/2010 11:42:03.321765 TimesTen 12 cacheadm isql [smdcamsg.cpp(468)] L½» ttimdb1_client 10009488 NULL NULL < smConnectionConcrete::buildStatement
    TraceEvents 03/22/2010 11:42:03.321789 TimesTen 12 cacheadm isql [smdcamsg.cpp(468)] L½» ttimdb1_client 10009488 NULL NULL > smConnectionConcrete::executeLanguageStatement
    TraceInterface 03/22/2010 11:42:03.321887 TimesTen 12 cacheadm isql [slcon.cpp(2223)] Trace API Level ENTER odbcBaseStatement():SQLPrepare [9b054e0 | request=select TIME_ID from sales2 | length=26]
    TraceInterface 03/22/2010 11:42:03.321910 TimesTen 12 cacheadm isql [slcon.cpp(2223)] Trace API Level EXIT odbcBaseStatement():SQLPrepare with return code 0
    TraceInterface 03/22/2010 11:42:03.321965 TimesTen 12 cacheadm isql [slcon.cpp(2223)] Trace API Level ENTER odbcBaseStatement():SQLExecute [9b054e0]
    TraceInterface 03/22/2010 11:42:03.321987 TimesTen 12 cacheadm isql [slcon.cpp(2223)] Trace API Level EXIT odbcBaseStatement():SQLExecute with return code 0
    TraceInterface 03/22/2010 11:42:03.322052 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level ENTER odbcBaseResult():SQLNumResultCols [9b054e0]
    TraceInterface 03/22/2010 11:42:03.322074 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level EXIT odbcBaseResult():SQLNumResultCols [ column count=1]
    TraceInterface 03/22/2010 11:42:03.322096 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level odbcBaseResult::createSchema SQL_MAX_COLUMN_NAME_LEN[30]
    TraceInterface 03/22/2010 11:42:03.322118 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level ENTER odbcBaseResult():SQLDescribeCol [9b054e0 | column number=1]
    TraceInterface 03/22/2010 11:42:03.322140 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level EXIT odbcBaseResult():SQLDescribeCol [column name=TIME_ID | column length=7 | datetype= 93 | precision=20 | scale=0 | nullable=0] with return code 0
    TraceInterface 03/22/2010 11:42:03.322163 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level odbcBaseResult::createSchema Column Number 1 Column Name[TIME_ID] SQL TYPE[93] Precision[20] Scale[0] Nullable[0] Max Length[26]
    TraceInterface 03/22/2010 11:42:03.322182 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level ENTER odbcBaseResult():SQLBindCol [9b054e0 | column number=1 | SQL C type=1 | length=27]
    TraceInterface 03/22/2010 11:42:03.322201 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level EXIT odbcBaseResult():SQLBindCol with return code 0
    TraceEvents 03/22/2010 11:42:03.322231 TimesTen 12 cacheadm isql [smdcamsg.cpp(468)] L½» ttimdb1_client 10009488 NULL NULL > smConnectionConcrete::processResults, rowSetResults
    TraceInterface 03/22/2010 11:42:03.322266 TimesTen 12 cacheadm isql [dcaresult.cpp(2146)] Trace API Level ODBC type[93] maps to CS Type[0]
    TraceInterface 03/22/2010 11:42:03.322367 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level ENTER odbcRowSetResult():SQLFetch [9b054e0]
    TraceInterface 03/22/2010 11:42:03.322390 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level EXIST odbcRowSetResult():SQLFetch with return code 0
    TraceTarget 03/22/2010 11:42:03.322412 TimesTen 12 cacheadm isql [dcaresult.cpp(2186)] Trace_DATA_Level SQLFetch [9b054e0|column number=1|SQL C type=1|datalength=19]
    TraceTarget 03/22/2010 11:42:03.322434 TimesTen 12 cacheadm isql [dcaresult.cpp(2186)] Trace_DATA_Level odbc value returned by SQLFetch is:1998-01-10 00:00:00
    TraceInterface 03/22/2010 11:42:03.322452 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level Rows Fetched into Row Set [1]
    TraceEvents 03/22/2010 11:42:03.322475 TimesTen 12 cacheadm isql [smdcamsg.cpp(468)] L½» ttimdb1_client 10009488 NULL NULL ResultSet rowset contains [1] rows.
    TraceTarget 03/22/2010 11:42:03.322577 TimesTen 12 cacheadm isql [dcaresult.cpp(2150)] Trace_DATA_Level dtConverter::toTdsRow Column Number 1
    TraceTarget 03/22/2010 11:42:03.322601 TimesTen 12 cacheadm isql [dcaresult.cpp(2150)] Trace_DATA_Level odbcValue: Column Name[TIME_ID] SQL TYPE[93] Described SQL TYPE[93] Precision[20] Scale[0] Nullable[0] Max Length[26]
    TraceTarget 03/22/2010 11:42:03.322622 TimesTen 12 cacheadm isql [dcaresult.cpp(2150)] Trace_DATA_Level Odbc value= 1998-01-10 00:00:00
    TraceTarget 03/22/2010 11:42:03.322650 TimesTen 12 cacheadm isql [dcaresult.cpp(2150)] Trace_DATA_Level original tdsValue: Column Name[TIME_ID] SQL TYPE[12] Precision[20] Scale[0] Nullable[0] Max Length[8]
    TraceTarget 03/22/2010 11:42:03.322672 TimesTen 12 cacheadm isql [dcaresult.cpp(2150)] Trace_DATA_Level data convert failed, use default datetime string
    TraceTarget 03/22/2010 11:42:03.322695 TimesTen 12 cacheadm isql [dcaresult.cpp(2150)] Trace_DATA_Level converted tdsValue: Column Name[TIME_ID] SQL TYPE[12] Precision[20] Scale[0] Nullable[0] Max Length[8] Data Length[8]
    TraceInterface 03/22/2010 11:42:03.322906 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level ENTER odbcRowSetResult():SQLFetch [9b054e0]
    TraceInterface 03/22/2010 11:42:03.322929 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level EXIST odbcRowSetResult():SQLFetch with return code 0
    TraceTarget 03/22/2010 11:42:03.322951 TimesTen 12 cacheadm isql [dcaresult.cpp(2186)] Trace_DATA_Level SQLFetch [9b054e0|column number=1|SQL C type=1|datalength=19]
    TraceTarget 03/22/2010 11:42:03.322973 TimesTen 12 cacheadm isql [dcaresult.cpp(2186)] Trace_DATA_Level odbc value returned by SQLFetch is:1998-01-10 00:00:00
    TraceInterface 03/22/2010 11:42:03.322993 TimesTen 12 cacheadm isql [dcaresult.cpp(2182)] Trace API Level Rows Fetched into Row Set [1]
    TraceEvents 03/22/2010 11:42:03.323023 TimesTen 12 cacheadm isql [smdcamsg.cpp(468)] L½» ttimdb1_client 10009488 NULL NULL ResultSet rowset contains [1] rows.
    TraceTarget 03/22/2010 11:42:03.323099 TimesTen 12 cacheadm isql [dcaresult.cpp(2150)] Trace_DATA_Level dtConverter::toTdsRow Column Number 1
    TraceTarget 03/22/2010 11:42:03.323120 TimesTen 12 cacheadm isql [dcaresult.cpp(2150)] Trace_DATA_Level odbcValue: Column Name[TIME_ID] SQL TYPE[93] Described SQL TYPE[93] Precision[20] Scale[0] Nullable[0] Max Length[26]
    TraceTarget 03/22/2010 11:42:03.323139 TimesTen 12 cacheadm isql [dcaresult.cpp(2150)] Trace_DATA_Level Odbc value= 1998-01-10 00:00:00
    TraceTarget 03/22/2010 11:42:03.323160 TimesTen 12 cacheadm isql [dcaresult.cpp(2150)] Trace_DATA_Level original tdsValue: Column Name[TIME_ID] SQL TYPE[12] Precision[20] Scale[0] Nullable[0] Max Length[8]
    TraceTarget 03/22/2010 11:42:03.323181 TimesTen 12 cacheadm isql [dcaresult.cpp(2150)] Trace_DATA_Level data convert failed, use default datetime string <-- Error here
    Note the last line data convert failed!

  • Tomcat 4 - value of URL param disappear after calling sendRedirect()

    Environment:
    Tomcat 4.0.1
    Windows 2000
    XSQLServlet (xdk_java_9_0_1_2_0)
    Problem: The test2002.xsql page (converted with test2002XSL.xsl)
    call utility servlet test2002Servlet.java to prepare
    page parameters for SQL query and redirect (sendRedirect)
    back to the same page (test2002.xsql) after click on
    search button on the appropriate form.
    If the search condition is "Search Name" (the string column
    MP01_NAME in database table SYSADM.MP01) everything is OK
    If the search condition is Search ID (the NUMBER column MP01_TYP
    in the database table SYSADM.MP01) the value of returned
    parameters disappear.
    The same piece of code works OK on Tomcat 3.3
    (I know that this version of XSQLServlet is certified with
    Tomcat 3.2, but I do
    want to know what is the reason of this problem)
    Here are the source codes:
    1. TABLE MP01 with two columns; MP01_TYP NUMBER and MP01_NAME
    STRING
    2. test2002.xsql (the XSQL page)
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <?xml-stylesheet type="text/xsl" href="test2002XSL.xsl" ?>
    <page connection="mer" p= "" query=" " select="*" search=""
    xmlns:xsql="urn:oracle-xsql">
         <search>
              <xsql:include-param name="search"/>
              <xsql:include-param name="select"/>
         </search>
         <resultset>
              <xsql:query tag-case="upper">
    SELECT mp01_typ, mp01_name
    FROM sysadm.mp01
    {@query}
    </xsql:query>
         </resultset>
    </page>
    3. test2002XSL.xsl (the XSL transform page)
    <?xml version="1.0"?>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" ident="no"/>
    <!-- Root template -->
    <xsl:template match="/">
    <html>
    <head>
    <title>TITLE</title>
    </head>
    <body>
    <xsl:apply-templates select="page/search"/>
    <xsl:apply-templates select="page/resultset"/>
    </body>
    </html>
    </xsl:template>
    <!--
    + RESULTSET TEMPLaTE
    -->
    <xsl:template match="page/resultset">
    <!-- Resultset Column Titles -->
    <table width ="100%">
    <tr>
    <td width = "30%">ID</td>
    <td width = "70%">NAME</td>
    </tr>
    <xsl:apply-templates/>
    </table>
    </xsl:template>
    <!-- ResultSet Data -->
    <xsl:template match="resultset/ROWSET/ROW">
    <tr>
    <td><xsl:value-of select="MP01_TYP"/></td>
    <td><xsl:value-of select="MP01_NAME"/></td>
    </tr>
    </xsl:template>
    <!--
    + END RESULTSET
    -->
    <!-- SEARCH -->
    <xsl:template match="search">
    <b>
    <form action="servlet/test2002Servlet"
    method="post" name="search" >
    <input type="hidden" name="h_returnTo"
    value="test2002.xsql"/>
    <input type="hidden" name="h_table" value="mp01"/>
    <table>
    <tr>
    <td >
    <select name="select" size="1">
    <xsl:choose>
    <xsl:when test="/page/search/select
    = 's_mp01_name'" >
    <option value="n_mp01_typ">Search ID
    =   </option>
    <option value="s_mp01_name" selected
    = "">Search Name Like:   </option>
    </xsl:when>
    <xsl:otherwise>
    <option value="n_mp01_typ" selected
    = "">Search ID =   </option>
    <option value="s_mp01_name">Search Name
    Like:   </option>
    </xsl:otherwise>
    </xsl:choose>
    </select>
    </td>
    <td>
    <input type="text" name="search"
    value="{search}" size="35" maxlength="35"/>
    </td>
    <td>
    <input type="image" SRC="images/go.gif"
    ALT="Search_now" width="21" height="21"/>
    </td>
    </tr>
    </table>
    </form>
    </b>
    </xsl:template>
    <!--
    + END of SEARCH
    -->
    </xsl:stylesheet>
    4. test2002Servlet.java
    // chage /galiot/ to your context
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class test2002Servlet extends HttpServlet {
    * Initialize global variables
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    * Process the HTTP Get request
    public void doGet(HttpServletRequest req, HttpServletResponse
    res)
    throws ServletException, IOException {
    doPost(req, res);
    * Process the HTTP Post request
    public void doPost(HttpServletRequest req, HttpServletResponse
    res) throws ServletException, IOException {
    String r_returnTo = "";
    String r_table = "";
    String r_conditionBefore = "";
    String r_conditionAfter = "";
    String r_column = "";
    String r_search= "";
    String r_searchType = "";
    String r_returnString = "";
    String r_select = "";
    Enumeration paramNames = req.getParameterNames();
    // Get Param Names
    while(paramNames.hasMoreElements()) {
    String paramName = (String)paramNames.nextElement();
    // Look at paramNames to create return Params
    // First the XSQL page to redirect
    if(paramName.equals("h_returnTo")) {
    String[] paramValues = req.getParameterValues
    (paramName);
    r_returnTo = paramValues[0];
    //Second name of the table in database
    } else if (paramName.equals("h_table")) {
    String[] paramValues = req.getParameterValues
    (paramName);
    r_table = paramValues[0];
    //Search conditions
    } else if (paramName.equals("search")) {
    String[] paramValues = req.getParameterValues
    (paramName);
    r_search = paramValues[0];
    // If search is string than to UpperCase
    if (r_searchType.equals("s")) {
    r_search = r_search.toUpperCase();
    //Create search conditions in the SQL Statement
    } else if (paramName.equals("select")) {
    String[] paramValues = req.getParameterValues
    (paramName);
    r_select = paramValues[0];
    r_column = paramValues[0].substring(2);
    r_searchType = paramValues[0].substring(0,1);
    if (r_searchType.equals("s")) {
    r_search = r_search.toUpperCase();
    r_conditionBefore = " LIKE '%25";
    r_conditionAfter = "%25'";
    } else if (r_searchType.equals("n")) {
    r_conditionBefore = " = ";
    r_conditionAfter = " ";
    // WORNING cahnge my context galiot to your
    r_returnString = "/galiot/" +
    r_returnTo +
    "?" +
    "query=" +
    " WHERE " +
    r_column +
    r_conditionBefore +
    r_search +
    r_conditionAfter +
    "&" +
    "search=" +
    r_search +
    "&" +
    "select=" +
    r_select;
    try {
    System.out.println("SendRedirect: " + r_returnString);
    res.sendRedirect(r_returnString);
    } catch (Exception e) {
    System.out.println("Error " + e.toString());

    Hi
    how do you let your user log in from your page ?
    It's easy to write you own login form instead of the seeded one and give the p_back_url the correct value including the parameters of the current page (retrieved via javascript for instance)
    L.

  • CLI0125E Function sequence error

    Hi,
    I'm using Websphere 3.5.2 and in consequence Java 1.2.2.
    I already read bug database link: http://developer.java.sun.com/developer/bugParade/bugs/4243452.html
    In our code we commonly execute database queries using a connection, a prepared statement and a result set. Each component has its own methods for accessing database.
    We use servlets acessing a specific table in database (DB2 v.6) and a fa�ade method to access another table.
    Ex: A servlet to add orders to the database in table TBL_ORDERS. To populate the combo with customers we instantiate the Curstomers EJB (that acesses the TBL_CUSTOMERS), and populate an array with the resultset of the Curstomers EJB.
    The second call to ResultSet.next() gives us a "CLI0125E Function sequence error".
    The following is our code flow:
    public void LoadFromDatabase(Connection inputCon)
    throws Exception
    aVector = new Vector();
    PreparedStatement tmpStmt = null;
    ResultSet tmpRS = null;
    String tmpSQLQuery = "SELECT * " +
    "FROM TBL_ORDERS" +
    "WHERE order_number = ?";
    tmpStmt = inputCon.prepareStatement(tmpSQLQuery);
    tmpStmt.setString(1, "0001");
    tmpRS = tmpStmt.executeQuery();
    // call the other component
    aVector = getList();
    // The error occurs on the execution of tmpRS.next(), a "CLI0125E Function sequence error".
    tmpRS.next()
    tmpRS.close();
    tmpStmt.close();
    } // end of method to load object from database
    //method getList()
    public Vector geList() {
    Vector resp = new Vector();
    try {
    InitialContext jndiContext = new InitialContext();
    Object objref = jndiContext.lookup("app/Customers");
    BasEmpGrpBicHome home =
    (BasEmpGrpBicHome) javax.rmi.PortableRemoteObject.narrow(objref,
    BasEmpGrpBicHome.class);
    BasEmpGrpBic oBasEmpGrpBic = home.create(oEnv);
    Enumeration elements ;
    elements = oBasEmpGrpBic.getCustomersListVector().elements();
    for (int i=0;elements.hasMoreElements();i++)
    BasEmpGrpBicView oAux = (BasEmpGrpBicView)elements.nextElement();
    resp.add(oAux);
    return resp ;
    } catch (Exception e) {
    e.printStackTrace();
    return null ;
    The method getCustomersListVector() has the same database interation stile.
    Any idea what I can do to solve this problem?
    Thanks a lot!

    I am running WEBSphere 3.5.3 connecting to DB2 (both on AIX) via JDBC. I am using connection pooling (connecting via the datasource factory). If I set the datasource properties on WEBSphere to 1 MinConnection and 1 MaxConnection everything works fine. If I bump up the Min & Max Connections I get the CLI0125E on occassion. Any ideas ?
    Here is a snippet of the code:
    private Connection ConnectToDB() throws ...
    if ( ctx == null )
    ctx = new InitialContext(parms);
    ds = (DataSource)ctx.lookup( "jdbc/" + url );
    return ds.getConnection(username, password);
    public RecordSet GetData( String sql ) throws PruDataException
    Statement statement=null;
    ResultSet resultSet=null;
    RecordSet aRecordSet=null;
    Connection connection = null;
    String resultString;
    connection = ConnectToDB();
    connection.setReadOnly(true);
         statement = connection.createStatement();
         resultSet = statement.executeQuery(sql);
    aRecordSet = new RecordSet( resultSet );
         resultSet.close();
         statement.close();
         connection.close();
    return aRecordSet;
    public RecordSet( ResultSet resultSet ) throws SQLException {
         setColandRowData( resultSet );
    private void setColandRowData( ResultSet rs ) throws SQLException
         int totalCols;
    ResultSetMetaData rsmd = rs.getMetaData();
    totalCols = rsmd.getColumnCount();
    colNames = new String[ totalCols ];
         //add column names to string array
    for (int i = 1; i <= totalCols; ++i)
         colNames[i-1] = rsmd.getColumnName(i);
         while ( rs.next() )
         colData = new Object[ totalCols ];
         for (int i = 1; i <= totalCols; ++i)
              if (rsmd.getColumnTypeName( i ).equalsIgnoreCase("clob") )
                        Clob aClob = rs.getClob(i);
                             if ( aClob == null )
                        colData[i-1] = null;
                             else
                                  colData[i-1] = aClob.getSubString(1,(int)aClob.length() );
              else
                   colData[i-1] = rs.getObject(i);
         rowData.addElement( colData );
         rowCount++;
    ****** sample calling code *****
    DataRequest aDataReq = new DataRequest();
    RecordSet rs = aDataReq.GetData("SELECT ......");
    if ( rs.RowCount() == 0 )
         throw new WEBFactoryException( "No data found..");

  • JDBC connection suspends application

    Hi,
    I have tried to create a database connection with JDBC, but when I run the application, it "gets stuck" when it tries to create that connection. It doesn't really suspend the thread, but the application just hangs there and shows no indication of whether the connection worked or failed.
    Has anyone run across that problem before? How do I solve that?
    my code:
                    Statement anfrage = null;
              ResultSet rowset = null;
              try {
                  DriverManager.registerDriver(new Driver());
                  Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test?" +
                                                 "user=xxxx&password=xxxx");
                  // send queries
                  anfrage = conn.createStatement();
                  rowset = anfrage.executeQuery("SELECT * FROM parseddata");
                  while(rowset.next()){
                       System.out.println(rowset.getString("id") + " :works");
                  rowset.close();
                  anfrage.close();
              } catch (SQLException ex) {
                  // handle any errors
                  System.out.println("SQLException: " + ex.getMessage());
                  System.out.println("SQLState: " + ex.getSQLState());
                  System.out.println("VendorError: " + ex.getErrorCode());
              }the driver and the connection settings are correct (I have tried to see if the connection fails by giving invalid parameters to the connection attempt), so I'm out of ideas. It just never reaches anfrage = conn.createStatement();, but it also doesn't throw an exception (Threadstate running).
    regards,
    Ulrich

    Hi b00nlander,
    Here was my problem:
    Using mysql-connector-java-5.1.5 and MySql Ver 11.18 Distrib 3.23.58, for redhat-linux-gnu (i386) I found that DriverManager.getConnection() would work fine when access to the mysql server was denied due to invalid username/password combination.
    The problem only came when supplying correct details: the call getConnection() just hung.
    I solved this problem by DOWNGRADING the version of mysql-connector to mysql-connector-java-3.1.14. I surpose one could upgrade mysql to a later release to solve this problem also.
    It would seem that there is just an incompatibility between these versions of drivers and mysql?
    Regards,
    Ken.

  • Updating one row updates every row in the table

    I'm having a weird problem in which I insert a row into a table, select that row, and update its columns, and all the rows in the table end up with those columns all set to the new value. Like this:
    A B C
    1 4 7
    2 3 8
    9 6 7
    Statement s1 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    s1.execute("INSERT INTO table (A) VALUES (5)");
    Statement s2 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    RecordSet rs = s2.executeQuery("SELECT * FROM table WHERE A=5");
    if (rs.next()) {
      rs.updateInt("B", 4);
      rs.updateInt("C", 6);
      rs.updateRow();
    A B C
    1 4 6
    2 4 6
    9 4 6
    5 4 6I'm using Mac OS X 10.4.9, OpenBase Solo 10.0.5, and Java 1.5. I hope someone has experienced this before because it has me befuddled.
    Here is the actual code from my program:
    Statement st;
    ResultSet rs;
    st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    rs = st.executeQuery("SELECT * FROM characters WHERE UniqueID=\""+uid+"\"");
    if (rs.next()) {
         JOptionPane.showMessageDialog(this, "The Unique ID \""+uid+"\" is already taken by "+com.kreative.mccm.Character.flName(rs)+".", "", JOptionPane.ERROR_MESSAGE);
         return false;
    rs = st.executeQuery("SELECT * FROM characters WHERE CodePoint="+cp);
    if (rs.next()) {
         JOptionPane.showMessageDialog(this, "The code point "+h(cp,4)+" is already taken by "+com.kreative.mccm.Character.flName(rs)+".", "", JOptionPane.ERROR_MESSAGE);
         return false;
    st.close();
    st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    st.execute("INSERT INTO characters (UniqueID, CodePoint) VALUES (\""+uid+"\", "+cp+")");
    st.close();
    this.uid = uid;
    this.cp = cp;
    this.ch.setUniqueIDString(uid);
    this.ch.codePoint = cp;
    st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    rs = st.executeQuery("SELECT * FROM characters WHERE UniqueID=\""+ch.getUniqueIDString()+"\"");
    if (rs.next()) {
         ch.writeResultSet(rs, false, false); /* (this does the updates) */
         rs.updateRow();
         charSaveChanges.setEnabled(false);
    } else {
         throw new SQLException();
    rs.close();
    st.close();

    OpenBase powers Apple's online store, so I wouldn't think that's the problem. I'm placing all the blame on the JDBC driver.
    Funnily, I started updating ResultSets that way because executing UPDATE statements directly gave me this problem before. Doing it this way made the problem go away, until now.
    I tried replacing the INSERT with two fields with one with all the fields, and now it throws a SQL error that is most definitely bogus:
    java.sql.SQLException: SQL ERROR - [position 569, near '' in ', 0, 0, 0, ''] insert error: comma expected but not found in data.
    SQL: INSERT INTO characters (UniqueID, CodePoint, NameFirst, NameMiddle, NameLast, NameMaiden, NameCommFirst,
    NameCommMiddle, NameCommLast, NameCommFull, Title, Classification, Subclassification, Considerable, SexString,
    TransitionString, GenderString, OrientationString, TitleString, PronounString, SGO, BirthDay, BirthMonth, BirthYear,
    Generation, FirstOfSet, ParentBio, Parent1, Parent2, Parent3, ParentBioType, Parent1Type, Parent2Type, Parent3Type)
    VALUES ('bomb', 123, 'Ziggy', 'Boogy', 'Doog', '', '', '', '', '', '', -1, -1, 1, '', '', '', '', '', '', 0, 0, 0, 0, 0, '', '', '', '', '', 0, 0, 0, 0)Bogus because there are the same number of data items as field names, and position 569 is a comma.
    At this point I have to ask myself why I ever chose OpenBase in the first place. (That's right, I had a RealBasic plugin for it. shudders) I'm sure OpenBase itself is fine, but its JDBC driver is trash. MySQL here I come.
    (Message was edited to prevent looooong horizontal scrolling)

  • SQL Query to BI Publisher Report

    I'm new to BI Publisher. My results from my SQL query did not load properly into BI Publisher. Below is the XML. Can someone help? Thanks!
    <?xml version="1.0" ?>
    - <RESULTSET>
    - <ROWSET id="0">
    - <ROW id="1">
    - <COLUMN NAME="ID">
    - <![CDATA[
    12345
      ]]>
    </COLUMN>
    - <COLUMN NAME="NAME">
    - <![CDATA[
    Mary Jones
      ]]>
    </COLUMN>
    <COLUMN NAME="Gender">F</COLUMN>
    <COLUMN NAME="Address">10-10 203rd Street</COLUMN>
    <COLUMN NAME="City">New York</COLUMN>
    <COLUMN NAME="State">NY</COLUMN>
    <COLUMN NAME="Zip">10013</COLUMN>
    - <COLUMN NAME="Notes">
    - <![CDATA[
    Pending application submission.
      ]]>
    </COLUMN>
    <COLUMN NAME="Birth Date">8/1/1975</COLUMN>
    </ROW>
    </ROWSET>
    </RESULTSET>

    Hi Sonal,
    a possible solution for this can be the use of a lead function (take a look once here where the function is explained http://www.oracle-base.com/articles/misc/LagLeadAnalyticFunctions.php)
    Hope this can help you out.
    Kr
    A

  • Assign and OO4O resultset to an ADODB.recordset

    How do i assign an OO4O resultset obtained within and oraDynaSet object to an ADODB.recordset (without having to parse the dynaset and .addnew the adodb rs).
    help.

    They are not compatible objects as you already found out. Bookmarks are not interchangeable either.

  • RecordSet vs ResultSet

    I'm used to manage recordset ( ado ) ... I'm a bit lost with resultset...
    There is no "State" .BOF .EOF ...
    Question/Problem:
    How can I know if a recordset is null or empty?
    Request:
    PS: is there is any link, articles, document which are comparing recordset and resultset function ( comparable function ( equivalence ) )
    Thanks you

    Question/Problem:
    How can I know if a recordset is null or empty?In general, you have to call next() until it returns false. A ResultSet does not necessarily contain all the rows queried. JDBC may make multiple calls to the database for large queries, so even knowing a ResultSet's size (which you can't do anyways) wouldn't necessarily give you the query size.
    Request:
    PS: is there is any link, articles, document which are
    comparing recordset and resultset function (
    comparable function ( equivalence ) )Don't know of any on that specifically, but for JDBC info, check out the tutorial: http://java.sun.com/docs/books/tutorial/jdbc/index.html
    There are also some technical articles here: http://developer.java.sun.com/developer/technicalArticles/Database/

  • RecordSet and ResultSet

    When Should I use RecordSet and when ResultSet?

    But how does importing an entire package makeany
    difference to which class you actually use?Am I missing something? In what package isRecordSet?
    No idea. I'm just curious why importing an entire
    package would help make this decision. Hadn't even
    considered where RecordSet comes from. It's not part
    of the JDK, AFAIKI don't think that the poster wanted you to read it as an import but rather as "you should use the classes within the java.sql package when you can".

Maybe you are looking for

  • SQL Report Region Refresh

    Application Express 4.0.2.00.09 Oracle 11 XE How do I setup a Dynamic Action to refresh my region every X number of seconds? I can refresh the region easy enough on events, but I can't seem to figure out the timing thing. Maybe I just need some sleep

  • Database Connection Issues!!

    Dear Sir/Madam, I have getting some problems regarding connection of database like Msaccess. While i added data in database and similarly i created a form and related it. But when i bowse this file and hit the submit button the following errors are s

  • Fusion drive on 2011 mid Mac mini...

    Hi everyone, I understand how the new Fusion drive works. But only available on new macs. I've been watching videos on YouTube that show how to make an ssd and hdd into one volume. And they show after the upgrade that these upgrades work. Now, I've a

  • User can't receive mail; sending ok

    Hi, have read almost all mail topics, tried a lot of information, but nothing changed. user has enabled mail in workgroup manager (both pop and imap) and in server admin(settings/access/services/mail) and server preferences/users/services don't know

  • Confusion over permissions authentication in Get Info...

    Hi, It just occurred to me I've never satisfied myself as to why, when attempting to alter the permissions on a file or folder that the current user owns and has read/write privileges to, it is necessary to authenticate using an Admin username and pa