Give Me Some Example Codes!!

I need some example codes that has a dataSource and the separate java file written in JDBC

The following code will establish a database connection, if you have a datasource called "Labor" defined
--> go to Control Panel
--> go to Administrative Tools
--> ODBC Data sources
--> User DSN (Add a data source called Labor of type Ms-Access) You will need to have a database already created. Give the path to this database.
Connection con = null;
Statement st = null;
String url = "jdbc:odbc:Labor"; //define the URL
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (Exception e) {} //Locate the Driver
try {
con = DriverManager.getConnection(url, "", "");
} catch (Exception e) {} //Open A Database Connection
try { st = con.createStatement(); } catch (Exception e) { }
You can then execute SQL queries using the Statement object. It will return result sets, but you need to research this some more as there is too much to explain.
Adwait

Similar Messages

  • What is IMPORT/EXORT statements ?please give some example code?

    What is IMPORT/EXORT statements ?please give some example code?

    EXPORT :-To read data objects from an ABAP program into ABAP memory, use the following statement:
    Syntax
    EXPORT <f1> [FROM <g 1>] <f 2> [FROM <g 2>] ... TO MEMORY ID <key>.
    This statement stores the data objects specified in the list as a cluster in memory. If you do not use the option FROM <f i >, the data object <f i > is saved under its own name. If you use the FROM <g i > option, the data objet <g i > is saved under the name <f i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
    The EXPORT statement always completely overwrites the contents of any existing data cluster with the same name <key>.
    IMPORT :-To read data objects from ABAP memory into an ABAP program, use the following statement:
    Syntax
    IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] ... FROM MEMORY ID <key>.
    This statement reads the data objects specified in the list from a cluster in memory. If you do not use the TO <g i > option, the data object <f i > in memory is assigned to the data object in the program with the same name. If you do use the option, the data object <f i > is read from memory into the field <g i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
    You do not have to read all of the objects stored under a particular name <key>. You can restrict the number of objects by specifying their names. If the memory does not contain any objects under the name <key>, SY-SUBRC is set to 4. If, on the other hand, there is a data cluster in memory with the name <key>, SY-SUBRC is always 0, regardless of whether it contained the data object <f i >. If the cluster does not contain the data object <f i >, the target field remains unchanged.
    they are used to save and reterive data in ABAP memory.
    here is an example to clear about them.
    <b>REPORT ZWA_TEST2 .
    data: it_bkpf type table of bkpf with header line.
    SELECT * FROM bkpf into table it_bkpf.
    EXPORT it_bkpf TO MEMORY ID 'MID'.
    refresh it_bkpf.
    IMPORT it_bkpf FROM MEMORY ID 'MID'.
    LOOP AT It_bkpf.
    write:/ it_bkpf-belnr.
    ENDLOOP.</b>
    Reward points if it is useful.......

  • Please give me some examples of video chat with adobe flash builder 4 or adobe flex 3.5

    I'm a newbie for flex. I had a project from my college to made a video chat application using Adobe Flash Builder 4 and used Red5.  please help me, give me some examples of video chat source code, so that i may to learn it. thanks a lot friends.

    As you are starting at the beginning you may as well start with FB4. When you install FB4 you will find that its start page has links to documentation tutorials and examples through the tour-de-flex. There are some great blogs that continue to offer advice and examples, nothing beats well written examples for learning. If you are on face book there is an Adobe Flex page that is continually giving links to examples and information about e-seminars.
    And of course there is here. So jump on board and have a bit of fun.
    David

  • Give me some examples for functions for read POST, write POST, modify POST

    Give me some examples for functions for read POST, write POST, modify POST, create and delete theme in forum. This functions have to be make like Remote Methods

    Give me some examples for functions for read POST, write POST, modify POST, create and delete theme in forum. This functions have to be make like Remote Methods

  • Regarding how to use index , please give me some example if possible

    Hello everybody:
           Thank you all for your help in  advance .
           would you please tell me how to use index, please give me  some example if possible.  couldn't thank you more!
          best regards .
         Frank

    Index is used for faster access of data base tables.
    An index helps to speed up selection from the database. An index is a sorted copy of selected database table fields.
    The primary index is always automatically created in an ABAP-based SAP system. It consists of the primary key fields of the database table. This means, for each combination of the index fields exists a maximum of one record in the table. This kind of index is called a UNIQUE index.
    If the primary index cannot be used to determine selection result, (for example, the WHERE condition does not contain any primary index fields), the system searches the whole table. To prevent this, and determine the selection result by searching through a restricted number of database records, you can create a secondary index.
    However, you should not define an index for all possible fields in the WHERE condition.
    Check this thread..u have more details.
    In which situation we can use the reading of  index

  • Can you give me the example codes for DaqCard-12​00 at register-l​evel programmin​g

    Where could I find some example code in DaqCard-1200 Register_level programming Manual

    This forum is for discussion of Measurement Studio for Visual C++. You can post questions about DAQ to the Multifunction I/O secition here.
    Best Regards,
    Chris Matthews
    National Instruments

  • What is the Extract statement? Please give me some sample code.?

    What is the Extract statement? Please give me some sample code.?

    Hello ,
    Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements: EXTRACT . When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset EXTRACT HEADER. When you extract the data, the record is filled with the current values of the corresponding fields. As soon as the system has processed the first EXTRACT statement for a field group , the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs. By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.
    Sample program:
    REPORT  ZSPFLI  LINE-SIZE 132 LINE-COUNT 65(3)
                                                 NO STANDARD PAGE HEADING.
    TABLES:SPFLI,SCARR, SFLIGHT, SBOOK.
    SELECT-OPTIONS: MYCARRID FOR SPFLI-CARRID.
    FIELD-GROUPS: HEADER, SPFLI_FG, SFLIGHT_FG, SBOOK_FG.
    INSERT:
            SPFLI-CARRID
            SPFLI-CONNID
            SFLIGHT-FLDATE
            SBOOK-BOOKID
           INTO HEADER,
            SPFLI-CARRID
            SPFLI-CONNID
            SPFLI-CITYFROM
            SPFLI-AIRPFROM
            SPFLI-CITYTO
            SPFLI-AIRPTO
            SPFLI-DEPTIME
            SCARR-CARRNAME
          INTO SPFLI_FG,
            SFLIGHT-FLDATE
            SFLIGHT-SEATSMAX
            SFLIGHT-SEATSOCC
            SFLIGHT-PRICE
          INTO SFLIGHT_FG,
            SBOOK-BOOKID
            SBOOK-CUSTOMID
            SBOOK-CUSTTYPE
            SBOOK-SMOKER
           INTO SBOOK_FG.
    SELECT * FROM SPFLI WHERE CARRID IN MYCARRID.
      SELECT SINGLE * FROM SCARR WHERE CARRID = SPFLI-CARRID.
      EXTRACT SPFLI_FG.
      SELECT * FROM SFLIGHT
       WHERE CARRID = SPFLI-CARRID AND  CONNID = SPFLI-CONNID.
        EXTRACT SFLIGHT_FG.
        SELECT * FROM SBOOK
               WHERE CARRID = SFLIGHT-CARRID AND
               CONNID = SFLIGHT-CONNID AND FLDATE = SFLIGHT-FLDATE.
          EXTRACT SBOOK_FG.
          CLEAR SBOOK.
        ENDSELECT.
        CLEAR SFLIGHT.
      ENDSELECT.
      CLEAR SPFLI.
    ENDSELECT.
    SORT.
    LOOP.
      AT SPFLI_FG.
        FORMAT COLOR COL_HEADING.
        WRITE: / SCARR-CARRNAME,
                 SPFLI-CONNID, SPFLI-CITYFROM,
                 SPFLI-AIRPFROM, SPFLI-CITYTO, SPFLI-AIRPTO, SPFLI-DEPTIME.
        FORMAT COLOR OFF.
      ENDAT.
      AT SFLIGHT_FG.
        WRITE: /15 SFLIGHT-FLDATE, SFLIGHT-PRICE, SFLIGHT-SEATSMAX,
                   SFLIGHT-SEATSOCC.
      ENDAT.
      AT SBOOK_FG.
        WRITE: /30 SBOOK-BOOKID, SBOOK-CUSTOMID,
                     SBOOK-CUSTTYPE, SBOOK-SMOKER.
      ENDAT.
    ENDLOOP.

  • Please ..give me some example APDU for writing data to java card

    morning everybody .. :)
    I need some example APDUs for writing data to java card. (CLA || INS || P1 || P2 etc)..
    please..thank for your attention .. god blessing u.

    Hi,
    did you check some articles about JavaCards:
    [Understanding Java Card 2.0|http://www.javaworld.com/cgi-bin/mailto/x_java.cgi?pagetosend=/export/home/httpd/javaworld/javaworld/jw-03-1998/jw-03-javadev.html&pagename=/javaworld/jw-03-1998/jw-03-javadev.html&pageurl=http://www.javaworld.com/javaworld/jw-03-1998/jw-03-javadev.html&site=jw_core]
    [How to write a Java Card applet: A developer's guide|http://www.javaworld.com/cgi-bin/mailto/x_java.cgi?pagetosend=/export/home/httpd/javaworld/javaworld/jw-07-1999/jw-07-javacard.html&pagename=/javaworld/jw-07-1999/jw-07-javacard.html&pageurl=http://www.javaworld.com/javaworld/jw-07-1999/jw-07-javacard.html&site=jw_core]
    Hope it helps,
    Tex

  • Difference between L1,L2 and L3 support,pls give me some examples

    Hi,
    can u please tell me the difference between L1,L2 AND L3 SUPPORT.pls give me some examples

    knowledgespring wrote:
    People keep ask which level support are you supporting..? how do we answer to these questions in interview.. could one please provide info on this.
    thank you in advance.Since the terms themselves can be defined differently by different organizations, you'll have to ask the interviewer how HE defines those terms. Once you know that you should know the answer. In asking him how he defines them, you might explain that you are asking because you know the terms can mean different things to different organizations.

  • Give me some examples of syntax of object oriented concept in abap

    pls let me know

    Go to ABAPDOCU transaction.
    On the left hand side, you should open the node ABAP Objects .
    YOu can find lots of examples.
    for concepts go thru this link:
    http://help.sap.com/saphelp_46c/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htm

  • Hi what the use f4_filename  plz send some example code.?

    hi iam shabeer iam abap fresher i want to select a file which i have saved in c drive of harddisk through sap report iam confuse what values would give import and export will u plz help me.

    hi check this...
    TABLES : MARA.
    INTERNAL TABLE DECLARATION
    TYPES : BEGIN OF ITAB,
    MATNR TYPE MARA-MATNR,
    MEINS TYPE MARA-MEINS,
    ERNAM LIKE MARA-ERNAM,
    AENAM LIKE MARA-AENAM,
    MTART LIKE MARA-MTART,
    END OF ITAB.
    DATA : IG_ITAB type ITAB OCCURS 0.
    DATA : V_FILE TYPE STRING.
    DATA : T_FILE TYPE RLGRAP-FILENAME.
    RETRIVE DATA FROM DATABASE
    SELECT
    MATNR
    MEINS ERNAM AENAM MTART FROM MARA
    INTO CORRESPONDING FIELDS OF TABLE
    IG_ITAB
    up to 10 rows.
    CALLING FUNCTION MODULES
    CALL FUNCTION 'F4_FILENAME' "PASS THE FILE NAME AS U NEED.
    EXPORTING
    FIELD_NAME = 'T_FILE'
    IMPORTING
    FILE_NAME = T_FILE.
    V_FILE = T_FILE. "STRING CONVERSION
    CALLING GUI DOWNLOAD TO EXTRACT
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filename = V_FILE
    FILETYPE = 'ASC'
    WRITE_FIELD_SEPARATOR = 'X'
    WRITE_LF = 'X'
    tables
    data_tab = IG_ITAB .
    regards,
    venkat appikonda

  • Hi..I really don't understand how can labview can be a server, can you explain and give me some examples with steps on how to make the labview as a server? Please......

    nn
    Solved!
    Go to Solution.

    erm ok i will explain...
    actually..i know that labview can be a client or server. when the labview be a client, it can access other enable activeX application such as excel or word. i manage to do that a little such as to open excel file and save it at another location by using activeX functions or using the report generation toolkit. yes, i already know and understand the flow or concept of how the labview can be a client. But by using others activeX application especially excel, how can we make the labview be a server? i just need a very easy example and few steps for me to understand how can labview be a server or how excel can control the labview properties?
    really desperate to increase new knowledge.....:-)
    thank you very much for helping me....

  • Example code for Trigering a workflow using WAPI from JAVA based tool

    Hi Experts,
    I am the newest guy in SAP workFlow and BAPI world. I need to trigger a workflow defined in WebFlow engine from a Java client. I know i can use JCo and to use WAPI to get workflow information but i am not sure how it works. Can you give me some example code to trigger one workflow defined in WebFlow using WAPI? If there is any alternative i am interested to know that as well.
    Thanks in advance.
    Regards,
    Riyadh

    Use Function Module SWE_EVENT_CReate top trigger event that is linked with a Workflow.
    <b>Please reward points if useful</b>
    INCLUDE <cntn01> .
      DATA:i_emp_details TYPE STANDARD TABLE OF p0001,  "Employee Details
           wa_request    TYPE p0001,                    "Workarea for Employee details
           v_country_grp TYPE molga,                    "Country SubGrouping
           v_object_key  TYPE sweinstcou-objkey.        "Key for the buisness object ZWOBUSTRIP
      CONSTANTS: c_bo_trip     TYPE swo_objtyp VALUE 'ZWOBUSTRIP',
                 c_event_trip  TYPE swo_event  VALUE 'TripCreate',
                 c_infy_type_1 TYPE infty      VALUE '0001'.
    Event Container declaration
      swc_container i_event_cont.
      swc_create_container i_event_cont.
    Reading the INFO TYPE 0001 to obtain the
    Employee details
      CALL FUNCTION 'HR_READ_INFOTYPE'
        EXPORTING
          pernr           = i_emp_number
          infty           = c_infy_type_1
          begda           = sy-datum
          endda           = sy-datum
        TABLES
          infty_tab       = i_emp_details
        EXCEPTIONS
          infty_not_found = 1
          OTHERS          = 2.
    SY-SUBRC check is not required as the error
    handelling will be done by WorkFlow rule
    resolution.
      CLEAR wa_request.
      READ TABLE i_emp_details INTO wa_request INDEX 1.
      IF sy-subrc = 0.
      Retrieving the Country SubGrouping for the employee
        SELECT SINGLE molga
          FROM t001p
          INTO v_country_grp
         WHERE werks = wa_request-werks
           AND btrtl = wa_request-persk.
      ENDIF.
    Sending the relevant data to event container
      swc_set_element i_event_cont 'EmpId'     i_emp_number.
      IF sy-subrc <> 0.
    No Processing needed.
      ENDIF.
      swc_set_element i_event_cont 'PersonnelArea'    wa_request-werks.
      IF sy-subrc <> 0.
    No Processing needed.
      ENDIF.
      swc_set_element i_event_cont 'CountryGrouping' v_country_grp.
      IF sy-subrc <> 0.
    No Processing needed.
      ENDIF.
      swc_set_element i_event_cont 'EmpSubGrp'       wa_request-persk.
      IF sy-subrc <> 0.
    No Processing needed.
      ENDIF.
      swc_set_element i_event_cont 'EmpTripId'       i_emp_trip.
      IF sy-subrc <> 0.
    No Processing needed.
      ENDIF.
    Raising the event to trigger the workflow
      v_object_key = i_emp_number.
      CALL FUNCTION 'SWE_EVENT_CREATE'
        EXPORTING
          objtype           = c_bo_trip
          objkey            = v_object_key
          event             = c_event_trip
        TABLES
          event_container   = i_event_cont
        EXCEPTIONS
          objtype_not_found = 1
          OTHERS            = 2.
      IF sy-subrc <> 0.
    No Processing needed.
      ENDIF.
      COMMIT WORK.
    ENDFUNCTION.
    Thanks
    Arghadip

  • Question on the example code 8253eventcount.c

    Hi.
    I saw the example code 8253eventcount.c before in the NI-DAQ6.9.x. That is very useful.But i still confuse that "Do i need to set up each clock pulse duration?". From the program, it seems that the counting process solely depends on the function NIDAQDelay(sec).....
    By the way, if i am now using an old version of NI-DAQ6.8.5, How can i update some calculated voltages for each 1ms. Although i have read and followed the procedures in the user mannual of lab-pc+,but, i am still not sure how to program the counterA2 with appropriate update interval. Could anyone give me an example code? It seems that no examples are given in the version of NI-DAQ6.8.5.
    I am now using lab-pc+ with Ni-daq6.8.5 by using c++ and win
    dows95 as my working platform.Please help me in anyway! Thanks!
    Attachments:
    Lab_PC+_AO.cpp ‏2 KB

    The NIDAQDelay() is only in there to control how often the program checks the current count on the counter. If it is set to 1 seconds, it will read the counter every one second and return how many counts have been read since the start. If you take that function out, the program will check the counter as fast as it can which will tie up your CPU.
    As to your question about calculated voltages, can you be more specific as to what your application is and what you are trying to do, I'm a little confused.
    Brian

  • Asking for example code (RFComm Bluetooth Application)

    hello there, i almost give up on finding a way to connect a client application using widcomm sdk on pc to server application using jsr82 j2me on mobile ph0ne ...
    anybody can give me an example code for connecting both of them ...
    if u can, or have some advice for me please give me that valueable thing...
    my recent not working application :
    - server deployed on mobile phone using jsr82 j2me
    - client on pc using widcomm sdk visual c++ .net
    or may be u can correct and give me advice for my code bellow...
    Server (JSR82) :
    private static final UUID APP_UUID = new UUID("F0E0D0C0B0A000908070605040302010", false);
    private static final String URL = "btspp://localhost:"+APP_UUID+";name=My App;authorize=false";
    private static final String APP_ID = "My App";
    private static final int ATTR_ID = 0x1234;
    try {
    localDevice = LocalDevice.getLocalDevice();
    localDevice.setDiscoverable(DiscoveryAgent.GIAC);
    notifier = (StreamConnectionNotifier)Connector.open(URL);
    DataElement base = new DataElement(DataElement.STRING, APP_ID);
    record = localDevice.getRecord(notifier);
    record.setAttributeValue(ATTR_ID, base);
    connection = notifier.acceptAndOpen();
    catch(Exception e) {
    System.err.println(e.getMessage());
    Client (Widcomm SDK) :
    StartDiscovery(m_BdAddr, m_pServiceGuid)CSdpDiscoveryRec Sdp_Record;
    if ( ReadDiscoveryRecords(m_BdAddr, 1, &Sdp_Record, m_pServiceGuid) )
    UINT8 scn;
    SDP_DISC_ATTTR_VAL *pVal;
    if ( Sdp_Record.FindRFCommScn(&scn) )
    //if(Sdp_Record.FindAttribute(0x1234, pVal))
    I can't find an RFComm channel number from server (the j2me one)
    regards, Arch_Cancer
    // sorry my bad english
    Edited by: Arch_Cancer on Jun 20, 2008 12:03 AM

    Still looking for solutions. Looks like many Z-W88 users are having trouble with iPhone only. Assistant does not ask for pairing code, just ask confirmation of a six digit number or Bluetooth device.
    Also this problem is more common on recent iOS versions.
    There is not info about how to force iPhone to ask for pairing code, and support at stores have no idea how to make it work either, so I'm kind of stuck with this.
    If anyone have any ideas I'm open to them...
    Thanks :)

Maybe you are looking for