How to run Excel Macros using JDBC-ODBC

Hi,
I want to run the excel macros in the excel file, after I connected to excel file, using JDBC-ODBC bridge.
How macros treated here?
Help needed please..........
- Ramesh

How to run Excel Macros using JDBC-ODBCYou don't.
As my fuzzy understanding goes.....
Macros (excel, word, etc) run via a "OLE" extension of the script host system.
So the only way to run them is via the OLE interface. That has nothing to do with ODBC. You can write your own JNI to do that, or you might get lucky and find that someone else has written a java library to do it for you.

Similar Messages

  • How to run excel macros using lookout

    Hi,
    I want use Excel macros for generating custom reports.Is it possible to run macros using run object in lookout
    thanks

    Hi,
    I am pretty sure you can activate macros in Excel using the Run object in Lookout. I can think of two ways you can do this:
    1. You can setup your Excel to run macros on startup using the Auto_Activate method. In this case, you will just launch excel with your workbook using the Run object and that should run the macros automatically. No brainer!
    2. To better control as to when the macros are run we can assign in Excel some shortcut keys for their launching. We then would need to simulate these keystrokes to launch our macros. This can be done using the SendKeys method and some scripting, WHS Scripting for instance. See this pos
    t for a scripting example which simulates Alt+Tab keys to bring-to-front an app.
    You will launch the script from the Run object and this in turn launches Excel and then simulates the keys for luanching the appropriate macros. I admit this is kinda involved, but hey it works!
    Hope this helps,
    Khalid

  • How to run excel macro from ole

    hi to all experts.
    i need to run excel macro from ole

    Hi,
    *& Report  ZKC_TEST
    *& Description: Fancy report output in XL
    *&Programmer: Krishna Chauhan
    *&Date:       20 Feb 09
    REPORT  ZKC_TEST.
    * INCLUDES                                            *
    INCLUDE ole2incl.
    *&   TYPES                                            *
    TYPES: BEGIN OF ty_marc,
           matnr TYPE marc-matnr,
           werks TYPE marc-werks,
           pstat TYPE marc-pstat,
           lvorm TYPE marc-lvorm,
           ekgrp TYPE marc-ekgrp,
           END OF ty_marc.
    TYPES: BEGIN OF ty_titles,
           title(20) TYPE c,
           field(20) TYPE c,
           END OF ty_titles.
    *&   INTERNAL TABLES                                  *
    DATA: t_marc TYPE STANDARD TABLE OF ty_marc,
          t_titles TYPE STANDARD TABLE OF ty_titles.
    *&   FIELD-SYMBOLS                                    *
    FIELD-SYMBOLS: <fs_marc>   LIKE LINE OF t_marc,
                   <fs_titles> LIKE LINE OF t_titles,
                   <fs> TYPE ANY.
    *&   VARIABLES                                        *
    DATA: w_tabix TYPE sy-tabix,
          w_titles TYPE sy-tabix,
          w_line TYPE sy-tabix,
          w_field TYPE string,
          filename TYPE string,
          path TYPE string,
          fullpath TYPE string.
    DATA: data_titles TYPE REF TO data.
    DATA: e_sheet TYPE ole2_object,
          e_activesheet TYPE ole2_object,
          e_newsheet TYPE ole2_object,
          e_appl TYPE ole2_object,
          e_work TYPE ole2_object,
          e_cell TYPE ole2_object,
          e_color TYPE ole2_object,
          e_bold TYPE ole2_object.
    *&   SELECTION-SCREEN                                 *
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    PARAMETERS: p_file TYPE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK b1.
    *&  START-OF-SELECTION                                *
    START-OF-SELECTION.
      PERFORM get_titles.
      PERFORM get_data.
      PERFORM create_excel.
    *& AT SELECTION-SCREEN                                *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title      = 'Select archivo'
          default_extension = 'xls'
          file_filter       = '*.xls'
        CHANGING
          filename          = filename
          path              = path
          fullpath          = fullpath.
      IF sy-subrc EQ 0.
        p_file = fullpath.
      ENDIF.
    *&      Form  get_titles                              *
    FORM get_titles.
      CREATE DATA data_titles TYPE ty_titles.
      ASSIGN data_titles->* TO <fs_titles>.
      <fs_titles>-title = 'Material'.
      <fs_titles>-field = 'MATNR'.
      APPEND <fs_titles> TO t_titles.
      <fs_titles>-title = 'Plant'.
      <fs_titles>-field = 'WERKS'.
      APPEND <fs_titles> TO t_titles.
      <fs_titles>-title = 'PSTAT'.
      <fs_titles>-field = 'PSTAT'.
      APPEND <fs_titles> TO t_titles.
      <fs_titles>-title = 'Deletion Flag'.
      <fs_titles>-field = 'LVORM'.
      APPEND <fs_titles> TO t_titles.
      <fs_titles>-title = 'EKGRP'.
      <fs_titles>-field = 'EKGRP'.
      APPEND <fs_titles> TO t_titles.
    ENDFORM.                    "get_titles
    *&      Form  get_data                                *
    FORM get_data.
      SELECT matnr werks pstat lvorm ekgrp
      INTO TABLE t_marc
      FROM marc
      WHERE matnr = '000000000001013351'.
    ENDFORM.                    " get_data
    *&      Form  create_excel                            *
    FORM create_excel.
      w_line = 1.
      CREATE OBJECT e_appl 'EXCEL.APPLICATION'.
      SET PROPERTY OF e_appl 'VISIBLE' = 1.
      CALL METHOD OF e_appl 'WORKBOOKS' = e_work.
      CALL METHOD OF e_work 'Add' = e_work.
      GET PROPERTY OF e_appl 'ActiveSheet' = e_activesheet.
      SET PROPERTY OF e_activesheet 'Name' = 'Material Plants'.
      LOOP AT t_marc ASSIGNING <fs_marc>.
        w_tabix = sy-tabix.
        w_line = w_line + 1.
        LOOP AT t_titles ASSIGNING <fs_titles>.
          w_titles = sy-tabix.
          CALL METHOD OF e_appl 'Cells' = e_cell
            EXPORTING
              #1 = 1
              #2 = w_titles.
          SET PROPERTY OF e_cell 'Value' =  <fs_titles>-title.
          GET PROPERTY OF e_cell 'Interior' = e_color.
          SET PROPERTY OF e_color 'ColorIndex' = 35.
          GET PROPERTY OF e_cell 'Font' = e_bold.
          SET PROPERTY OF e_bold 'Bold' = 1.
          CALL METHOD OF e_appl 'Cells' = e_cell
            EXPORTING
              #1 = w_line
              #2 = w_titles.
          CONCATENATE '<fs_marc>-' <fs_titles>-field
          INTO w_field.
          ASSIGN (w_field) TO <fs>.
          SET PROPERTY OF e_cell 'Value' = <fs>.
          GET PROPERTY OF e_cell 'Interior' = e_color.
          SET PROPERTY OF e_cell 'ColumnWidth' = 20.
          SET PROPERTY OF e_color 'ColorIndex' = 0.
          GET PROPERTY OF e_cell 'Font' = e_bold.
          SET PROPERTY OF e_bold 'Bold' = 0.
        ENDLOOP.
      ENDLOOP.
      CALL METHOD OF e_work 'SAVEAS'
        EXPORTING
          #1 = p_file.
      CALL METHOD OF e_work 'close'.
      CALL METHOD OF e_appl 'QUIT'.
      FREE OBJECT e_appl.
    ENDFORM.                    " create_excel

  • Retrieval of Information from Excel Sheet using JDBC-ODBC

    Hello,
    Currently I am writing a program that extracts information fromexcel sheet. This excel sheet have some values in Chinese. I am able to extract English character from the different column in excel, but if some column contain chineese valur then it prints ???. After that I looked on net and found some details in to convert Big5 (Chinese) character into unicode, but this is not working and in that case nothing is displayed. I am attaching the my code. In my code the 'customer' field contain chinese character.
    import java.io.ByteArrayInputStream;
    import java.io.InputStreamReader;
    import java.io.BufferedReader;
    import java.io.Reader;
    import java.io.IOException;
    import java.sql.*;
    public class ExcelJDBC
         Connection con;
         Statement stmt;
         public ExcelJDBC(String url)
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              catch(java.lang.ClassNotFoundException e)
                   System.err.print("ClassNotFoundException: ");
                   System.err.println(e.getMessage());
              try
                   con = DriverManager.getConnection(url, "", "");
                   stmt = con.createStatement();
              catch(SQLException ex)
                   System.out.println("SQL EXCEPTION OCCURED");
                   System.err.println("SQLException: " + ex.getMessage());
                   ex.printStackTrace();
         public void sql(String sql)
              try
                   stmt.execute(sql);
              catch(SQLException ex)
                   System.out.println("SQL EXCEPTION OCCURED");
                   System.err.println("SQLException: " + ex.getMessage());
                   ex.printStackTrace();
         public void closeAll()
              try
                   stmt.close();
                   con.close();
              catch(SQLException ex)
                   System.out.println("SQL EXCEPTION OCCURED");
                   System.err.println("SQLException: " + ex.getMessage());
                   ex.printStackTrace();
         //big5 to unicode conversion
         private String b2u(String str2convert) throws IOException
              System.out.println("The input string is :" + str2convert);
              StringBuffer buffer = new StringBuffer();
              byte[] targetBytes = str2convert.getBytes();
              ByteArrayInputStream stream = new ByteArrayInputStream(targetBytes);
              InputStreamReader isr = new InputStreamReader(stream,"Big5");
              Reader in = new BufferedReader(isr);
              int chInt;
              while((chInt = in.read()) < -1)
                   buffer.append((char)chInt);
              in.close();
              System.out.println("The output string is :" + buffer.toString());
              return buffer.toString();
         public void sqlQuery(String sql)
              try
                   ResultSet rc = stmt.executeQuery(sql);
                   if(rc != null)
                        int count = 0;
                        while (rc.next())
                             String value = "";
                             value = b2u(rc.getString("workorder"));
                             System.out.println("The workorder is : "+value);
                             String customer = rc.getString("Customer");
                             value = b2u(customer);
                             System.out.println("The Customer is : "+value);
                             count++;
                        System.out.println("Entering in loop " count " time.\n");
              catch(SQLException ex)
                   System.out.println("SQL EXCEPTION OCCURED");
                   System.err.println("SQLException: " + ex.getMessage());
                   ex.printStackTrace();
              catch(IOException ex)
                   System.out.println("IO EXCEPTION OCCURED");
                   System.err.println("IOException: " + ex.getMessage());
                   ex.printStackTrace();
    public static void main(String[] args)
         String url = "jdbc:odbc:detailsdsn";     
         try
              ExcelJDBC ej = new ExcelJDBC(url);
              ej.sqlQuery("SELECT \"workorder\", \"Customer\" FROM \"Sheet1$\"");
              ej.closeAll();
         catch(Exception ex)
              System.out.println("SQL EXCEPTION OCCURED");
              System.err.println("SQLException: " + ex.getMessage());
              ex.printStackTrace();
    I will highly appriciate any answer of my problem.
    Regards,
    Ruchi

    Try to find out, what characters really are in your string customer.
    I assume you used System.out.print..(), when you got them as '?'.
    Find out which unicodes they are!
    Afterwards I see two possibilites:
    Either
    1) you see real unicodes for Chinese characters, and it was only the unability of System.out to print them others than as '?', then you can convert these characters however you want. Maybe your further processing can handle them directly as unicode.
    or
    2) you get really '?' in your string. Then Excel (or JDBC or ODBC or ???) hasn't been able to transmit these Chinese characters to your program others than converting them all into '?'. Then you are lost, because you can't know which Chinese character each '?' originally could have been.
    Hope this helps.
    Please tell us, which you experienced, 1) or 2).

  • Can't read special characters in an excel file using JDBC

    Hi! I 've a code to read an excel file using JDBC-ODBC bridge. I can read the values, but any special characters is readed wrong, just symbols. The special characters are of spanish language. This is my code:
                    Locale currentLocale;
              currentLocale = new Locale("es", "MX");
              Locale.setDefault(currentLocale);
                   Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
                   c = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=comisionesperfiles.xls");
                   stmnt = c.createStatement();
                   String query = "Select * from [Hoja1$]" ;
                   ResultSet rs = stmnt.executeQuery( query );
                   while( rs.next() ){
                        String valor = rs.getString(2) ;
                        if(valor != null && !"null".equalsIgnoreCase(valor)){
                             if(!comisiones.contains(valor)){
                                  System.out.println(valor);
                                  comisiones.add( valor );
                   rs.close();
                   stmnt.close();As you can see, I've tried to set the locale, but it didn't work.
    I'm using Excel 2003, Java Version 1.4.2_07 and Windows XP Professional (in latin american spanish).
    Hope someone can help me!

    FYI: Apache's POI can read/write Excel files in Java:
    http://jakarta.apache.org/poi/index.html

  • To run a report from command line, when using jdbc-odbc bridge

    Hi,
    How to run a report from command line, when using jdbc-odbc bridge?
    Usually with tns, we do by "rwrun module=<> userid=<user>/<passwd>@tns".
    with odbc, we do by "rwrun module=<> userid=<user>/<passwd>@odbc:DSN"
    Please specify, what is command line arguments for jdbc-odbc bridge driver?
    Environment : Oracle 9i Report Builder on WinNT
    Database : Sybase
    Regards,
    Ramanan

    Hello Ramanan,
    Report Builder : connect JDBC Query in Report Builder is to through Connection Dialog in JDBC Query Editor. User can use a Sign on parameter (can use, default : P_JDBCPDS or can create new) to connect to JDBC Data Source. Connection once made will be mentioned and will be reused through out Reports Builder.
    JDBC PDS allows user to connect one or more same or different kind of databases.
    While running report through runtime or Server, user can pass the sign on parameter(connection string) value, like any other user parameter.
    Syntax for connection string : <username>/<password>@databaseURL . The syntax of database part of connection string depend on the type of JDBC Driver used to connect to Data Source while designing the JDBC Query. databaseURL refer to the location of the database and its format depend on the JDBCPDS river selected in design time while creating the JDBC Query.
    rwrun eg :
    rwrun report=jdbc_odbc.rdf destype=file desname=output.html desformat=html P_JDBCPDS=scott/tiger@database
    Server eg :
    http://server.com:8888/servlet/RWServlet?server=MyReportServer+report=jdbc_odbc.rdf+destype=cache+desformat=html+P_JDBCPDS=scott/tiger@database
    http :
    Please see ORACLE_HOME/reports/conf/jdbcpds.conf for more information.
    With Regards
    Reports Team

  • How to connect Sql Server 2000 using JDBC ODBC Driver

    How to connect Sql Server 2000 using JDBC ODBC Driver ?
    plz Send Syntax.
    thanks

    In SQL Server 2000 the driver class is com.microsoft.jdbc.sqlserver.SQLServerDriver
    The connection URL for the default SQL Server 2000 database is jdbc:sqlserver://localhost:1433
    Class.forName(
      "com.microsoft.sqlserver.jdbc.
      SQLServerDriver");
    String url =
      "jdbc:sqlserver://localhost:1433";
    Connection conn = DriverManager.
      getConnection(
      url, "sa", "sqlserver");

  • Getting Sql Exception while using JDBC/ODBC to Excel 2007 through Java

    Iam getting the SQLexception by trying to connect using JDBC/ODBC to Excel 2007 through Java. Any Guys can tell abt this problem. java.sql.SQLException: [Microsoft][ODBC Excel Driver] External table is not in the expected format.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at InteractWithExcel.main(InteractWithExcel.java:13)

    From [Google Groups|http://groups.google.co.uk/group/sybase.public.powerbuilder.general/browse_frm/thread/97fbab02a5e6d45b]
    To use Excel as a datasource, you need to defined a named range in the spreadsheet, with the first row containing the column names.

  • How to call excel macros programmatically in C#?

    Hi,
    I have a requirement where i need to call excel (2003) macros in C# program. Can anyone help me with a code snippet to do the same?
    The excel macro function takes two input parameters? how can the parameters be passed?
    Any code snippet to do the same in C# would be helpful.
    Thanks.

    Hey there, Sid.  I am tryin gto run your code, but I couldn't even gte it to fire.  Here's what I ahve now:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using Excel = Microsoft.Office.Interop.Excel;
    namespace WindowsFormsApplication2
        public partial class Form1 : Form
            private void button1_Click(object sender, EventArgs e)
                //~~> Define your Excel Objects
                Excel.Application xlApp = new Excel.Application();
                Excel.Workbook xlWorkBook;
                //~~> Start Excel and open the workbook.
                xlWorkBook = xlApp.Workbooks.Open("C:\\Users\\Ryan\\Desktop\\Coding\\Microsoft Excel\\Work Samples\\Work Samples\\Historical Stock Prices.xlsb");
                //~~> Run the macros by supplying the necessary arguments
                xlApp.Run("ShowMsg", "Hello from C# Client", "Demo to run Excel macros from C#");
                //~~> Clean-up: Close the workbook
                xlWorkBook.Close(false);
                //~~> Quit the Excel Application
                xlApp.Quit();
                //~~> Clean Up
                releaseObject(xlApp);
                releaseObject(xlWorkBook);
            //~~> Release the objects
            private void releaseObject(object obj)
                try
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
                    obj = null;
                catch (Exception ex)
                    obj = null;
                finally
                    GC.Collect();
    When I hit the play button nothing happens.  When I hot F5 nothing happens.  Do you ahve any idea what I'm doing wrong.  I'd appreciate any advice with this!! 
    Thanks!!
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • Problem using Jdbc-Odbc Bridge

    Hi,
    I am using Java 2 SDK and I am trying to access MS Access database on my machine using Jdbc-Odbc bridge. I have set up the DSN in ODBC. But I get the following error when I run my program -
    'No Suitable Driver'
    Here's my code snippet-
    Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
    String dsn = "jdbc:odbc:DriverInfoDB";
    Connection con = DriverManager.getConnection(dsn,"","");
    con.setAutoCommit(false);
    Statement stmt;
    String query = null; // SQL select string
    ResultSet rs; // SQL query results
    stmt = con.createStatement();
    .....etc etc...
    Where is the error in this code??
    Help Needed!!
    Thanks
    Vivek.

    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection(dsn,"guest","guest");
    OR DriverManager.getConnection(dsn);
    System.out.println("Conection's opened");
    catch(ClassNotFoundException cnfe)
    System.err.println(cnfe);
    catch(SQLException sqle)
    System.err.println(sqle);
    try that code and double check you DSN Name . it's a good practice to greate a system DSN.
    i hope that helps.
    FEEL FREE TO ASK. WON'T BITE U
    ABDUL

  • Is it possible to use Jdeveloper with Other Sql Server using JDBC-ODBC bri

    I have been able to successfully establish connection with Sql server Using JDBC-ODBC bridge, but when i run the application and perform some operations such as insert the following errors occur:
    (oracle.jbo.SQLStmtException) JBO-27122: SQL error during statement preparation. Statement: SELECT ItmUnit.ORG_CODE, ItmUnit.UNIT_CODE, ItmUnit.UNIT_NAME, ItmUnit.ADDRESS1, ItmUnit.ADDRESS2, ItmUnit.ADDRESS3, ItmUnit.CITY_CODE, ItmUnit.USER_ID, ItmUnit.TIME_STAMP FROM ITM_UNIT ItmUnit
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) [DataDirect][ODBC Sybase Wire Protocol driver]Sybase does not allow more than one active statement when retrieving results without a cursor
    (oracle.jbo.DMLException) JBO-26041: Failed to post data to database during "Insert": SQL Statement "INSERT INTO IMMS.HRM_UNIT(UNIT_CODE,UNIT_NAME) VALUES (?,?)".
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt
    (oracle.jbo.AttrValException) JBO-27014: Attribute DeptCode in HrmUnitDept is required
    (oracle.jbo.SQLStmtException) JBO-27122: SQL error during statement preparation. Statement: SELECT HrmUnit.UNIT_CODE, HrmUnit.UNIT_NAME FROM IMMS.HRM_UNIT HrmUnit
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt

    Yes, you can do that. For testing purposes you can also create simple files (with mkfile) and add these to ASM. That way you could also experiment with deleting files and see what happens in ASM
    Bjoern

  • JSP connected to MS Access using JDBC-ODBC

    If I want to run a jsp file connected to a MS Access database using jdbc-odbc bridge.
    I thought that I should use the following code to make the connection:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)}; DBQ=http://myComputerName:8080/examples/jsp/DatabaseTest/mydatabase.mdb;DriverID=22;READONLY=fals";
    sqlca = DriverManager.getConnection(database, "dba","sql");
    but Tomcat 4.1 produces many errors.
    The file runs fine when I determine the complete path and include the local drive (C://) of the database Like the following:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};
    DBQ=C:/Tomcat4.1/webapps/examples/jsp/DatabaseTest/mydatabase.mdb;DriverID=22;READONLY=fals";
    sqlca = DriverManager.getConnection(database, "dba","sql");
    Of course I do not want to use the second code because I want to use my computer as a host.
    I will appreciate any answer!

    Yes, using the DSN, it works fine.
    But, I think it will run from the drive C.
    I want to use my computer as a host. So, I think that I should include the name of the computer in the path.
    I do not know may I am confused.
    I appreciate your reply. Thanks!

  • Urgent - How to Run a FM using CATT script tool,

    Hi All,
    How to Run a FM using CATT script tool,
    Thanks in advance,
    KSR

    choose  type as "Function module test" (if you are in release less than 6.4 abap) after entering into t.code SCAT.
    Pl. refer to this documentation for creating function module test cases
    <a href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCATTOL/CACATTOL.pdf">http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCATTOL/CACATTOL.pdf</a>
    reward if it helps
    Krishna

  • How to create db conn for JDBC-ODBC Bridge for MS Access in ADF APP?

    Sir,
    How to create db conn for JDBC-ODBC Bridge for MS Access in ADF APP?
    Regards

    Hello Every Body!
    I succeeded in getting connect to the ms access database in adf application in jdeveloper as below:
    First in control panel to to admin tools and  go to data source(odbc) and create system dsn as bellow pic
    Then go to jdeveloper resources ide conn and then database and new database conn and then select jdbc-odbc briddge and then give custom jdbc url as bellow pic
    Cheers
    tanvir

  • How to run the job using DBMS_SCHEDULER

    How to run the job using DBMS_SCHEDULER
    pleas give some sample Iam very new to DBMS_SCHEDULER

    Hi
    DBMS_SCHEDULER
    In Oracle 10g the DBMS_JOB package is replaced by the DBMS_SCHEDULER package. The DBMS_JOB package is now depricated and in Oracle 10g it's only provided for backward compatibility. From Oracle 10g the DBMS_JOB package should not be used any more, because is could not exist in a future version of Oracle.
    With DBMS_SCHEDULER Oracle procedures and functions can be executed. Also binary and shell-scripts can be scheduled.
    Rights
    If you have DBA rights you can do all the scheduling. For administering job scheduling you need the privileges belonging to the SCHEDULER_ADMIN role. To create and run jobs in your own schedule you need the 'CREATE JOB' privilege.
    With DBMS_JOB you needed to set an initialization parameter to start a job coordinator background process. With Oracle 10g DBMS_SCHEDULER this is not needed any more.
    If you want to user resource plans and/or consumer groups you need to set a system parameter:
    ALTER SYSTEM SET RESOURCE_LIMIT = TRUE;
    Baisc Parts: Job
    A job instructs the scheduler to run a specific program at a specific time on a specific date.
    Programs
    A program contains the code (or reference to the code ) that needs to be run to accomplish a task. It also contains parameters that should be passed to the program at runtime. And it?s an independent object that can referenced by many jobs
    Schedules
    A schedule contains a start date, an optional end date, and repeat interval with these elements; an execution schedule can be calculated.
    Windows
    A window identifies a recurring block of time during which a specific resource plan should be enabled to govern resource allocation for the database.
    Job groups
    A job group is a logical method of classifying jobs with similar characteristics.
    Window groups
    A window groups is a logical method of grouping windows. They simplify the management of windows by allowing the members of the group to be manipulated as one object. Unlike job groups, window groups don?t set default characteristics for windows that belong to the group.
    Using Job Scheduler
    SQL> drop table emp;
    SQL> Create table emp (eno int, esal int);
    SQL > begin
    dbms_scheduler.create_job (
    job_name => 'test_abc',
    job_type => 'PLSQL_BLOCK',
    job_action => 'update emp set esal=esal*10 ;',
    start_date => SYSDATE,
    repeat_interval => 'FREQ=DAILY; INTERVAL=10',
    comments => 'Iam tesing scheduler');
    end;
    PL/SQL procedure successfully completed.
    Verification
    To verify that job was created, the DBA | ALL | USER_SCHEDULER_JOBS view can be queried.
    SQL> select job_name,enabled,run_count from user_scheduler_jobs;
    JOB_NAME ENABL RUN_COUNT
    TEST_abc FALSE 0
    Note :
    As you can see from the results, the job was indeed created, but is not enabled because the ENABLE attribute was not explicitly set in the CREATE_JOB procedure.
    Run your job
    SQL> begin
    2 dbms_scheduler.run_job('TEST_abc',TRUE);
    3* end;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> select job_name,enabled,run_count from user_scheduler_jobs;
    JOB_NAME ENABL RUN_COUNT
    TEST_ABC FALSE 0
    Copying Jobs
    SQL> begin
    2 dbms_scheduler.copy_job('TEST_ABC','NEW_TEST_ABC');
    3 END;
    4 /
    PL/SQL procedure successfully completed. Hope it will help you upto some level..!!
    Regards
    K

Maybe you are looking for

  • Multiple sources to a single table

    Hi, I have two seperate target tables from two seperate mappings. I need to determine the row count from the two tables and feed it in a seperate mapping to a single target table as two seperate attributes. My several attempts have resulted in the er

  • How do you reset a forgotten/lost password on a Mac mini computer without having an Apple ID or the disk?

    Unable to login to the administrator username and password on the computer

  • ITEM IS NOT RELEVANT FOR BILLING WHILE DOING STO (VF01)

    HI I am getting an error while doing STO in CIN Item is not relevant for billing while doing VF01 STO proforma invoice JEX with delivery document type NL and item category NLN I searched the forum but not able to get an appropriate solution for this.

  • Help with solaris 10 iscsi

    Hi all, i'm a solaris newbie and new user so, let's go. I have difficult in configuring/installing iscsi target on solaris 10 My uname -a is SUNOS 5.10 generic_118822-02 sun4u sparc if i launch pkginfo | grep iscsi it returns : system SUNWiscsir sun

  • Solution Manager 3.1 upgrade to 3.2

    Hi, I have to upgrade Solution Manager to 3.2 SP Stack 15 or  7.0 SP Stack 09. Now I have Solution Manager 3.1, in detail: SAPKB62052 and SAPKU31010 How can I do it? My problem is: I have to upragde Solution Manager because I have on my notebook Micr