Windows\Temp folder filling fast - how to Dispose the Crystal Objects?

Post Author: pontupo
CA Forum: .NET
So the Windows\Temp folder is fast filling the disk in my
deployment. Each time a report is opened, a number of files are created
here. The problem is, of course, probably that I'm not releasing my
report objects in my code, as the reports can't even be manually
deleted without shutting down IIS. Well, fair enough. What I can't
figure out is where to release my reports objects. I have two pages:
one performs a pre-pass of the report object and generates a dynamic
page to prompt the user for parameters. This page, I believe, has no
problems because the report.Close() command is in line with the code
and is the final statement, but I could be mistaken and this page may also be leaving memory leaks. The second page, however, has the
CrystalReportsViewer object and actually displays the report to the
user after setting up the parameters correctly. On this page, I can't
figure out how/when to call report.Close(). If I do it at the
page.Dispose event, there seems to be no affect. If I do it at the
page.Close event, the report will load fine, but if you try to go to
another page in the report (in the case of multi-page reports) or
refresh the data, the report object has already been unloaded and the
CrystalReportsViewer won't be able to find the report document. If I
wrap my code in one big Try-Catch-Finally (rather than just having a
Try-Catch around the file load itself) as I've seen suggested elsewhere and place a report.Close()
command in the Finally, the Finally is executed before the viewer even
loads the report so I get a file not found error. So where
can I unload the report object? What I want is to persist the report
via Sessions (which I do) so that as the user moves between pages of
the report/refreshes the report will remain loaded, but when the user
closes the page or browses to another page, perhaps, I want to close
the report and free the resources so that the temp files are deleted.
Following are some code samples: Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init        sessionString = Request.QueryString("report")        report = Server.MapPath("reports/") & Request.QueryString("report") & ".rpt"        ConfigureCrystalReport()    End SubPrivate Sub ConfigureCrystalReport()        If (Session(sessionString) Is Nothing) Then            reportDoc = New ReportDocument()            'load the report document            If (IsReportValid()) Then              reportDoc.Load(report)              '******************************              'bunch of other code, authentication              'parameter handling, etc. here              '******************************              Session(sessionString) = reportDoc        Else                Response.Redirect("error.aspx")            End If        Else            reportDoc = CType(Session(sessionString), ReportDocument)        End If    CrystalReportsViewer.ReportSource = reportDoc    End Sub    Private Function IsReportValid() As Boolean        Dim reportIsValid As Boolean = False        Try            If (System.IO.File.Exists(report)) Then 'does the file exist?                'if it does, try to load it to confirm it's a valid crystal report                Dim tryReportLoad As New CrystalDecisions.CrystalReports.Engine.ReportDocument()                tryReportLoad.Load(report)                tryReportLoad.Close()                tryReportLoad.Dispose()                reportIsValid = True            End If        Catch ex As Exception            reportIsValid = False        End Try        Return reportIsValid    End Function'Currently, I've also tried each of the following:Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload        CloseReports(reportDoc)        CrystalReportsViewer.Dispose()        CrystalReportsViewer = Nothing    End Sub    Private Sub CloseReports(ByVal report As ReportDocument)        Dim sections As Sections = report.ReportDefinition.Sections        For Each section As Section In sections            Dim reportObjects As ReportObjects = section.ReportObjects            For Each reportObject As ReportObject In reportObjects                If (reportObject.Kind = ReportObjectKind.SubreportObject) Then                    Dim subreportObject As SubreportObject = CType(reportObject, SubreportObject)                    Dim subReportDoc As ReportDocument = subreportObject.OpenSubreport(subreportObject.SubreportName)                    subReportDoc.Close()                End If            Next        Next        report.Close()    End Sub'This was the solution suggested on another forum. I've also tried:Protected Sub Page_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed        reportDoc.Close()        reportDoc.Dispose()        CType(Session(sessionString), ReportDocument).Close()        Session(sessionString) = Nothing    End Sub'I've also tried wrapping everything inside of the If statement in the ConfigureCrystalReport() method in code to this effect:If (IsReportValid()) Then                Try                    reportDoc.Load(report)Catch e As Exception                    Response.Redirect("error.aspx")                Finally                    reportDoc.Close()                End TryAny advice on this is appreciated. Thanks in advance, Pont

Post Author: sarasew13
CA Forum: .NET
Why are you checking for is valid before closing?  As long as the report object isn't null you should be able to close it (whether it's open or not).  I ran into this same problem when trying to store the report, so now I just store the dataset.  Everything seems to work fine and navigate appropriately so here's more or less how I handle it:
DataSet myDS;ReportDocument myRPT;
    protected void Page_Load(object sender, EventArgs e)    {        try        {            if (!IsPostBack)            {                //pull variables from previous page if available                //set variables into view state so they'll persist in post backs            }            else            {                //if postback then pull from view state            }
            createReport();    }        catch (Exception err)        {            //handle error        }    }
    private void createReport()    {        myDS = new DataSet();        string rpt;
        rpt = "RPTS/report.rpt";        try        {            if (!IsPostBack || Session["data"] == null)            {                myDS = getData();//make data call here                Session["data"] = myDS;            }            else            {                myDS = (DataSet)Session["data"];            }
            if (myDS.Tables.Count > 0)//make sure the dataset isn't empty            {                myRPT = new ReportDocument();                myRPT.Load(Server.MapPath(rpt));                myRPT.SetDataSource(myDS.Tables[0]);
                if (!IsPostBack)                {                    //code to set parameters for report here                }
                MyViewer.ReportSource = myRPT;            }        }        catch (Exception error)        {            //handle error        }    }
    protected void Page_Unload(object Sender, EventArgs e)    {        try        {            if (myRPT != null)            {                myRPT.Close();            }        }        catch (Exception error)        {            //handle error        }    }

Similar Messages

  • How to Populate the JTable Object programatically with SQL Results

    I'm wondering if someone could help me on how to populate the JTable Object with SQL Results wherein the Row of tjhe JTable object is automatically adjusted depending on how many records you have queried.
    Thanks in advance and God bless! (",)
    * frmMain.java
    * Created on October 4, 2006, 6:15 AM
    package tds;
    import java.io.*;
    import java.awt.Toolkit;
    import javax.swing.JFrame;
    import javax.imageio.*;
    import javax.swing.JFrame;
    import java.sql.*;
    import javax.swing.table.DefaultTableModel;
    * @author Dexter.Carlit
    public class frmMain extends javax.swing.JFrame {
    private Connection connection = null;
    private DefaultTableModel model;
    /** Creates new form frmMain */
    public frmMain() {
    initComponents();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
    jSplitPane = new javax.swing.JSplitPane();
    jScrollPane1 = new javax.swing.JScrollPane();
    jPanel3 = new javax.swing.JPanel();
    jScrollPane2 = new javax.swing.JScrollPane();
    jTree1 = new javax.swing.JTree();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel1 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jTextField1 = new javax.swing.JTextField();
    jTextField2 = new javax.swing.JTextField();
    jLabel3 = new javax.swing.JLabel();
    jTextField3 = new javax.swing.JTextField();
    jLabel4 = new javax.swing.JLabel();
    jTextField4 = new javax.swing.JTextField();
    jPanel5 = new javax.swing.JPanel();
    jScrollPane3 = new javax.swing.JScrollPane();
    jGrid = new javax.swing.JTable();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jProgressBar1 = new javax.swing.JProgressBar();
    jPanel2 = new javax.swing.JPanel();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowOpened(java.awt.event.WindowEvent evt) {
    formWindowOpened(evt);
    getAccessibleContext().setAccessibleName("frmMain");
    jSplitPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
    jSplitPane.setDividerLocation(200);
    jSplitPane.setDividerSize(10);
    jScrollPane2.setViewportView(jTree1);
    org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(
    jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jPanel3Layout.createSequentialGroup()
    .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 916, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    jPanel3Layout.setVerticalGroup(
    jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
    jScrollPane1.setViewportView(jPanel3);
    jSplitPane.setLeftComponent(jScrollPane1);
    jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
    jLabel1.setText("First Name:");
    jLabel2.setText("Last Name:");
    jLabel3.setText("Position :");
    jLabel4.setText("Department:");
    jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Search Results"));
    jGrid.setModel(new javax.swing.table.DefaultTableModel(
    new Object [][] {
    new String [] {
    "LName", "FName", "Position", "Department", "Office No", "Local No", "Office Mobile No", "Home No", "MobileNo", "Email Address"
    jGrid.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
    jGrid.setColumnSelectionAllowed(true);
    jGrid.setName("");
    jGrid.setTableHeader(jGrid.getTableHeader());
    jScrollPane3.setViewportView(jGrid);
    jScrollPane3.getAccessibleContext().setAccessibleName("rset");
    org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
    jPanel5.setLayout(jPanel5Layout);
    jPanel5Layout.setHorizontalGroup(
    jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 386, Short.MAX_VALUE)
    jPanel5Layout.setVerticalGroup(
    jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
    jButton1.setText("Find");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(java.awt.event.MouseEvent evt) {
    jButton1MouseClicked(evt);
    jButton2.setText("Clear");
    jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(java.awt.event.MouseEvent evt) {
    jButton2MouseClicked(evt);
    org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout.setHorizontalGroup(
    jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
    .addContainerGap()
    .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
    .add(jLabel1)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE))
    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
    .add(jLabel2)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(jTextField2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)
    .add(1, 1, 1))
    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
    .add(jLabel3)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(jTextField3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(jLabel4)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(jTextField4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE))
    .add(jPanel4Layout.createSequentialGroup()
    .add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
    .addContainerGap())
    jPanel4Layout.linkSize(new java.awt.Component[] {jButton1, jButton2}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
    jPanel4Layout.setVerticalGroup(
    jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jPanel4Layout.createSequentialGroup()
    .addContainerGap()
    .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
    .add(jLabel1)
    .add(jTextField1))
    .add(18, 18, 18)
    .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
    .add(jLabel2)
    .add(jTextField2))
    .add(16, 16, 16)
    .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
    .add(jLabel3)
    .add(jTextField3)
    .add(jLabel4)
    .add(jTextField4))
    .add(14, 14, 14)
    .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
    .add(jButton2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .add(jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
    jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
    .addContainerGap()
    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .add(org.jdesktop.layout.GroupLayout.LEADING, jProgressBar1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE))
    .addContainerGap())
    jPanel1Layout.setVerticalGroup(
    jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
    .addContainerGap()
    .add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(jProgressBar1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    jTabbedPane1.addTab("Search", jPanel1);
    org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
    jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(0, 458, Short.MAX_VALUE)
    jPanel2Layout.setVerticalGroup(
    jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(0, 401, Short.MAX_VALUE)
    jTabbedPane1.addTab("Directory", jPanel2);
    jSplitPane.setRightComponent(jTabbedPane1);
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jSplitPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 675, Short.MAX_VALUE)
    layout.setVerticalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jSplitPane)
    pack();
    }// </editor-fold>//GEN-END:initComponents
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    }//GEN-LAST:event_jButton1ActionPerformed
    private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
    jGrid.setModel(new javax.swing.table.DefaultTableModel(
    new Object [][] {
    {null, null, null, null, null, null, null, null, null, null},
    {null, null, null, null, null, null, null, null, null, null},
    {null, null, null, null, null, null, null, null, null, null},
    {null, null, null, null, null, null, null, null, null, null}
    new String [] {
    "LName", "FName", "Position", "Department", "Office No", "Local No", "Office Mobile No", "Home No", "MobileNo", "Email Address"
    jGrid.updateUI();
    }//GEN-LAST:event_jButton2MouseClicked
    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
    try {
    //Load and register SQL Server driver
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    //Establish a connection
    Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://X.X.X.X:1433","MyAccount","MyPassword");
    //Create a Statement object
    Statement sql_stmt = connection.createStatement();
    //Create a ResultSet object, execute the query and return a
    // resultset
    ResultSet rset = sql_stmt.executeQuery("SELECT * FROM EpxDirectory..Directory Order By LName");
    // Populates a JTABLE Object
    int i=0;
    while (rset.next()){
    String LName = rset.getString(1);
    String FName = rset.getString(2);
    String Position = rset.getString(3);
    String Dept_Code = rset.getString(4);
    String OffPhoneNo = rset.getString(5);
    String LocalNo = rset.getString(6);
    String OffMobileNo = rset.getString(7);
    String HomePhoneNo = rset.getString(8);
    String MobileNo = rset.getString(9);
    String Email = rset.getString(10);
    jGrid.updateUI();
    jGrid.setValueAt(rset.getString(1).trim(),i,0);
    jGrid.setValueAt(rset.getString(2).trim(),i,1);
    jGrid.setValueAt(rset.getString(3).trim(),i,2);
    jGrid.setValueAt(rset.getString(4).trim(),i,3);
    jGrid.setValueAt(rset.getString(5).trim(),i,4);
    jGrid.setValueAt(rset.getString(6).trim(),i,5);
    jGrid.setValueAt(rset.getString(7).trim(),i,6);
    jGrid.setValueAt(rset.getString(8).trim(),i,7);
    jGrid.setValueAt(rset.getString(9).trim(),i,8);
    jGrid.setValueAt(rset.getString(10).trim(),i,9);
    i++;
    //Close the ResultSet and Statement
    rset.close();
    sql_stmt.close();
    //Close the database connection
    connection.close();
    System.out.println(Integer.toString(i) + " rows found");
    } catch(Exception e) {
    System.out.println("Failed to connect; Please view Stack Trace");
    e.printStackTrace();
    }//GEN-LAST:event_jButton1MouseClicked
    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
    }//GEN-LAST:event_formWindowOpened
    public static void run(){
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    frmMain frmMain = new frmMain();
    frmMain.setLocationRelativeTo(null); // Center the JFrame on the
    frmMain.setVisible(true);
    private void exitApplication() {
    // try {
    // //gui.putStatus("Closing the connection....please wait.....");
    // if(connection != null) {
    // // connection.close(); //Closing the connection object.
    // } catch(SQLException ex) { //Trap SQLException
    // //gui.putStatus(ex.toString());
    System.exit(0); //Exit the aplication
    * @param args the command line arguments
    public static void main(String args[]) {
    run();
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JTable jGrid;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JProgressBar jProgressBar1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JSplitPane jSplitPane;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTree jTree1;
    // End of variables declaration//GEN-END:variables
    }

    Use code tags.
    Don't mix GUI and JDBC together. Split them out into separate classes.
    You have a good start, but you will need to loop through your resultset and also pull the ResultSet metaData for you column headings

  • How to access the remote Objects Without Db_links?

    Hi ,
    I want to know how to access the remote objects without db_link.That is i want to access a object in some other server which has different database.

    SanjayBala, just so you know that it is possible to create a database link in Oracle to non-Oracle databases in some circumstances. Look up Generic Connectivity aslo know as Heterogenous Services. With 11g Oracle has basically renamed the feature and replaced it with somethinkg named ike DG4ODBC.
    I have not spent time studying the details for DB4ODBC but with HS Oracle provided the interface and you had to obtain the necessary ODBC driver on your own. I had Oracle on AIX reading and writing to SQL Server on Windows but the developers chose to write a java program and connect to both via it. On Windows and Linux platforms the necessary ODBC drivers might be available without the requirement to go out and purchase one.
    The Oracle Open Gateway product is an advanced version of the above features with drivers for specific non-Oracle databases included like DB2 or Informix.
    HTH -- Mark D Powell --

  • How to get the UserTransaction object in  stateless session bean

    Hi, I am using jboss server and jdk5 version and using EJB.
    My Application flow :
    JSP à Action(Struts) à Service Locator à Session bean à Entity Bean(cmp) à DB.
    I tried to get the UserTransaction object in my Action. Its my code.
    InitialContext ctx = new InitialContext();
    UserTransaction uTrans = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
    After used uTrans.begin(),uTrans.commit() and uTrans. rollback () also.
    Its working fine .
    But, I used the the same code inside in my session bean its not working.
    Stateless Session Manager Bean code :
    public class SampleManagerBean implements SessionBean {
    public void ejbCreate() throws CreateException {  }
    public void ejbRemove() {  }
    public void ejbActivate() {   }
    public void ejbPassivate() {   }
    public void setSessionContext(SessionContext sessionContext) {
    this.sessionContext = sessionContext;
         public void createSample() throws EJBException
         try{
                   InitialContext ctx = new InitialContext();
                   UserTransaction ut = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
              }catch(Exception e) {
              System.out.println(“ Exception === > “+e)
    Its throws the error ie: javax.naming.NameNotFoundException: UserTransaction not bound
    How to get the UserTransaction object in my session bean. Kindly give solution the above errors.
    - Thendral

    first of all, you could just use sessionContext.getUserTransaction(). however, that would only work if your bean is using bean-managed transactions. the default is container-managed transaction, in which case you cannot get a UserTransaction object. if you want to manage transactions, you need to add the TransactionManagementType.BEAN annotation to your ejb.

  • How to get the view Object in UserDefined Action

    Hi  All,
       Any body tell me how to get the view object , like the view object avilable in the wdDoModifyView() method as parameter.
    I have requirement like, i want to change the , no of rows displaying in the table should be changed at the runtime based onthe no of rows  selected in the dropdown box.
    The action which i created will be assigned to that dropdown box, on select of the available option, i will get the view object and change the properties of the "maxrows" of the table .
    so for getting the view object in the  the Action methods tell me what is the procedure for getting the current view object.

    Hello Vishal,
    Simply create a value attribute (say rowCount) of type 'integer' and bind it to the 'visibleRowCount' property of your table. Then, in the actionHandler get the value from the UI element (in your case, I guess it is drop down) and set it to the attribute 'rowCount' like this.
    wdContext.currentContextElement.setRowCount(
        wdContext.current<nodeElement>.set<AttributeBound toDropDown>);
    Bala

  • How to select the all object at a time while installing business content

    Hi All,
    how to select the all object at a time while installing business content Please let me know if nay document is there
    Thanks Ahmed Pasha

    Hi,
    Please check out the below links
    [Business content Installation|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/102906a4-f13d-2e10-7199-ce316ff254b8?QuickLink=index&overridelayout=true ]
    [BI Content|http://wiki.sdn.sap.com/wiki/display/BI/InstallingBusinessContent]
    Hope it helps.
    Regards,
    AL

  • How to retrieve the java object in a proxy service in osb -- Plz help

    Hi all,
    I have a singleton java class which runs whenever the weblogic server gets started and store the output in its object. I need to access this java object from a proxy service in osb.
    We tried using java call out and retrieved that object but we couldn't know how to parse that object into XML.
    We are not sure of using the java call out in osb to solve this purpose because whenever we use a java callout, that particular java code will run which is not the case of singleton class.
    So kindly help us how to retrieve the java object which holds the output without running the java code every time because its already run and holding the output in its object.
    Regards
    Prabhu

    here the doc http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/context.html#wp1106656
    but I guess you are already at the stage of getting a POJO in a first Java Callout and passing the POJO to a second Java Callout, which should then return it to OSB as a XMLObject.
    My recommendation is to write a Java function which returns a XMLObject and uses a XMLCursor to populate it with the values of the POJO.
    An XMLObject returned to the OSB is automatically transformed in a "XML" variable (which in reality is represented as a XMLObject in the Pipeline context)
    Here some code sample:
    http://www.javamonamour.org/2010/09/how-to-create-xmlobject-using-xmlcursor.html

  • How to  get the profile object in simple java class  (Property accessor)

    Hi All,
    Please guide me how to get the profile object in simple java class (Property accessor) which is extending the RepositoryPropertyDescriptor.
    I have one requirement where i need the profile object i.e i have store id which is tied to profile .so i need the profile object in the property accessor of the SKU item descriptor property, which is extending RepositoryPropertyDescriptor.
    a.I dont have request object also to do request.resolvename.
    b.It is not a component to create setter and getter.It is simple java class which is extending the RepositoryPropertyDescriptor.
    Advance Thanks.

    Iam afraid you might run into synchronization issues with it. You are trying to get/set value of property of a sku repository item that is shared across various profiles.
    Say one profile A called setPropertyValue("propertyName", value).Now another profile B accesses
    getPropertyValue() {
    super.getPropertyValue() // Chance of getting value set by Profile A.
    // Perform logic
    There is a chance that profile B getting the value set by Profile A and hence inconsistency.
    How about doing this way??
    Create PropertyDescriptor in Profile (i.e user item descriptor), pass the attribute CustomCatalogTools in userProfile.xml to that property.
    <attribute name="catalogTools" value="atg.commerce.catalog.CustomCatalogTools"/>
    getPropertyValue()
    //You have Profile item descriptor and also storeId property value.
    // Use CustomCatalogTools.findSku();
    // Use storeId, profile repository item, sku repository item to perform the logic
    Here user itemdescriptor getPropertyValue/setPropertyValue is always called by same profile and there is consistency.
    -karthik

  • How to open the crystal reports 2008 in CRYSTAL REPORTS ENTERPRISE 4.0

    Hi All,
    Can you please let me know how can migrated the crystal reports from BO XI 3.1 to SAP BO 4.1 and after migrate how to open the crystal reports 2008 in CRYSTAL REPORTS ENTERPRISE 4.0.
    can you please help on this and if document please share.
    Thanks,
    Rajesh

    Use the upgrade management tool to move from 3.1 reports to BO 4.1. After migration, open the report in crystal enterprise 4.0, you will get a message saying that the report will be converted to latest version, will not be able to view from older version after converting. (Similar words- not sure exact words).

  • How to move the anchor object in indesign cs2 using js?

    i can able to move the normal textframe and other objects but cant do this for anchor objects.
    syntex:  anchorobject.move([x value,y value],undefined,true)
    how to move the anchor objects?
    thanks
    subha

    Could it be that the anchord object in question won't move because you have it set to keep within margins which is preventing the move you're requesting? I've certainly run into that.
    I've also run into the situation where the object model thinks the anchored object is in one place when it is actually in another because of that same keep within margins option. In this case, a move will apparently not work because the move is invisible, it being completely outside of the margins -- although that only applies to relative moves, I think.
    Dave

  • EEWB :  how to determine the business object and the extension type ?

    Hi,
    I ask myself how to determine the business object and the extension type to use to add new fields in a new tab of a specific transaction ? what means each business object, does that correspond to a specific transaction ?
    I need to add a new tab in the ‘BaMI’ business activity in transaction CRMD_ORDER just after the tab 'Actions' at header level.
    Could you help me please to determine which business object and extension type I have to select during creation of the project and which business object category I have to select during creation of the extension (wizard) ?
    Thanks for your help,
    Marie

    Marie,
    In order to determine what type of transaction you are extending, you will need to look at the customizing for the transaction.
    In the IMG:
    Goto:
    Customer Relationship Management->Transactions->Basic Settings->Define Transaction Types.
    You will then choose the transaction defined that you want to extend.  If you display the details of the transaction you will find an attribute called:
    "Leading Transaction Category".  This tells you the general context in which the transaction is used.  The other item to view is the assignment of business transaction categories found in the maintenance screen.
    This information general corresponds to one of the options that the EEWB will give you on the transaction type.
    As far as extensions go, my recommendation is the following:
    - Use CUSTOMER_H Customer Header Extensions for any new fields at the header level.
    - Use CUSTOMER_I Customer Item Extensions for any new fields at the item level.
    Unless you have a specific requirement to extend a segment of the transaction, I recommend placing all new fields in these segments.  The CUSTOMER_H & CUSTOMER_I segments are considered "standard" segments, that are already built into all the necessary API structures. 
    Let me know if you have any further questions.
    Good luck,
    Stephen

  • How to close the Sound object

    I'm using Flash CS3, running code in ActionScript 3.
    I use the Loader class to load a child SWF file, which then
    takes over the entire area on my website that is reserved for
    Flash. If the user decides to stop watching the SWF file before it
    is completed, he hits the "close" button within the child SWF,
    ultimately causing the Loader.unload() method to be executed. So
    far, so good, only the sound from the remaining portion of the SWF
    file keeps playing. According to the Flash Docs for the
    Loader.unload() method:
    "As a best practice, before you unload a child SWF file, you
    should explicitly close any streams in the child SWF file's
    objects, such as LocalConnection, NetConnection, NetStream, and
    Sound objects. Otherwise, audio in the child SWF file might
    continue to play, even though the child SWF file was unloaded."
    It then gives an example that assumes you already have access
    to the Sound object, so closing the Sound object is done by:
    mySound.close();
    The only problem is that I have no idea how to access the
    Sound object when I use the Loader.load() method. Where is this
    beast? I can't seem to find anything in the documentation that
    tells me how to find the Sound object after calling Loader.load().
    As a temporary fix, I modified the target SWF file so that when the
    "close" button is hit, it calls the "stop()" function; however,
    this only stops the sound, it does not close the associated Sound
    object, and I presume it continues to lurk around in memory with
    nothing useful to do. (When the user hits the "close" button in the
    child SWF file, it creates a "bubbling" event so that the Loader
    class can call the Loader.unload() method on it.)
    I've attached code for your reference.
    Any help is deeply appreciated!
    -Dan

    Ack! Looks like I hijacked this thread, sorry.
    I'm doing almost exactly the same thing the OP is doing...
    Loader class to load an external SWF (which is a video file FLV).
    If the user hits the "close" button on the video, the video goes
    away as it should but the audio continues.
    I understand that I need to close any NetConnection and
    NetStream objects in addition to unloading the movie. What I don't
    understand is how to do that. I'm sure that it's a syntax thing I'm
    just not getting right. I would just really like a more detailed
    explanation of stopping NetConnections and NetStreams (but an
    explanation for the not-so-actionscript-experienced LOL).
    Thanks.

  • What is the use for lock object and how to use the lock objects

    Hi Guru's,
    I am new to ABAP .Can you please clarify the that what is the use of lock object and how to use the loct object .what is use of the Deque & Enque  function modules .

    hi ,
    below are some minfo about lock objects :
      Lock Objects
    These types of objects are used for locking the access to database records in table. This mechanism is used to enforce data integrity that is two users cannot update the same data at the same time. With lock objects you can lock table-field or whole table.
    In a system where many users can access the same data, it becomes necessary to control the access to the data. In R/3 system this access control is built-in on database tables. Developers can also lock objects over table records.
    To lock an object you need to call standard functions, which are automatically generated while defining the lock object in ABAP/4 dictionary. This locking system is independent of the locking mechanism used by the R/3 system. This mechanism also defines LUW i.e. Logical Unit of Work. Whenever an object is locked, either by in built locking mechanism or by function modules, it creates corresponding entry in global system table i.e. table is locked. The system automatically releases the lock at the end of transaction. The LUW starts when a lock entry is created in the system table and ends when the lock is released.
    Creating Lock Objects
    Lock object is an aggregated dictionary object and can be defined by using the following steps:
    o From initial data dictionary screen, enter the name for the object, Click Lock object radiobutton and then click on Create. The system displays a dialog box for Maintain Lock Objects screen
    o Enter short text as usual and the name for primary table.
    -Save
    -Select Tables option
    From this screen you can:
    Select secondary tables, if any, linked by foreign key relationship.
    Fields for the lock objects. This option allows you to select fields for objects (R/3 system allows locking up to record level). Lock object argument are not selected by user but are imposed by the system and includes all the primary keys for the table.
    1) Exclusive lock: The locked data can only be displayed or edited by a single user. A request for another exclusive lock or for a shared lock is rejected.
    2) Shared lock: More than one user can access the locked data at the same time in display mode. A request for another shared lock is accepted, even if it comes from another user. An exclusive lock is rejected.
    3) Exclusive but not cumulative: Exclusive locks can be requested several times from the same transaction and are processed successively. In contrast, exclusive but not cumulative locks can be called only once from the same transaction. All other lock requests are rejected.
    Also, last but not the least, locking the object is logical (locking with any enqueue ) .so, you have to use the lock object while trying to access from second program .
    reward if helpful ,
    Regards,
    Ranjita

  • How to access the LOB objects through databaselinks?

    How to access the LOB objects through databaselinks?

    Abhii wrote:
    How to access the LOB objects through databaselinks?You can refer to this link
    http://dbaforums.org/oracle/index.php?showtopic=4790
    I've found it by simple google-ing...
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • How to access the LOB objects through database links??????????????

    How to access the LOB objects through database links??????????????

    Hi
    See:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:52297289480186
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5322964030684
    And you also might want to get a new keyboard, your '?' seems to be stucked....

Maybe you are looking for