Database and JTree

I have table in access entitled employees and wish to generate a JTree to show the organizational heirarchy of the company. I feel like I've followed the steps properly but the Jtrees either don't work or they work with the wrong data.
"Perform a query to obtain the name of the employee. If you are at the root node (level 0), just change the value of the current node to the name you got from the query, otherwise, create a child node and set its value to be that name. Perform another query to get the employee IDs of all the employees whose manager is the current employee. Loop through this result set, recursively calling the method for each of the employees in the resultset from step (4)."[]
    public static void generateTree(DefaultMutableTreeNode node, int id, int level){
        DbSource dbs = new DbSource("EmpDb");
        if (dbs.isConnected()){
         boolean success = dbs.processQuery("select firstname, lastname from employees", false);
         if(success){
             while(dbs.nextRecord()){
              DefaultMutableTreeNode newNode;
                if (level==0){
                    node.setUserObject(dbs.getField(1)+ " " + dbs.getField(2));
                    newNode=node;
                else{
                    newNode = new DefaultMutableTreeNode(dbs.getField(1) + " " + dbs.getField(2));
                    node.add(newNode);               
             boolean success2 = dbs.processQuery("select employeeid from employees where " + id+ " = manager", false);
             if (success2){
             while (dbs.nextRecord()){
                  generateTree(newNode, id, level+1);                      
    }Any quick hints are appreciated.

Well, you didn't say what was wrong with the result of this. But that doesn't matter because I can see a lot of things wrong with the code.
First you don't have anything that gets the level-zero node. (The president of the company or whatever that is.) You should do this outside the recursively-called method and create a node that contains that person's name. Then call the method, passing it that node.
Second, in your posted code you have something that reads the entire file at every level. What's that for?
Third, the last four lines of that method look like the actual code you need: get the employees who report to the manager in the current node. However you need something that creates a new node for each of those employees and adds it to the manager node.
Fourth, you don't seem to use that "level" parameter anywhere. I don't think you have any need for it.
Fifth, and I don't know if this is a problem, you will need to be able to process several DbSource objects simultaneously. Possibly you can, but it's possible to code that sort of thing so that you can't.

Similar Messages

  • How i can enter information from Database to jtree and update it

    How i can enter information from Database to jtree and update it

    Is the memory cache enabled (about:cache)?<br />
    You can open about: pages via the location bar like you open a website.
    *http://kb.mozillazine.org/browser.cache.memory.enable

  • Logical Database and Logical Thing

    Hi,
    i want to access KONV which is cluster table and the field is KWERT.
    The thing is that i want to access it by taking customers from KNVV and giving it to VBRK (SALES Table). Now in VBRK i want to have a selection on FKDAT to get a list of Customers stored in the field called KUNAG.
    on VBRK-KUNAG basis i want to access the table KONV-KWERT.
    If i am doing queries then the System stops responding cuz it has got alot of overhead. So i tried to use Logical Database called VFV.
    If this is the best solution means using LDB then how to use it, can anyone help me with this. I tried it by Function module but it is showing all data without considering selection criteria.
    If anyone can help me then plz do answer or refer me to any web site so that i can figure this thing out. If anyione has got a good book on that then plz feel free to mail me.
    Thanks,
    Muhammad Usman Malik
    ABAP Consultant
    Siemens
    [email protected]
    +92-333-2700972

    Thanks Shibba that was very helpful, i applied that but the system overhead was so much.
    can u help me with Dynamic selection code.
    I used FREE_SELECTION_INIT, FREE_SELECTION_DIALOG and then FREE_SELECTIONS_RANGE_2_WHERE to get ther Selections in one table.
    if u want me to send u the code then i can do that cuz i am getting so much mad that this work is not done yet.
    The Scenario here is that we want to take BILLED Customers and VKORG as Industrial Billing Customer and then taking VBRK and giving all these Customers and then taking selection on FKDAT range.
    Now after that the data should be collected from KONV-KWERT and i want to perform some calculation over it. I am using VFV (Logical Database) to perform this thing because i know that it would be very fast then applying my own queries.
    If you can mail me any book on Logical Database and Dynamic selection then it will be very Helpful.
    Thanks once again for being such helpful.
    Muhammad Usman Malik
    SAP Consultant
    [email protected]
    +92-333-2700972

  • Reference to database and/or server name in '' is not supported in this version of SQL Server

    Hello all
    I am using C# and ADO.NET (native) - Visual Studio 2013.
    I am always using full qualified queries like "SELECT * FROM [database].[schema].[table]"
    Obviously there is a problem when doing this against SQL Azure,
    I get the following error: "Reference to database and/or server name in '' is not supported in this version of SQL Server"
    Interesting fact: With SQL Management Studio, the same query works.
    I need to know if this error is really a true one or not.
    If yes, I can quit using SQL Azure. I would need a SQL Server and not a partial SQL Server :-)
    Thanks and best regards
    Frank

    Hi,
    Here are my suggestions:
    1. Use partially qualified queries, because:
    a. from a security standpoint, you'd want to limit your login's access across the server instance
    b. in order to achieve a even better, you should specify your database as the Initial Catalog directly in the SQL Connection.
    If you take into account these practices, SQL Database doesn't come with any limitation from that point of view.
    However, in regard to 'With SQL Management Studio, the same query works', this is actually only partially true because if you run that query agains ADO.NET, you'll actually end up in switching databases along the query which is obviously not permitted in
    SQL Database since you're running in a hosted black-box version of SQL you're not managing. It's just like running the USE <dbname> command which obviously doesn't work.
    Alex

  • Jasper report on HTML when one image loaded from database and for the other

    How to generate jasper report on HTML when one image loaded from database and for the other we give a image path
    My code
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
              exporter = new JRHtmlExporter();
              exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
              exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);
              exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, strImageInputDirectory);
         exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME, strImageOutputPath == null ? "." : strImageOutputPath);
         exporter.setParameter(JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR, Boolean.TRUE);
         exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);
         exporter.setParameter(JRHtmlExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
              exporter.exportReport();
              byte[] bdata = ((ByteArrayOutputStream) baos).toByteArray();
    Can any one help pls
    Message was edited by:
    ameet.au

    hey sorry for posting it in this forum.
    but do u have sample code for making it work.. since i am able to do it on PDF format(image from Database and another stored in the webserver) using
    byte image[] =(byte[]) outData.get("image");
                        ByteArrayInputStream img = new ByteArrayInputStream(image);
                        hmimg.put("P_PARAMV3", img);
    print = JasperFillManager.fillReport(reportFileName, hmimg, jrxmlds);
    bdata= JasperExportManager.exportReportToPdf(print);

  • I m using ms access as database and i want to create a login page in java

    hye frnz... plz help me m new to java
    m using ms access as database and try to create a login page where user type username and pw
    i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
    now there is an error class not found exception sun:jdbc...... error
    plz help me i had stuck frm 4 days */
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Login extends JFrame
    //Component Declarations
    JLabel jlb1,jlb2;
         JTextField jtf1;
         JPasswordField jpf1;
         JButton jb1,jb2;
         //Constructor
         Login()
         //frame settings
              setTitle("Login Dialog");
              setLayout(new GridBagLayout());
              GridBagConstraints gbc = new GridBagConstraints();
              setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              Dimension d= Toolkit.getDefaultToolkit().getScreenSize();
              setBounds(d.width/2-175,d.height/2-100,350,200);
              gbc.insets=new Insets(7,7,7,7);
         //adding components
              jlb1=new JLabel("User ID");
              gbc.gridx=0;
              gbc.gridy=0;
              add(jlb1,gbc);
              jlb2=new JLabel("Password");
              gbc.gridx=0;
              gbc.gridy=1;
              add(jlb2,gbc);
              jtf1=new JTextField(10);
              gbc.gridx=1;
              gbc.gridy=0;
              add(jtf1,gbc);
              jpf1=new JPasswordField(10);
              gbc.gridx=1;
              gbc.gridy=1;
              add(jpf1,gbc);
              jb1=new JButton("Login");
              gbc.gridx=0;
              gbc.gridy=2;
              add(jb1,gbc);
              jb1.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                   Connection conn=null;
                        Statement stmt=null;
                        boolean found=false;
                   try
                             Class.forName("sun.jdbc.driver.JdbcOdbcDriver");
                             String dataSourceName = "Inventory";
                             String dbURL = "jdbc:odbc:" + dataSourceName;
                             conn=DriverManager.getConnection(dbURL, "","");
                             stmt=conn.createStatement();
                             ResultSet rst=stmt.executeQuery("Select * from User");
                             System.out.println(jtf1.getText()+"/t"+jpf1.getPassword());
                             while(rst.next())
                                  System.out.println( rst.getString(1) +"/t"+ rst.getString(2));
              if(jtf1.getText().equals(rst.getString(1).trim()) && new String(jpf1.getPassword()).equals(rst.getString(2).trim()))
                                       found=true;
                                       rst.close();
                                       dispose();
                                       MainWindow mw= new MainWindow();     /*created min window object created to be opend after login but not working*/     
                                       break;
                             rst.close();
                             stmt.close();
                             conn.close();                    
                        catch(ClassNotFoundException e){System.out.print(e);}
                        catch(Exception e){System.out.print(e);}
                        if(found==false) /*this portion is executing and dialog box appears invalid name and pw with class not found exception sun:jdbc.......on console */
                             JOptionPane.showMessageDialog(null,"Invalid username or password",
                                  "Error Message",JOptionPane.ERROR_MESSAGE);
              jb2=new JButton("Clear");
              gbc.gridx=1;
              gbc.gridy=2;
              add(jb2,gbc);
              jb2.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        jtf1.setText("");
                        jpf1.setText("");
                        jtf1.requestFocus();
              setSize(350,200);
              setVisible(true);
              jtf1.requestFocus();
         public static void main(String args[])
    Login l=new Login();
    }

    http://forums.oracle.com/forums/ann.jspa?annID=599
    Oh, and by the way, your keyboard seems to be broken as your words are not getting spelled correctly.

  • Swapping between client database and web database

    Hi i have completed tutorials etc so can now create the
    sqlite database for my application which is downloaded by the user
    and will run on thier desktop so i am calling it the "client
    database" which contains data they are working with but there is
    another database containing identical tables which i am calling the
    "global database" the idea of this is to transfer data between the
    different clients and backup that information.
    so i am looking for a tutorial or a sample app where the app
    takes information from a web based database and copy's that rob
    into a sqlite database on the clients machine?
    this is the main problem im having and seen people mentioning
    blaze DS and stuff like that, ideally i wouldn't like to use PHP
    but atm is looking like i may have to.
    i will sell my soul to anyone who can help with this lol
    (also i am using FLEX 3.0)

    Hi,
    Yes, if you use LCDS everything is there already for you, so
    that you can complete this application in very less time. Since you
    want to use PHP, you can use Zend PHP, which will support Remoting
    using AMF. Using Zend PHP, write PHP classes which will help you to
    synchronize data between server and client and just invoke those
    from your Flex application when required.
    Hope this helps.

  • Database and Server Report

    Hi,
    I want to assist my friend (he is same like me, newbie in oracle) to give a report on health of oracle database and server; which is running in his small software development and data feeding company. There are around
    1. 50 users,
    2. windows XP professional,
    3. Oracle9i Enterprise Edition Release 9.2.0.1.0 – Production,
    4. one database, No Archive Mode, oracle home is : c:\oracle\ora92 and database is stored at D:\ORACLE\oradata\orcl, 3 control files, 3 redo groups and 11 dbfs
    5. 2.27 GB is free space on the drive of oracle home,
    6. more than 1 GB RAM is in the system,
    7. <what else more; I should describe, please let me know>
    He has to submit a report on current status, health, performance etc. of oracle database and server. How should we design and get the data, please guide me.
    Thanks & Regards

    You Mean Helath Check Report of the DB
    Tablespace size?
    Datafile Size?
    Default tablespace?
    UNDO management?
    SGA?
    buffer cache hit ratio?
    library cache hit ratio?
    There are so many other parameters..Performance cannot be predicted from remote site
    But you can provide certain information
    Here are some views which could be helpful
    DBA_TABLESPACE
    DBA_FREE_SPACE
    DBA_DATA_FILES
    V$CONTROLFILE
    V$LOG--Meaning less since you run in archived mode
    Number of Oracle Process allocated
    UNDO RETENTION
    SQL>show parameter process
    SQL>show parameter UNDO
    Do you have METALINK acces
    1019546.6
    this has everything then you can pass whatever they need
    and many more

  • Powershell use Connection String to query Database and write to Excel

    Right now I have a powershell script that uses ODBC to query SQL Server 2008 / 2012 database and write to EXCEL
    $excel = New-Object -Com Excel.Application
    $excel.Visible = $True
    $wb = $Excel.Workbooks.Add()
    $ws = $wb.Worksheets.Item(1)
    $ws.name = "GUP Download Activity"
    $qt = $ws.QueryTables.Add("ODBC;DSN=$DSN;UID=$username;PWD=$password", $ws.Range("A1"), $SQL_Statement)
    if ($qt.Refresh()){
    $ws.Activate()
    $ws.Select()
    $excel.Rows.Item(1).HorizontalAlignment = $xlCenter
    $excel.Rows.Item(1).VerticalAlignment = $xlTop
    $excel.Rows.Item("1:1").Font.Name = "Calibri"
    $excel.Rows.Item("1:1").Font.Size = 11
    $excel.Rows.Item("1:1").Font.Bold = $true
    $filename = "D:\Script\Reports\Status_$a.xlsx"
    if (test-path $filename ) { rm $filename }
    $wb.SaveAs($filename, $xlOpenXMLWorkbook) #save as an XML Workbook (xslx)
    $wb.Saved = $True #flag it as being saved
    $wb.Close() #close the document
    $Excel.Quit() #and the instance of Excel
    $wb = $Null #set all variables that point to Excel objects to null
    $ws = $Null #makes sure Excel deflates
    $Excel=$Null #let the air out
    I would like to use connection string to query the database and write results to EXCEL, i.e.
    $SQL_Statement = "SELECT ..."
    $conn = New-Object System.Data.SqlClient.SqlConnection
    $conn.ConnectionString = "Server=10.10.10.10;Initial Catalog=mydatabase;User Id=$username;Password=$password;"
    $conn.Open()
    $cmd = New-Object System.Data.SqlClient.SqlCommand($SQL_Statement,$conn)
    do{
    try{
    $rdr = $cmd.ExecuteReader()
    while ($rdr.read()){
    $sql_output += ,@($rdr.GetValue(0), $rdr.GetValue(1))
    $transactionComplete = $true
    catch{
    $transactionComplete = $false
    }until ($transactionComplete)
    $conn.Close()
    How would I read the columns and data for $sql_output into an EXCEL worksheet. Where do I find these tutorials?

    Hi Q.P.Waverly,
    If you mean to export the data in $sql_output to excel document, please try to format the output with psobject:
    $sql_output=@()
    do{
    try{
    $rdr = $cmd.ExecuteReader()
    while ($rdr.read()){
    $sql_output+=New-Object PSObject -Property @{data1 = $rdr.GetValue(0);data2 =$rdr.GetValue(1)}
    $transactionComplete = $true
    catch{
    $transactionComplete = $false
    }until ($transactionComplete)
    $conn.Close()
    Then please try to use the cmdlet "Export-Csv" to export the data to excel like:
    $sql_output | Export-Csv d:\data.csv
    Or you can export to worksheet like:
    $excel = New-Object -ComObject Excel.Application
    $excel.Visible = $true
    $workbook = $excel.Workbooks.Add()
    $sheet = $workbook.ActiveSheet
    $counter = 0
    $sql_output | ForEach-Object {
    $counter++
    $sheet.cells.Item($counter,1) = $_.data1$sheet.cells.Item($counter,2) = $_.data2}
    Refer to:
    PowerShell and Excel: Fast, Safe, and Reliable
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang

  • What should i do with an Oracle 11g Database, MySQL database and a dump file.

    I just joining to a new work field, almost about a database and i know "NOTHING" about this field.
    My company has a system that running by Oracle Database, the problem is that Oracle Database will cost a lot of money when my company expands.
    So the quest is converting Oracle Database to MySQL database.
    Of course i cant try to convert it in the main Database, so i create one Oracle 11g Database on my LocalHost, and it already actived in " Localhost:1158 " etc.
    I have another Sever test that already set up MySQL database, and a dump file from the system.
    So I want to ask these 2 questions :
    1. How to create an new Oracle Database from that dump file ?
    2. Is it alright if i use tool to convert Oracle Database into MySql, or i should do it manually ?
    Thanks alot.

    I just joining to a new work field, almost about a database and i know "NOTHING" about this field.
    My company has a system that running by Oracle Database, the problem is that Oracle Database will cost a lot of money when my company expands.
    So the quest is converting Oracle Database to MySQL database.
    I predict that converting to MySQL will cost your company more as it expands. As you expand managing contention becomes more important - Oracle does this for you. I do not think MySQL does, so you'll have to write more code to deal with this, costing the company money. A big part of making application scalable and reliable is to use stored procedures, how good are MySQL's compared to PL/SQL's. What other features are there that MySQL has that will benefit your company that Oracle doesn't. What do you need to think about as your company expands that need to be taken care of in the database. I would have thought a migration from MySQL to Oracle would be more common to deal with expansion.
    As you know "NOTHING" you need to think about what each database can give you for the next 10 years to cope with you businesses potential requirements, and extimate how much it will cost to implement these requirements, then make the decision

  • How can i compare two databases and their tables

    i have a text.txt file then
    i will insert it into db_header and db_details
    db_header has tbl_pcountheader with fld_Rack_No(char) PK and fld_DateAdded(date) PK
    db_details has tbl_pcountdetails with fld_Rack_No(char) PK, fld_Barcode(char) PK and fld_Quantity(int)
    then i will lookup in db_products
    db_products has tbl_products and tbl_barcodes
    tbl_products has fld_ItemCode
    tbl_barcodes has fld_Barcode and fld_ItemCode
    now i want to make a prompt contains
    Rack No: Date:
    Counter No:
    Barcode | Item Code | Item Description | Quantity
    how can i fill up this by comparing db_details and db_products?
    Private Sub bt_upload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_upload.Click
    If saveCheckBox.Checked = False Then
    MsgBox("Please click the box to continue.")
    Return
    End If
    If lb_file.SelectedItem Is Nothing Then
    MessageBox.Show("Please select a file.")
    Exit Sub
    End If
    ' Obtain the file path from the list box selection.
    Dim filePath = lb_file.SelectedItem.ToString
    ' Verify that the file was not removed since the Browse button was clicked.
    If System.IO.File.Exists(filePath) = False Then
    MessageBox.Show("File Not Found: " & filePath)
    Exit Sub
    End If
    ' Obtain file information in a string.
    Dim fileInfoText As String = GetTextForOutput(filePath)
    'LookUP db_header, db_details and db_products
    Dim cs As String = "Database=;Data Source=localhost;" _
    & "User Id=root;Password=1234"
    Dim conn As New MySqlConnection(cs)
    Dim ds As New DataSet
    Dim da As New MySqlDataAdapter
    Dim cmd As New MySqlCommand
    Dim dt As New DataTable
    Dim stm As String = "SELECT tbl_pcountheader.fld_Rack_No, tbl_pcountheader.fld_DateAdded, tbl_pcountdetails.fld_Barcode, tbl_products.fld_ItemCode, tbl_products.fld_ItemDesc, tbl_pcountdetails.fld_Quantity FROM db_header.tbl_pcountheader INNER JOIN db_details.tbl_pcountdetails ON db_details.tbl_pcountdetails.fld_Rack_No = db_header.tbl_pcountheader.fld_Rack_No INNER JOIN db_products.tbl_barcodes ON db_details.tbl_pcountdetails.fld_Barcode = db_products.tbl_barcodes.fld_Barcode INNER JOIN db_products.tbl_products ON db_products.tbl_barcodes.fld_ItemCode_fk = db_products.tbl_products.fld_ItemCode GROUP BY tbl_pcountheader.fld_Rack_No, tbl_pcountheader.fld_DateAdded ORDER BY tbl_pcountheader.fld_Rack_No"
    ds = New DataSet
    Try
    conn.Open()
    da = New MySqlDataAdapter(stm, conn)
    da.Fill(ds, "tbl_pcountheader")
    DataGridView1.DataSource = ds.Tables("tbl_pcountheader")
    Dim headers = (From header As DataGridViewColumn In DataGridView1.Columns.Cast(Of DataGridViewColumn)() _
    Select header.HeaderText).ToArray
    Dim rows = From row As DataGridViewRow In DataGridView1.Rows.Cast(Of DataGridViewRow)() _
    Where Not row.IsNewRow _
    Select Array.ConvertAll(row.Cells.Cast(Of DataGridViewCell).ToArray, Function(c) If(c.Value IsNot Nothing, c.Value.ToString, ""))
    Using sw As New IO.StreamWriter("c:\report.txt", append:=True)
    sw.WriteLine(String.Join(",", headers))
    For Each r In rows
    sw.WriteLine(String.Join(",", r))
    Next
    End Using
    ds.WriteXmlSchema("Sample.xml")
    Dim cr As New CrystalReport1()
    cr.SetDataSource(ds)
    CrystalReportviewer1.ReportSource = cr
    CrystalReportviewer1.Refresh()
    Catch ex As MySqlException
    MsgBox("Error: " & ex.ToString())
    Finally
    conn.Close()
    End Try
    ' Show the file information.
    Dim PrintPrompt As String
    PrintPrompt = MsgBox(fileInfoText, MsgBoxStyle.YesNo, "ProofList")
    If PrintPrompt = vbYes Then
    'fileInfoText.print()
    If saveCheckBox.Checked = True Then
    ' Place the log file in the same folder as the examined file.
    Dim bakFolder As String = System.IO.Path.GetDirectoryName(filePath)
    Dim bakFilePath = System.IO.Path.Combine(bakFolder, "back-up.bak")
    Dim bakText As String = "Backed-Up: " & Date.Now.ToString & vbCrLf & fileInfoText & vbCrLf & vbCrLf
    ' Append text to the log file.
    'System.IO.File.AppendAllText(bakFilePath, bakText)
    My.Computer.FileSystem.WriteAllText(bakFilePath, bakText, append:=True)
    'My.Computer.Network.UploadFile(bakFilePath, "C:\Documents and Settings\SAPC-TECH\My Documents\back-up file.bak", "", "", False, 1000)
    'My.Computer.FileSystem.DeleteFile(bakFilePath)
    'Form2.Show()
    End If
    'Note: This message box shows that you've uploaded a file and back up it.
    MessageBox.Show("Already backed-up to ")
    Else
    'Me.Close()
    'Application.Exit()
    'End
    End If
    'Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
    'Form2.Close()
    'Me.Close()
    End Sub
    here's my final code that solves my problem.
    i just make the environment of vb into mysql console
    so that i can call all the database that i wanted.

    Private Sub bt_upload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_upload.Click
    If saveCheckBox.Checked = False Then
    MsgBox("Please click the box to continue.")
    Return
    End If
    If lb_file.SelectedItem Is Nothing Then
    MessageBox.Show("Please select a file.")
    Exit Sub
    End If
    ' Obtain the file path from the list box selection.
    Dim filePath = lb_file.SelectedItem.ToString
    ' Verify that the file was not removed since the Browse button was clicked.
    If System.IO.File.Exists(filePath) = False Then
    MessageBox.Show("File Not Found: " & filePath)
    Exit Sub
    End If
    ' Obtain file information in a string.
    Dim fileInfoText As String = GetTextForOutput(filePath)
    'LookUP comparison db_details to db_products
    'Dim connString As String = "Database=db_products;Data Source=localhost;" & "User Id=root;Password=1234"
    'Dim conn As New MySqlConnection(connString)
    'Dim cmd As New MySqlCommand()
    'Try
    ' conn.Open()
    ' cmd.Connection = conn
    ' cmd.CommandText = "SELECT Database1.dbo.TableName.ColumnName, Database2TableName.Name, 'The reason why Database 2 isnt defined is the fact that it has been defined in the connection" _
    ' FROM Database2TableName INNER JOIN _
    ' Database2TableName2 INNER JOIN _
    ' WHERE (Database1.dbo.TableName.ColumnName = '')"
    ' cmd.Prepare()
    ' cmd.ExecuteNonQuery()
    ' conn.Close()
    'Catch ex As Exception
    'End Try
    ' Show the file information.
    Dim PrintPrompt As String
    PrintPrompt = MsgBox(fileInfoText, MsgBoxStyle.YesNo, "ProofList")
    If PrintPrompt = vbYes Then
    'fileInfoText.print()
    If saveCheckBox.Checked = True Then
    ' Place the log file in the same folder as the examined file.
    Dim bakFolder As String = System.IO.Path.GetDirectoryName(filePath)
    Dim bakFilePath = System.IO.Path.Combine(bakFolder, "back-up.bak")
    Dim bakText As String = "Backed-Up: " & Date.Now.ToString & vbCrLf & fileInfoText & vbCrLf & vbCrLf
    ' Append text to the log file.
    'System.IO.File.AppendAllText(bakFilePath, bakText)
    My.Computer.FileSystem.WriteAllText(bakFilePath, bakText, append:=True)
    'My.Computer.Network.UploadFile(bakFilePath, "C:\Documents and Settings\SAPC-TECH\My Documents\back-up file.bak", "", "", False, 1000)
    'My.Computer.FileSystem.DeleteFile(bakFilePath)
    Form2.Show()
    End If
    'Note: This message box shows that you've uploaded a file and back up it.
    MessageBox.Show("Already backed-up to ")
    Else
    Me.Close()
    Application.Exit()
    End
    End If
    Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
    Form2.Close()
    Me.Close()
    End Sub
    here's my code wherein i have to compare the two database and save it into .txt file
    i just have to get this items
    Rack No:
    Date:
    Counter No:
    Barcode:
    Item Code:
    Item Description:
    Quantity:
    as a prooflist to be print out.

  • I am using the database connectivity toolkit to retrieve data using a SQL query. The database has 1 million records, I am retrieving 4000 records from the database and the results are taking too long to get, is there any way of speeding it up?

    I am using the "fetch all" vi to do this, but it is retrieving one record at a time, (if you examine the block diagram) How can i retrieve all records in a faster more efficient manner?

    If this isn't faster than your previous method, then I think you found the wrong example. If you have the Database Connectivity Toolkit installed, then go to the LabVIEW Help menu and select "Find Examples". It defaults to searching for tasks, so open the "Communicating with External Applications" and "Databases" and open the Read All Data. The List Column names just gives the correct header to the resulting table and is a fast operation. That's not what you are supposed to be looking at ... it's the DBTools Select All Data subVI that is the important one. If you open it and look at its diagram, you'll see that it uses a completely different set of ADO methods and properties to retrieve all the data.

  • Include or create a view in the database and use this view?

    Well, I need to get related data of the main table from another related tables, so one way to do that is to use the Include method in Entity Framework to get this related data.
    However, I am thinking in another option, create a view in the database and use this view in entity framework. In this way, I avoid the needed of the include, because I think that is expensive in resources. But I am no very sure about that.
    I would like to know if the use of views on entity framework is a good idea to improve the performace or is better to use the include.
    For example, if I use the include I have the advantage that I get only one the main record and all the related data I have in the navigation properties, so the info is more shorted.
    Which is the advanteges and disadvantages of both methods to get related data in entity framework?
    Thank so much.

    Hello ComptonAlvaro,
    >>I would like to know if the use of views on entity framework is a good idea to improve the performace or is better to use the include.
    If your view would use a Join syntax to query master-child relationship tables, it actually is similar with the Include() method which actually results a duplicate records from master table, you could check this
    link for detail description.
    >>Which is the advanteges and disadvantages of both methods to get related data in entity framework?
    One visible difference is that records from Views are not editable by default(if you want edit them, you could refer to this
    blog).
    In your case, my suggestion that you could use the lazying load which will load the matter table once and disable the trace if you only need to display data.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Database and page Load Issue

    Well recently I needed to change the database tables and had to remove one table within the databse. Using MySQL 5
    After I cleaned up all traces of information related to the table which was removed I decided to deploy and try out the application. When I try to enter one of the pages I get this error:
    java.lang.RuntimeException: java.sql.SQLException: Error in allocating a connection. Cause: The connection is not valid as querying the table roles failed: Table 'database.table' doesn't exist
    And here is the stack trace that came with the error:
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    java.security.AccessController.doPrivileged(AccessController.java:-2)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
    org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
    org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
    java.security.AccessController.doPrivileged(AccessController.java:-2)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:723)
    org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:482)
    org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:417)
    org.apache.catalina.core.ApplicationDispatcher.access$000(ApplicationDispatcher.java:80)
    org.apache.catalina.core.ApplicationDispatcher$PrivilegedForward.run(ApplicationDispatcher.java:95)
    java.security.AccessController.doPrivileged(AccessController.java:-2)
    org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:313)
    com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
    com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:311)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    java.security.AccessController.doPrivileged(AccessController.java:-2)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
    org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
    org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
    java.security.AccessController.doPrivileged(AccessController.java:-2)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:210)
    org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
    org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
    java.security.AccessController.doPrivileged(AccessController.java:-2)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
    org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:189)
    com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask.java:604)
    com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:475)
    com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:371)
    com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:264)
    com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281)
    com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83)
    The problem is I can't find any traces of the table i removed left in the project, I did a find all in the project of a keyword which will pick up on the table and removed it.
    Another interesting fact is that when I remove the data providers in the page which have no connection to the table I removed the program will load fine. I also checked all my queries and they were all displaying correctly.
    Any ideas?

    I found out the reason for the error, the validation table I had set was used by the datasource, after I removed the table Java Studio Creator left traces of that and still tried to use the table for validation.
    If anyone else has this problem, the way I fixed this was to open the Servers Window, expand the Deployment Server Node, expand the Resources folder and remove anything there even remotely related to your database, remove your database and re-add it.
    Also, could this be considered a bug? I believe I have a way to reproduce it:
    1) Create a database
    2) Add a datasource set the Validation table to one of the tables
    3) Remove that table from the database
    That should cause the error to show up. When the datasource is removed shouldn't JSC remove any traces of the connection?
    Lastly does this mean that JSC is checking the validation table everytime on deployment?
    A response regarding this would be appreciated

  • Installation problems on Fresh 11.1.0.6 database and Apex 3.1.1

    I hope someone can help - at wit's end trying to get Apex up and running. I've looked through the forum over and over and don't see a resolution.
    I have installed 11g Enterprise Edition on a Solaris 5.10 64bit Sparc system, created a database, setup and configured dbconsole for enterprise manager.
    Database is up, enterprise manager is up and I can connect and browse just fine, but when I went to set up and configure Apex (it was version 3.0 that came with the database) I could only get a blank page trying to go to either the apex or apex_admin pages.
    So re-read documentation and couldn't see what I did wrong. So I started a new Apex install, dropping the FLOWS_030000 and FLOWS_FILES users, downloaded apex 311, and did a fresh install.
    For the record, I'm trying to use the Embedded PL/SQL Gateway instead of the Oracle HTTP Server.
    Here are my steps:
    Downloaded apex_3.1.1.zip, loaded it up on server, and unzipped the file
    sqlplus "/ as sysdba"
    @apexins SYSAUX SYSAUX TEMP /i/
    no errors
    SQL> @apxchpwd
    Enter a value below for the password for the Application Express ADMIN user.
    Enter a password for the ADMIN user []
    Session altered.
    ...changing password for ADMIN
    PL/SQL procedure successfully completed.
    Commit complete.
    SQL> !pwd
    /opt/software/media11g/oracle.server.SunOS510.11106.media/apex/apex
    SQL> @apxldimg.sql /opt/software/media11g/oracle.server.SunOS510.11106.media/apex
    PL/SQL procedure successfully completed.
    Directory created.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    Commit complete.
    Timing for: Load Images
    Elapsed: 00:04:14.62
    Directory dropped.
    SQL> @apex_epg_config /opt/software/media11g/oracle.server.SunOS510.11106.media/apex
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    Directory created.
    Enter value for imgupg: <-- just hit enter
    Enter value for imgupg: <-- just hit enter
    PL/SQL procedure successfully completed.
    Commit complete.
    PL/SQL procedure successfully completed.
    timing for: Load Images
    Elapsed: 00:04:02.80
    Session altered.
    PL/SQL procedure successfully completed.
    Commit complete.
    Session altered.
    Directory dropped.
    SQL> EXEC DBMS_XDB.SETHTTPPORT(7459);
    PL/SQL procedure successfully completed.
    SQL> SELECT DBMS_XDB.GETHTTPPORT FROM DUAL;
    GETHTTPPORT
    7459
    I ran the following PL/SQL cut and pasted from the install doc to enable network services:
    SQL> DECLARE
    ACL_PATH VARCHAR2(4000);
    ACL_ID RAW(16);
    BEGIN
    -- Look for the ACL currently assigned to '*' and give FLOWS_030100
    -- t 2 he "connect" privilege if FLOWS_030100 does not have the privilege yet.
    SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
    WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
    -- Before checking the privilege, make sure that the ACL is valid
    -- (for example, does not contain stale references to dropped users).
    -- If it does, the following exception will be raised:
    -- ORA- 3 4 5 6 7 8 9 10 11 12 13 44416: Invalid ACL: Unresolved principal 'FLOWS_030100'
    -- ORA-06512: at "XDB.DBMS_XDBZ", line ...
    SELECT SYS_OP_R2O(extractValue(P.RES, '/Resource/XMLRef')) INTO ACL_ID
    FROM XDB.XDB$ACL A, PATH_VIEW P
    WHERE extractValue(P.RES, '/Resource/XMLRef') = REF(A) AND
    EQUALS_PATH(P.RES, ACL_PATH) = 1;
    DBMS_XDBZ.ValidateACL(ACL_ID);
    IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'FLOWS_030100',
    'connect') IS NULL THEN
    DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
    'FLOWS_030100', TRUE, 'connect');
    END IF;
    EXCEP 14 15 16 17 18 19 20 21 22 23 24 25 TION
    -- When no ACL has been assigned to '*'.
    WHEN NO_DATA_FOUND THEN
    DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
    'ACL that lets power users to connect to everywhere',
    'FLOWS_030100', TRUE, 'connect');
    DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
    END; 26 27 28 29 30 31 32
    33 /
    PL/SQL procedure successfully completed.
    SQL>
    I then checked to see if the package was valid:
    SQL> SELECT STATUS FROM DBA_REGISTRY
    WHERE COMP_ID = 'APEX'; 2
    STATUS
    VALID
    Still, when I go to my browser and enter the following url:
    http://dbsu01a.sit.us.wamu.net:7459/apex/apex_admin
    all I get is a blank page.
    http://dbsu01a.sit.us.wamu.net:7459/apex
    returns a "page not found" error.
    It must be one of those "is your computer plugged in?" things - any help would be greatly appreciated.

    Here was the fix:
    My local_listener parameter in the init.ora (spfile) was not set. I ran the following as sys:
    alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=<hostname>)(PORT=<port>))' scope=both;
    Bounced the listener and the database and after about 3 minutes listener status showed the following new endpoint:
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<host>)(PORT=9969)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<host>)(PORT=7459))(Presentation=HTTP)(Session=RAW)) <-- this is the XDB entry.
    After that I was able to log into APEX!

Maybe you are looking for

  • Bsx error in migo

    Hi Experts, I have created my own chart of accounts ( not copied from standard INT ). While trying to post MIGO, the following error is getting displayed. 1) Account determination for entry XXXX BSX not possible. when i try to lead through the diagno

  • Another incedibly stupid bug

    If you email an image from within Aperture the programme opens up mail but then nothing happens. You have to quit mail and then restart it again for a draft to pop up as a new message with the image attached so that you can send it to the recipient.

  • Currency Tranlation Type with Fiscal Year Period

    Hello Friends, I have a requirement to Choose the Currency Conversion in Context Menu right mouse click on report and then select "Currency Tranlation Type" Monthly Average (002M) thenCurrency Tranlation Type should take the fiscal period/fiscal year

  • Gah.. can't join domain! DNS problem

    The server has Intel Xeon CPU E5606 @ 2.13 GHz,  8 GB RAM. Windows Server 2012 R2 DataCenter x64 The workstation has Intel Core i7 4820K CPU @ 3.70 GHz 16 GB RAM. Windows 8.1 Professional x64

  • Trial Version of Contribute 3

    I am using the Trial Version of C3 to see if it would be useful for our school. First Problem: I have no problem setting up a new user via CPS but when I go to email the connection key cannot be done automatically via Outlook I have to download to my