Connect to database and write query statements in the *****Impl.java??

http://www.oracle.com/technology/pub/articles/vohra-jdev-xmlpub.html
I used the above link to create XML's and from there a formatted report of data from the database. I accomplish this by connecting to the database inside the XMLPublisher.java file. I also have my query hard-coded inside the DataTemplate.xml to extract the info from the database. This limits my ability on what the user can accomplish with the system.
Is it possible to run my reports based on an iterator within Jdeveloper, as opposed to having to manually enter the query and connect to the database within the XMLPublisher.java file and the template.xml? ..Possibly connecting to the database and and writing queries in the *****impl.java?
Thanks.

Rather than inventing your own demi-donkeyed solution I recommend you consider using Oracle's Fine-Grained Auditing which does precisely this.
Cheers, APC

Similar Messages

  • 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

  • How to retrieve characters like '£' from the database and write to xml file

    Hi ,
    I have a requirement to retrieve the data from database and write to files in XML format.
    I am able to do so successfuly by using XMLElement tag and writing to file through UTL_File package.
    All characters like <&@^ get converted properly, but when it comes to multibyte chars like '£', they are not able to get converted as it is.
    Can somebody please advise me how to go ahead.
    Regards

    Thanks odie.
    The nls_charset for my database is WE8ISO8859P1 and database version is Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi.
    The data (with pound sign) is sitting in one of the columns of the table and when i query it directly, I am able to view it properly.
    However when I use the below code to retrieve in XML format and print it to file, it gets changed. This file is also passed to one of the application GUI where this XML gets processsed and it is not visible properly.
    below id the sample abstract of code I am using.
    Declare
    l_file UTL_FILE.FILE_TYPE;
    l_clob CLOB;
    l_buffer VARCHAR2(32767);
    l_amount BINARY_INTEGER := 32767;
    l_pos INTEGER := 1;
    Begin
    SELECT XMLElement("case",
    XMLElement("comments",
    XMLElement("comment",
    XMLElement("comments",a.COMMENTS)
    ).getClobVal() val1 into l_clob
    FROM TO_COMMENTS a
    l_file :=
    UTL_FILE.fopen (XMLDIR,
    test.xml,
    'w',
    32767);
    LOOP
    DBMS_LOB.read (l_clob,
    l_amount,
    l_pos,
    l_buffer);
    UTL_FILE.put_line (l_file, l_buffer);
    l_pos := l_pos + l_amount;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    DBMS_OUTPUT.NEW_LINE('Reached end of file');
    END;
    The comments column given contains the character like pound.
    And once the file is generated and i see using the vi editor, the char is not viewable properly like £
    And when the same is passed to GUI application to be processed, its not viewable propely in GUI from IE as well like �.

  • I am trying to connect my mac and PC through my network. the pc can seen and connect with the mac, but my mac can only see the pc it can't connect. how do i fix this?

    i am trying to connect my mac and PC through my network. the pc can seen and connect with the mac, but my mac can only see the pc it can't connect. how do i fix this?

    FORCE IPAD INTO RECOVERY MODE
    1. Turn off iPad
    2. Turn on computer and launch iTune (make sure you have the latest version of iTune)
    3. Plug USB cable into computer's USB port
    4. Hold Home button down and plug the other end of cable into docking port. Do not release button until you see picture of iTune and plug.
    5. Release Home button.
    ON COMPUTER
    6. iTune has detected iPad in recovery mode. You must restore this iPad before it can be used with iTune.
    7. Select "Restore iPad"...
    Note: Data will be lost

  • I know my network connection is fine and I've checked all the cables and that the tv is set to the correct source, but even though Apple Tv is on and responds with beeps when I hit the button, I see nothing on the screen. What do I do next?

    I know my network connection is fine and I've checked all the cable connections and my television is set to the correct input, but even though the remote beeps when I hit the button, I see nothing on the screen. The troubleshooting section in the setup guide says to make sure that Apple Tv is connected to my network by choosing Settings>General>Network. How do I do this? What do I need to do to get everything back? I've been using the Apple tv for a while now, and suddenly it's doing this.

    This is the iPod touch forum. I requested your posted be moved to the Apple TV forum
    Using Apple TV

  • My firefox page is not connecting to network and also its not displaying the troubleshoot problems option?

    my firefox page is not connecting to network and also its not displaying the troubleshoot problem option?

    At the very least, I recommend you restart your router, (your internet box).
    More detail on your problem is needed - are you in a submarine? On the moon? On a tropical island?
    You can help yourself by providing as much info as you can about your present situation - what kind of router do you have? Have you moved it? DId you update it?  Did you do anything to change your setup, and if you did, what?

  • On 01/22/2013, facetime will not connect to my husband's phone. We talked this morning at approximately 8am PST and since then it just goes to connecting...and stalls...whats the problem?

    On 01/22/2013, facetime will not connect to my husband's phone. We talked this morning at approximately 8am PST and since then it just goes to connecting...and stalls...whats the problem?

    Nobody here would know what the problem is.

  • When using the Database Connectivity Toolset, reads and writes with long binary fields are incompatible.

    I am trying to write LabVIEW Variants to long binary fields in a .mdb file using the Database Connectivity Toolset. I get errors when trying to convert the field back to a variant after reading it back from the database.
    I next tried flattening the variant before writing it and ultimately wound up doing the following experiments:
    1) If I use DB Tools Insert Data to write an ordinary string and read it back using a DB Tools Select Data, the string is converted from ASCII to Unicode.
    2) If I use DB Tools Create Parameterized Query to do an INSERT INTO or an UPDATE operation, specifying that the data is BINARY, then read it back using a DB Tools Select Data,
    the length of the string is prepended to the string itself as a big-endian four-byte integer.
    I can't think of any way to do a parameterized read, although the mechanism exists to return data via parameters.
    Presuming that this same problem affects Variants when they are written to the database and read back, I could see why I get an error. At least with flattened strings I have the option of discarding the length bytes from the beginning of the string.
    Am I missing something here?

    David,
    You've missed the point. When a data item is flattened to a string, the first four bytes of the string are expected to be the total length of the string in big-endian binary format. What is happening here is that preceding this four-byte length code is another copy of the same four bytes. If an ordinary string, "abcdefg" is used in place of the flattened data item, it will come back as <00><00><00><07>abcdefg. Here I've used to represent a byte in hexadecimal notation. This problem has nothing to do with flattening and unflattening data items. It has only to do with the data channel consisting of writing to and reading from the database.
    I am attaching three files that you can use to demonstrate the problem. The VI file c
    ontains an explanation of the problem and instructions for installing and operating the demonstration.
    Ron Martin
    Attachments:
    TestLongBinaryFields.vi ‏132 KB
    Sample.UDL ‏1 KB
    Sample.mdb ‏120 KB

  • Connect Firebird Database and coding in  Action Script

    Hello Friends
    I am new for Flex. I want to ask some questions. I hope i will get right answers as soon as possible.
    Thanks to all in advance.
    I have Firebird database. I want to create one desktop application and i want to store data in Firebird database but i don't know how to connect firebird database?
    Also i don't want to use .net or php or any other language. Is it possible to connect firebird database using action script? can i do insert,update and delete functionality or firebird database using action script?
    Plz reply me and if you have links or code then plz send me . If you want to send email me the send on [email protected]
    Thanks & Regards
    Manjurhusen Momin
    Sr. Software Developer
    Nichetech Solutions Pvt Ltd.

    Yes,  atleast NOT with core ActionScript3.0.
    If you are developing Flex Web Application then you must have to use PHP, .NET, JAVA
    If it's an AIR app then some apecial packages are provided to communicate with database and that too with very limited scope. If you need more data intensive operation then again you have to use other language.
    You can refer to
    http://livedocs.adobe.com/flex/3/html/help.html?content=SQL_05.html
    Abhinav

  • How to insert a sql query statement in the table

    I have a stored procedure which has different insert,update statements on different tables. I am writing a trigger on these tables such that when the record is updated or inserted in these tables a trigger should fire and should write the old value,new value and the query (insert or update) that caused the trigger to fire in the seperate table. Is there any way to find out the exact query statement that fired the trigger?

    Rather than inventing your own demi-donkeyed solution I recommend you consider using Oracle's Fine-Grained Auditing which does precisely this.
    Cheers, APC

  • Insert and update query to calculate the opening and closing balance

    create table purchase(productid number(5) ,dateofpurchase date,
    qty number(5));
    create table inventory(invid number(5),productid number(5),
    idate date,openingqty number(5),closingqty number(5));
    Records in inventory:
    1,1,'01-jan-2009', 10, 20
    2,1,'03-jan-2009', 20, 30
    3,1,'04-jan-2009', 40, 50
    when I enter the purchase invoice for 15 qty on 02-jan-2009
    after say '15-jan-09' , a new record should get inserted
    with opening balance = (closing balance before 02-jan-2009)
    and all the opening and closing balance for that product should
    get affected.
    If the invoice for 20 qty is entered for the existing date say
    '03-jan-2009' in inventory , then the closing balance
    for 03-jan-2009 should get updated and all the following records
    should get affected.
    I need the insert for the first one and update query for the
    second one.
    Vinodh

    <strike>You can do this in one statement by using the merge statement</strike>
    Hmm, maybe I spoke too soon.
    Edited by: Boneist on 25-Sep-2009 13:56
    Thinking about it, why do you want to design your system like this?
    Why not simply have your purchases table hold the required information and then either work out the inventory on the fly, or have a job that calls a procedure to add a row for the previous day?
    If you continue with this design, you're opening yourself up to a world of pain - what happens when the data doesn't match the purchases table? Also when is the inventory cut-off to reset the opening/closing balances? Monthly? Annually? Weekly? If it's set to one of those, what happens when the business request the inventory for a particular week?
    Edited by: Boneist on 25-Sep-2009 13:59

  • I was doing OS5 help update iphone but now no longer connects to PC and iTunes does not see the phone

    I was doing OS5 help update iphone but now no longer connects to PC and iTunesdoes not see the phone

    Hold Sleep Button with Home Button toghether until it restarts Always it takes 8 to 15 seconds, after it restarts leave the sleep button and remember do not leave the home button it automaticlly switches to DFU mode.

  • HT201317 When I connected my phone and my iPad not all the photos in my photo stream moved over. Why not and how can I fix it?

    When I connected my iPhone and iPad via iCloud not all photos in my photo stream copied over. Why not and how do I fix it?

    Welcome to the Apple community.
    Only the last 30 days of photos are kept in photo stream in the cloud for syncing. Devices that have been syncing with photo stream for some time may retain older photographs that newer devices do not receive from photo stream.

  • NTFS Confusion - my new macbook reads and writes fine out of the box

    I just purchased my first Mac and was a bit worried about having to format all my external drives to FAT32 or use a third party program. However, after copying all my backup files from my external, I then discovered that I was also able to drag and drop files back onto the drive just fine.
    Is this a new function built into recent Macs or what? The drive says its NTFS and even says on the box to reformat to work with Mac.
    Anyone else experience this?

    black562 wrote:
    Well this is interesting. I got home and decided to look at the drive properties and, even though it says NTFS on the box, its actually FAT32....so that answers alot of questions.
    I guess the good news is that I don't have to change it now....its nice when problems work themselves.
    Unless you want to use it with Time Machine (either as a source or destination), or put any files larger than 4 GB on it.

  • User_exit - connect to database and ora -3114

    Hello All,
    I am trying to connect to oracle database using an user_exit and not the built in LOGON function .
    the user_exit - can connect to the DB ( I see a connection in v$session) , but when the form tries to perform any other action (like simple select ) i get a ora-3114 - not connected to oracle .
    how ever if on the logon trigger instead of using the user_exit i use the built in logon - all is working fine.
    my conclusion is that the user_exit , although connects to the oracle DB somehow does not "populate" the connection to the forms
    how come ?
    why ?
    any way to solve this issues ?
    thanks
    S.
    p.s.
    the reason i am trying to perform that is because the built in logon function, can not accept passwords which contains the @ sign .

    USER_EXIT is used to call a function outside Forms. So, it creates a separate connection to the database. Your Forms session still has no connection.
    I don't think there is any other way to connect Forms to the database than the LOGON built-in.

Maybe you are looking for