Csv export from vbnet 2005

I am using vb net 2005 and have several reports that I access from the frontend.  The all run real nice.  My problem is when I try to export a report in csv format it is not exporting right it will not export sub reports.  How do I get the front end to export subreports data within reports?

Hi Sandra,
As subreports can not be exported in csv format due to limitations
Try with this line of code its a workaround.I have tested at my end on VS2005 .
//First of all Export the report in Excel and then save it to csv format
ReportDocument Rdoc = new ReportDocument();
Rdoc.Load(Server.MapPath(u201CCrystalreport.rptu201D);
Rdoc.ExportToDisk(ExportFormatType.Excel,u201DC:\Windows\Temp\ExportedReport.csvu201D);
Hope this helps !!
Regards,
Shweta
Edited by: Shweta Sharma on Sep 13, 2008 1:52 AM
Edited by: Shweta Sharma on Sep 13, 2008 2:03 AM

Similar Messages

  • Multiple CSV exports from the one button or pl/sql procedure?

    I need to have multiple csv exports from the one press of a button. The easiest way I found to do this is it to use javascript to popup three windows, each as a CSV link. This is a bit ugly though, and leaves the browser popup windows open when the file has been downloaded.
    I guess I could also make a solution based on branching, but I think that would be difficult to maintain and reeks of bad design (im not a fan of this spagetti GOTO style code!).
    I implemented Scott's custom CSV as found here: http://spendolini.blogspot.com/2006/04/custom-export-to-csv.html
    However I would like to know if its possible to download more than one file using this method. I could not work out how to do this .
    Has anyone got any ideas? Simply repeating the code puts the second table into the original csv file. Is there a way to 'reset' the htp writer or smoething?
    Any help greatly appreciated,
    Alex

    Sorry for the confusion - I guess I mean its easy in .NET because you can simply compress files together and then send 1 zip file down as the response. See http://www.developer.com/net/net/article.php/11087_3510026_2 for details.
    I guess I could ask how to do this in APEX - but it seems to me that my original wording addresses the concept at a much more abstract level. I may not find the best solution for my problem if I just asked 'how can I dynamically zip together three tables as seperate files and send them to the client?'. I also suspect that this method is not possible in APEX without custom packages. Please prove me wrong!
    I guess even if I could find some kind of javascript that didnt open a new window, but was a direct download to the CSV, that would be a good compromise. At the moment when you click on the link, three windows come up and stay blank until the files are ready for downloading. Then after the files have been downloaded the windows must be shut manually. Yes, I could use javascript to make the windows 1x1 pixel perhaps, and then shut them after a predetermined timeframe - but this is hardly an elegant solution!
    Thanks for your responses.

  • ORA-20876 in csv export from interactive report = Possibly a bug?

    Hi Apex team,
    yesterday i tried to download data to csv from an interactive report. The resulting csv file contained a "ORA-20876: Stop APEX Engine" only and no other data. I played around with other reports in my application and had no problems with exports.
    After some investigation i found out that the buggy report contains a column of display type "Display as text (based on a LOV, escape special characters)". When I changed this column type to "Standard Report Column" for example, the error didn't appear anymore and the csv export contained complete data.
    Maybe this is a bug? The environment is Apex 4.1.1.00.23 on 11g (UTF-8). Is there a workaround available?
    Regards,
    Jens
    Edited by: j.gauger on 06.02.2013 14:10
    Additional Information
    The problem seems to occur only if a Shared Components LOV of type "Static" is referenced in the IR column.

    Hi,
    what happens if you take the query from IR report and create a new classic report?
    On this report enable csv export and then try the export.
    Maybe that (format) data are causing export to fail.
    Try to export just one row in your IR report (and classic report), so that you add where rownum < 2.
    Regards,
    Aljaz
    Edited by: Aljaz on 6.3.2012 23:11
    Edited by: Aljaz on 6.3.2012 23:29

  • Automated csv Export from a specific Tab in a Excel Workbook

    Hi,
    i would like to export a specific tab from an excel workbook on a application server in csv format - how can i do this?
    Query Extractor doesn´t - about OpenHub i am not shure.
    thx in advance!
    cu
    Dominik

    Hi,
    I think Tcode RSCRM_BAPI can help you to save in CSV format in application server from ur query.make sure you dont have any free characteristics in ur query.give it a try and lets know.If you are looking for procedure Goto TCode RSCRM_BAPI and select ur query or query view and on the toolbar select Extract and in the next screen give some tech name and select .CSV format give the file path in ur application directory and dont forget to schedule the selction.Then you would be able to see ur report in .CSv format in ur app server.
    Regards
    Chandru

  • CSV export from SSRS gives a line break if there are two tables

    I have a report with two tables. There is no gap between in the reports. The report looks good when I run it, but when I export the report to CSV, there is an extra line between the two tables. Can somebody help me fix this issue.
    Thanks in advance.
     

    Hi Bindu,
    If I understand correctly, you have two tables in the report. When you export to CSV, it has an extra blank line between these two tables. I have create a simple report in my test environment, I can reproduce the same issue.
    Based on your description, you want to splice these two tables with no gap in the report. I order to meet your requirement, we can use subreport to work around the issue. We can insert two aubreports in one table. Then, display these two tables in these
    two subreports.
    Reference: Subreports
    Alternatively, we can display these data in one table to work around the issue. If possible, you can post your sample data, we can to do further analysis. If these columns is from two datasets, please check if there has same fields. If so, we can use
    Lookup function to display two datasets data in one tablix.
    Regards,
    Alisa Tang
    If you have any feedback on our support, please click
    here.
    Alisa Tang
    TechNet Community Support

  • CSV export from SSRS gives an extra header

    I have an SSRS report which I am exporting to CSV. The report doesn't have a header and it is perfect when I run and it. But, when I export it to CSV, it gives me the names of the textboxes as the header. I tried setting 'DataElementOutput' property to 'NO
    Output'. I also tried changing the rsReportServer config file for no header. None of these worked. Can somebody help me fix this.
    Thanks in advance.

    Hi Bindu,
    By design, SQL Server Reporting Services render a report to CSV format with text boxes' name in detail section as columns' name, not the table header when you view the table. So if we want to hide the header row of the tablix in CSV format, please double
    check the steps below to enable the “NoHeader” setting in the RSReportserver.config file:
    Please navigate to RSReportserver.config file: <drive:>\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer \RSReportserver.config.
    Backup the RSReportserver.config file before we modify it, open the RSReportserver.config file with Notepad format.
    In the <Render> section, add the new code for the CSV extension like this:
    < Extension Name="CSV"   Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering">
    <Configuration>
    <DeviceInfo>
    <NoHeader>True</NoHeader>
    </DeviceInfo>
    </Configuration>
    < /Extension>
    Save the RSReportserver.config file.
    Besides, If we could build the URL for when user want to export without header, try adding NOHEADER=true in the URL.
    For more information about CSV Device Information Settings, please see:
    http://msdn.microsoft.com/en-us/library/ms155365.aspx
    If you have any other questions, please feel free to ask.
    Thanks,
    Katherine xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • No CSV export from Addressbook?

    WOW. How did Apple get away with this for all these years? I recently migrated from Now Up To Date to Addressbook so I could be "all Mac" and now my contact content is stuck inside?
    There seems to be a program for sale for $18 (Export Address Book), but I have to say as HUGE Apple supporter evangelist, this is a bit odd of a missing option that we shouldn't have to pay for IMHO.
    I'll keep checking for other solutions. I can afford the $18, it's the principle. I'm just stunned there's now export within AB I can open in a spreadsheet. Very odd.
    Unless I'm missing something?

    Oh, I totally missed that sorry. I'm in Automator now and see what you mean.
    For those not familiar with Automator, it's in your Applications folder. Launch it and then you'll see a window of several icons.
    Select and Choose the Application icon.
    Then in the left column of Automator you'll see Library and Contacts under it along with other choices. Single click "Contacts" and in the middle column you'll now see a new list of options, drag "Get Contact Information" to the far right column (Drag actions to build workflow).
    Now you'll see all your Contact fields and in the top row: "Export Format" with a pulldown menu with: Formatted Text, Spreadsheet (tabs) and AppleScript Lists.
    Choose Spreadsheet (tabs) if you want a file of your contacts that you can open in a program like Excel.
    You'll also note that you can check or uncheck which fields you want to export.
    I assume that when you are ready, you click "Run" in the upper right of the window.
    Right Barney?
    Thanks Barney for pointing me/us here.
    Steven

  • Calling csv export from button not link?

    Gday,
    I was wondering if it is possible to call the export csv functionality via a button and the default hyperlink functionality?
    Cheers

    Hi,
    You actually need to mess with two templates - the region one and a new button one.
    Firstly, update the report's region template to include the following at the top of the "Template" setting:
    &lt;script type="text/javascript"&gt;
    var regionid="#REGION_ID#"
    &lt;/script&gt;Note that this must be done on the report's template even if you put your button into another region as we need the report's REGION_ID value
    Now create a new Button template called, say, "Export Button". The "Template" setting for this should be:
    &lt;a href="javascript:void(0)" class="t12Button" onclick="doExport();"&gt;Export&lt;/a&gt;This was based on a standard "Button" button template. If you use another style of button, adjust it accordingly - you need the same href and onclick attributes as shown above, but anything else can be left unchanged.
    Finally, on the page's HTML Header setting, add in:
    &lt;script type="text/javascript"&gt;
    function doExport()
    var url = 'f?p=&APP_ID.:&APP_PAGE_ID.:&SESSION.:FLOW_EXCEL_OUTPUT_' + regionid + '_en';
    document.location.href=url;
    &lt;/script&gt;You can now change your button to a Template Based Button using the new Export Button.
    Note that, as we are assigning REGION_ID to a javascript variable, only 1 such button can exist on a page.
    Andy

  • Problems in CSV export from RESTful Web services

    When I try to export web service's results, I have the following problems:
    - No column headings exported
    - CSV fields are not enclosed in quotation marks
    - I have comma as separator instead of semicolon that my swiss setting needs to properly import fields
    - Accentuated characters are in two-byte presentation
    I can palliate to first three problems by constructing result string manually in Resource Template select, though if there is a way to set them by putting correct parameters in ApexListener, it would be handy.
    However, I cannot cope with the last one (setting encoding).
    Could someone help me?
    I run Apex Listener 1.1.2.131.15.23 (not 1.1.3, as stated before) on Glassfish 3.1
    Thank you.
    Igor
    Edited by: kortchnoi on Oct 5, 2011 4:27 PM

    Windows 7 64 Ultimate
    Format: French (Switzerland)
    Glassfish 3.1
    Alex Listener 1.1.3.243.11.40
    I have just added -Dfile.encoding=UTF8 to JVM options in default-config and server-config sections of Glassfish, but the encoding problem is still the same.
    NLS:
    NLS_CALENDAR     GREGORIAN
    NLS_CHARACTERSET     WE8MSWIN1252
    NLS_COMP     BINARY
    NLS_CURRENCY     SFr.
    NLS_DATE_FORMAT     RRRR-MM-DD HH24:MI:SS
    NLS_DATE_LANGUAGE     ENGLISH
    NLS_DUAL_CURRENCY     SF
    NLS_ISO_CURRENCY     SWITZERLAND
    NLS_LANGUAGE     ENGLISH
    NLS_LENGTH_SEMANTICS     BYTE
    NLS_NCHAR_CHARACTERSET     AL16UTF16
    NLS_NCHAR_CONV_EXCP     FALSE
    NLS_NUMERIC_CHARACTERS     .'
    NLS_SORT     BINARY
    NLS_TERRITORY     SWITZERLAND
    NLS_TIMESTAMP_FORMAT     DD.MM.RR HH24:MI:SSXFF
    NLS_TIMESTAMP_TZ_FORMAT     DD.MM.RR HH24:MI:SSXFF TZR
    NLS_TIME_FORMAT     HH24:MI:SSXFF
    NLS_TIME_TZ_FORMAT     HH24:MI:SSXFF TZR

  • Error export from my database sql 2005 with Windows 2003 abap+java

    Hi all
    I'm trying to create an Export from my database sql 2005 with Windows 2003, but SAPINST starts with an error. ABAP+JAVA stack
    While running the export preparation, I am getting the following error;
    INFO 2010-09-08 12:12:43
    Output of C:\j2sdk1.4.2_13-x64\bin\java.exe -classpath D:\usr\sap\BID\SYS\global\sltools\sharedlib\launcher.jar -showversion -Xmx256m com.sap.engine.offline.OfflineToolStart com.sap.sl.ut.manager.UtlMain
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/iaik_jce.jar;
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/iaik_jsse.jar;
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/iaik_smime.jar;
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/iaik_ssl.jar;
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/w3c_http.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/sap.comsl.ut.infoprovider_lib.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/sap.comsl.ut.manager.offline.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/antlr.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/exception.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/jddi.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/logging.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/offlineconfiguration.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/opensqlsta.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/tc_sec_secstorefs.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/sap.comtcsdtcvlimpl.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/SDMutil.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/SLUtil.jar;D:\usr\sap\BID\DVEBMGS01\exe\mssjdbc\base.jar;D:\usr\sap\BID\DVEBMGS01\exe\mssjdbc\util.jar;D:\usr\sap\BID\DVEBMGS01\exe\mssjdbc\sqlserver.jar;D:\usr\sap\BID\DVEBMGS01\exe\mssjdbc\spy.jar -export -type=keydb "-expfile=C:/Program Files/sapinst_instdir/NW04S/LM/COPY/MSS/EXP/CENTRAL/AS/PREEXP/usages_data.xml" -log=UTL_load_usages.log -sid=BID -dsn=jdbc/pool/BID -ssprops=D:/usr/sap/BID/SYS/global/security/data/SecStore.properties -ssk=D:/usr/sap/BID/SYS/global/security/data/SecStore.key is written to the logfile C:/Program Files/sapinst_instdir/NW04S/LM/COPY/MSS/EXP/CENTRAL/AS/PREEXP/UTL.java.log.
    WARNING 2010-09-08 12:12:46
    Execution of the command "C:\j2sdk1.4.2_13-x64\bin\java.exe -classpath D:\usr\sap\BID\SYS\global\sltools\sharedlib\launcher.jar -showversion -Xmx256m com.sap.engine.offline.OfflineToolStart com.sap.sl.ut.manager.UtlMain
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/iaik_jce.jar;
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/iaik_jsse.jar;
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/iaik_smime.jar;
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/iaik_ssl.jar;
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/w3c_http.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/sap.comsl.ut.infoprovider_lib.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/sap.comsl.ut.manager.offline.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/antlr.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/exception.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/jddi.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/logging.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/offlineconfiguration.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/opensqlsta.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/tc_sec_secstorefs.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/sap.comtcsdtcvlimpl.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/SDMutil.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/SLUtil.jar;D:\usr\sap\BID\DVEBMGS01\exe\mssjdbc\base.jar;D:\usr\sap\BID\DVEBMGS01\exe\mssjdbc\util.jar;D:\usr\sap\BID\DVEBMGS01\exe\mssjdbc\sqlserver.jar;D:\usr\sap\BID\DVEBMGS01\exe\mssjdbc\spy.jar -export -type=keydb "-expfile=C:/Program Files/sapinst_instdir/NW04S/LM/COPY/MSS/EXP/CENTRAL/AS/PREEXP/usages_data.xml" -log=UTL_load_usages.log -sid=BID -dsn=jdbc/pool/BID -ssprops=D:/usr/sap/BID/SYS/global/security/data/SecStore.properties -ssk=D:/usr/sap/BID/SYS/global/security/data/SecStore.key" finished with return code 64. Output:
    java version "1.4.2_13"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_13-b06)
    Java HotSpot(TM) 64-Bit Server VM (build 1.4.2_13-b06, mixed mode)
    ERROR 2010-09-08 12:12:46
    CJS-30071  Execution of UTL tool 'C:\j2sdk1.4.2_13-x64\bin\java.exe -classpath D:\usr\sap\BID\SYS\global\sltools\sharedlib\launcher.jar -showversion -Xmx256m com.sap.engine.offline.OfflineToolStart com.sap.sl.ut.manager.UtlMain
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/iaik_jce.jar;
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/iaik_jsse.jar;
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/iaik_smime.jar;
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/iaik_ssl.jar;
    JRBIWD/sapmnt/BID/SYS/global/security/lib/tools/w3c_http.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/sap.comsl.ut.infoprovider_lib.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/sap.comsl.ut.manager.offline.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/antlr.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/exception.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/jddi.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/logging.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/offlineconfiguration.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/opensqlsta.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/tc_sec_secstorefs.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/sap.comtcsdtcvlimpl.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/SDMutil.jar;D:/usr/sap/BID/SYS/global/sltools/sharedlib/SLUtil.jar;D:\usr\sap\BID\DVEBMGS01\exe\mssjdbc\base.jar;D:\usr\sap\BID\DVEBMGS01\exe\mssjdbc\util.jar;D:\usr\sap\BID\DVEBMGS01\exe\mssjdbc\sqlserver.jar;D:\usr\sap\BID\DVEBMGS01\exe\mssjdbc\spy.jar -export -type=keydb "-expfile=C:/Program Files/sapinst_instdir/NW04S/LM/COPY/MSS/EXP/CENTRAL/AS/PREEXP/usages_data.xml" -log=UTL_load_usages.log -sid=BID -dsn=jdbc/pool/BID -ssprops=D:/usr/sap/BID/SYS/global/security/data/SecStore.properties -ssk=D:/usr/sap/BID/SYS/global/security/data/SecStore.key' aborts due to database connection error with return code 64.<br>DIAGNOSIS: The connection parameters are wrong or the database server is shutdown.<br> SOLUTION: Check 'UTL_load_usages.log' and 'C:/Program Files/sapinst_instdir/NW04S/LM/COPY/MSS/EXP/CENTRAL/AS/PREEXP/UTL.java.log' for more information.
    ERROR 2010-09-08 12:12:46
    FCO-00011  The step getUsageTypes with step key |NW_Prepare_Export|ind|ind|ind|ind|0|0|NW_Java_Prepare_Export_Dialog|ind|ind|ind|ind|5|0|getUsageTypes was executed with status ERROR .
    Could anyone please help me out on this, if possible?
    Thanks
    JM

    Hi,
    please ensure that you use a SAP supported JDK as below:
    716604    for the Sun JDK (Windows, Linux, Solaris)
    709140    Recommended JDK and VM Settings for the WebAS630/640/7.0
    And the re try the export pls.
    Regards,
    Snow

  • High performance CSV export

    Hi,
    I have been looking for a way to export huge datasets to CSV format for import with MySql.
    As sqlplus SPOOL turned out to be slow and difficult to use, I ended up coding my own importer using the OCCI library.
    I successfully compiled my code under Red Hat Enterprise Linux 6, 64 bit, and Oracle Instant Client 12.1. But as it only uses C++ STL and OCCI, it should as well build under other environments (e.g. Windows).
    Here's the code:
    * ociexport.cpp - High performance ORACLE to CSV export (using OCCI and STL)
    * This program takes the ORACLE connection information from the following
    * environment variables:
    * ORACLE_USER, ORACLE_PASS, ORACLE_CONN
    * Fields are exported in a CSV with delimiter ';'. Semicola within the fields
    * are escaped with '\;'. Newlines and tabs in the fields are replaced by blanks.
    * Empty fields and NULL values are exported as '\N' for easy MySQL import.
    * CLOBS are exported as well. BLOBS and BFILES are not supported atm.
    * Don't forget to set the LD_LIBRARY_PATH to your Oracle Client libs when
    * building and running this program.
    * @param $1 Select-Statement
    * @param $2 Output file (optional - if empty, output goes to stdout)
    * @author Bert Klauninger
    * @version 0.1.0
    * @changelog
    *    2013-12-13 - Created
    *    2013-12-16 - Added CLOB streaming support
    #include <cstdlib>
    #include <cstring>
    #include <fstream>
    #include <iostream>
    #include <string>
    #include <vector>
    #include "occi.h"
    using namespace oracle::occi;
    using namespace std;
    #define BUFFER_SIZE        1024                        // Maximal characters of a LOB to be exported
    * Escape all occurrences of ';' and convert newlines and tabs to blanks
    string csv_escape(string src) {
        string result;
        const int imax = src.length();
        for (int i = 0; i < imax; ++i) {
            switch (src[i]) {
                case '\n':
                case '\r':
                case '\t':
                    result += ' ';
                    break;
                case ';':
                    result += '\\';
                    result += ';';
                    break;
                default:
                    result += src[i];
        return result;
    * Execute a query and write CSV to the given file.
    *    NB: Empty fields are exported as NULL values!
    void select_into(Connection *con, string sql, string file) {
        if (! con) {
            return;
        bool fo = ! file.empty();
        ofstream o;
        if (fo) o.open(file.c_str(), ofstream::out);
        Statement *s = con->createStatement(sql);
        ResultSet *r = s->executeQuery();
        vector<MetaData> m = r->getColumnListMetaData();
        const int cols = m.size();
        if (fo) cout << "Result has " << cols << " cols" << endl;
        int cnt = 0;
        while (r->next()) {
            string line;
            ++cnt;
            /* Stupid ORACLE starts numbering at 1, not 0 */
            for (int i = 1; i <= cols; ++i) {
                string col;
                /* ...but: Metadata vector starts at 0 */
                int t = m[i - 1].getInt(MetaData::ATTR_DATA_TYPE);
                if (t == OCCI_SQLT_CLOB) {
                    /* Get the CLOB object via stream */
                    Clob clob = r->getClob(i);
                    if (! clob.isNull()) {
                        clob.open(OCCI_LOB_READONLY);
                        int len = clob.length();
                        Stream *instream = clob.getStream();
                        char *buffer = new char[BUFFER_SIZE];
                        memset(buffer, 0, BUFFER_SIZE);
                        int r = 0;
                        do {
                            r = instream->readBuffer(buffer, len);
                            for (int i = 0; i < r; ++i) {
                                col += (char) buffer[i];
                        } while (r != -1);
                        delete[] buffer;
                        clob.closeStream(instream);
                        clob.close();
                } else if (! r->isNull(i)) {
                    /* Try to get field value as string */
                    col = r->getString(i);
                if (col.empty()) {
                    line += "\\N";
                } else {
                    line += csv_escape(col);
                if (i < cols) {
                    line += ';';
            if (fo) {
                o << line << endl;
            } else {
                cout << line << endl;
        s->closeResultSet(r);
        con->terminateStatement(s);
        if (fo) cout << cnt << " rows exported" << endl;
    /*** MAIN ***/
    int main (int argc, char* argv[]) {
        if (! (argc == 2 || argc == 3)) {
            cerr << "Usage: " << argv[0] << " sql-statement [output-file.csv]" << endl << endl;
            cerr << "Output file uses column separator ';'. Semicola are escaped using '\\;'." << endl;
            cerr << "NULL values and empty fields are exported as '\\N'." << endl;
            cerr << "If no output file is specified, quieted output is sent to stdout." << endl;
            cerr << "Login credentials can be set via the following environment variabes:" << endl;
            cerr << "ORACLE_USER, ORACLE_PASS, ORACLE_CONN" << endl << endl;
            return 1;
        const string user = getenv("ORACLE_USER");
        const string pass = getenv("ORACLE_PASS");
        const string osid = getenv("ORACLE_CONN");
        const string sql = argv[1];
        const string outfile = (argc == 3) ? argv[2] : "";
        bool fo = ! outfile.empty();
        Environment* env = Environment::createEnvironment(Environment::DEFAULT);
        int ret = 0;
        try {
            if (fo) cout << "Connecting as " << user << "@" << osid << endl;
            Connection* const con = env->createConnection(user, pass, osid);
            if (fo) {
                cout << "Executing query " << sql << endl;
                cout << "Writing results to " << outfile << endl;
            select_into(con, sql, outfile);
            if (fo) cout << "Closing connection" << endl;
            env->terminateConnection(con);
        } catch (SQLException ea) {
            cerr << "Error: " << ea.what();
            ret = 1;
        Environment::terminateEnvironment(env);
        return ret;
    My Makefile:
    ociexport: ociexport.cpp
            LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib \
                    gcc -Wall -g -I /usr/include/oracle/12.1/client64 \
                    -L /usr/lib/oracle/12.1/client64/lib \
                    -o bin/ociexport ociexport.cpp \
                    -lclntsh -lnnz12 -locci
    Program call:
    $ export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
    $ export ORACLE_USER=your_user
    $ export ORACLE_PASS=your_pass
    $ export ORACLE_CONN=your_connection_string
    $ ./ociexport "SELECT * FROM applications" > export.csv
    Best regards
    Bert

    Hi
    Give a look to the following book. You'll find the answer for some questions...
    http://www.theserverside.com/books/masteringEJB/index.jsp
    Chris

  • Delete a .csv file from desktop system

    Hi All,
    My requirement is to read the .csv file from the desktop system having the shared folder and delete the file after read successfully.
    Here I can read the .csv file from the location using the function RFC_REMOTE_FILE and updated the content into internal table.
    But I cant delete the file from the presentation server ( Desktop system).
    Can anyone tell me how to delete the .csv file from the desktop system on different location.
    Note:
    I followed this link to read file:
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2&overridelayout=true

    Hi Rob,
    Thanks. I solved this problem myself.
    The solution to delete the file from remote system is
    concatenate 'DEL' i_filename i_dirname into v_bkfile separated by space .
    call function 'RFC_REMOTE_EXEC'
      destination  c_dest
      exporting
        command               = v_bkfile
      exceptions
        system_failure        = 1  MESSAGE v_ermsg
        communication_failure = 2  MESSAGE v_ermsg.

  • Automatise data export from website

    Hello,
    I stuck with an issue regarding data export from scopus.com. I have 61 keywords for which I want to export (as csv) number of documents by year, country, document type, subject area. Doing that by hand would be extremely tedious. Thus my question if this can be automatised. Unfortunately scopus does not provide an API to access the data directly.
    So, the process to be automatised would be:
    1. Open http://www.scopus.com/home.url
    2. Enter the keyword in "search for"
    3. Click on "search"
    4. Click on "Analyze results"
    5. Click on tab "year" and "export". Save the file
    6. Click on tab "country" and "export". Save the file
    6. Click on tab "document type" and "export". Save the file
    6. Click on "subject area" and "export". Save the file
    Do programs exist that help me retrieving the data?
    Thanks!

    You could achieve your goal with bash and wget with some combination of --save-cookies --post-data.
    But be aware that scopus is run by Elsevier, whom many view as the most evil of the publishing companies. Think twice before doing something that may annoy them.

  • ORA-20876: Stop APEX Engine message in CSV download from Interactive Report

    Hi,
    1 particular Interactive Report in our application produces the following error message in the CSV file, if we attempt to download the report: -
    ORA-20876: Stop APEX Engine
    All other reports work OK, there is another thread here with the same issue, but no resolution was posted: APEX 4.1 ORA-20876: Stop APEX Engine
    Has anyone else come across this issue?
    Apex version is 4.1.0.00.32
    Thanks,
    Mike
    Edited by: Mike, UK on Mar 6, 2012 9:39 PM

    Hi,
    what happens if you take the query from IR report and create a new classic report?
    On this report enable csv export and then try the export.
    Maybe that (format) data are causing export to fail.
    Try to export just one row in your IR report (and classic report), so that you add where rownum < 2.
    Regards,
    Aljaz
    Edited by: Aljaz on 6.3.2012 23:11
    Edited by: Aljaz on 6.3.2012 23:29

  • Using PowerShell to import CSV data from Vendor database to manipulate Active Directory Users

    Hello,
    I have a big project I am trying to automate.  I am working in a K-12 public education IT Dept. and have been tasked with importing data that has been exported from a vendor database via .csv file into Active Directory to manage student accounts. 
    My client wants to use this data to make bulk changes  to student user accounts in AD such as moving accounts from one OU to another, modifying account attributes based on State ID, lunchroom ID, School, Grade, etc. and adding new accounts / disabling
    accounts for students no longer enrolled.
    The .csv that is exported doesn't have headers that match up with what is needed for importing in AD, so those have to be modified in this process, or set as variables to get the correct info into the correct attributes in AD or else this whole project is
    a bust.  He is tired of manually manipulating the .csv data and trying to get it onto AD with few or no errors, hence the reason it has been passed off to me.
    Since this information changes practically daily, I need a way to automate user management by accomplishing the following on a scheduled basis.
    Process must:
    Check to see if Student Number already exists
    If yes, then modify account
    Update {School Name}, {Site Code}, {School Number}, {Grade Level} (Variables)
    Add correct group memberships (School / Grade Specific)
    Move account to correct OU (OU={Grade},OU=Students,OU=Users,OU={SiteCode},DC=Domain,DC=net)
    Remove incorrect group memberships (School / Grade Specific)
    Set account status (enabled / disabled)
    If no, create account
    Import Student #
    Import CNP #
    Import Student name
    Extract First and Middle initial
    If duplicate name exists
    Create log entry for review
    Import School, School Number, Grade Level
    Add to correct Group memberships (School / Grade Specific)
    Set correct OU (OU={Grade},OU=Students,OU=Users,OU={SiteCode},DC=Domain,DC=net)
    Set account Status
    I am not familiar with Powershell, but have researched enough to know that it will be the best option for this project.  I have seen some partial solutions in VB, but I am more of an infrastructure person instead of scripting / software development. 
    I have just started creating a script and already have hit a snag.  Maybe one of you could help.
    #Connect to Active Directory
    Import-Module ActiveDirectory
    # Import iNOW user information
    $Users = import-csv C:\ADUpdate\INOW_export.csv
    #Check to see if the account already exists in AD
    ForEach ( $user in $users )
    #Assign the content to variables
    $Attr_employeeID = $users."Student Number"
    $Attr_givenName = $users."First Name"
    $Attr_middleName = $users."Middle Name"
    $Attr_sn = $users."Last Name"
    $Attr_postaldeliveryOfficeName = $users.School
    $Attr_company = $users."School Number"
    $Attr_department = $users."Grade Level"
    $Attr_cn = $Attr_givenName.Substring(0,1) + $Attr_middleName.Substring(0,1) + $Attr_sn
    IF (Get-ADUser $Attr_cn)
    {Write-Host $Attr_cn already exists in Active Directory

    Thank you for helping me with that before it became an issue later on, however, even when modified to be $Attr_sAMAaccountName i still get errors.
    #Connect to Active Directory
    Import-Module ActiveDirectory
    # Import iNOW user information
    $Users = import-csv D:\ADUpdate\Data\INOW_export.csv
    #Check to see if the account already exists in AD
    ForEach ( $user in $users )
    #Assign the content to variables
    $Attr_employeeID = $users."Student Number"
    $Attr_givenName = $users."First Name"
    $Attr_middleName = $users."Middle Name"
    $Attr_sn = $users."Last Name"
    $Attr_postaldeliveryOfficeName = $users.School
    $Attr_company = $users."School Number"
    $Attr_department = $users."Grade Level"
    $Attr_sAMAccountName = $Attr_givenName.Substring(0,1) + $Attr_middleName.Substring(0,1) + $Attr_sn
    IF (Get-ADUser $Attr_sAMAccountName)
    {Write-Host $Attr_sAMAccountName already exists in Active Directory
    PS C:\Windows\system32> D:\ADUpdate\Scripts\INOW-AD.ps1
    Get-ADUser : Cannot convert 'System.Object[]' to the type 'Microsoft.ActiveDirectory.Management.ADUser'
    required by parameter 'Identity'. Specified method is not supported.
    At D:\ADUpdate\Scripts\INOW-AD.ps1:28 char:28
    + IF (Get-ADUser $Attr_sAMAccountName)
    + ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Get-ADUser], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.ActiveDirectory.Management.Commands.GetAD
    User

Maybe you are looking for