Bizarre problem JDBC/SDO_UNION on insert

Hi,
I've got a case where I am trying to do an SDO_UNION on two shapes and use the result as part of an INSERT statement. Note that I am doing this through JDBC calls out of Java.
Unfortunately, I am encountering a bizarre problem... when I call the SDO_UNION operator through JDBC, the result is null... BUT if I paste the same code into SQLPlus, the operation works fine!!!
I've got examples of the statement I am using below.
Does anyone have a suggestion? If you could email me at [email protected], I'd be most greatful and I'd post back here.
Thanks!!!
INSERT INTO TEMP_MARKET_FOLDER
(TEMP_MARKET_FOLDER_ID,
UNIQUE_CODE,
SHAPE)
VALUES
(TEMP_MARKET_FOLDER_SQ.NextVal,
't7346E28179786E7', (SELECT SDO_GEOM.SDO_UNION(sel_0.GEOLOC, m.diminfo, sel_1.SHAPE, m.diminfo)
FROM VECTIV.US_CNTY sel_0, TEMP_MARKET_FOLDER sel_1, user_sdo_geom_metadata m
WHERE UPPER(m.table_name) = UPPER('US_CNTY') AND m.column_name = 'GEOLOC'
AND sel_0.MI_PRINX = 221.0 AND sel_1.UNIQUE_CODE = 't669626728A516568'))

Hi Indrek,
I did the following, which worked. You may want to revisit and see if you can determine where the problem is coming from. Note that I ran validate_geometry below - you may want to run it for your whole table.
Hope this helps,
dan
create table technet(gid number, mygeom mdsys.sdo_geometry);
insert into technet values (1,
mdsys.SDO_GEOMETRY(3, NULL, NULL,
mdsys.SDO_ELEM_INFO_ARRAY(1, 3, 1),
mdsys.SDO_ORDINATE_ARRAY(541200, 6591250, 541200, 6591350,
541400, 6591350, 541400, 6591250, 541200, 6591250)));
insert into technet values (2,
mdsys.SDO_GEOMETRY(3, NULL, NULL,
mdsys.SDO_ELEM_INFO_ARRAY(1, 3, 1),
mdsys.SDO_ORDINATE_ARRAY(541150, 6591150, 541150, 6591250,
541350, 6591250, 541350, 6591150, 541150, 6591150)));
insert into technet values (3,
mdsys.SDO_GEOMETRY(3, NULL, NULL,
mdsys.SDO_ELEM_INFO_ARRAY(1, 3, 1),
mdsys.SDO_ORDINATE_ARRAY(541600, 6590750, 541600, 6590850,
541750, 6590850, 541750, 6590750, 541600, 6590750)));
insert into technet values (4,
mdsys.SDO_GEOMETRY(3, NULL, NULL,
mdsys.SDO_ELEM_INFO_ARRAY(1, 3, 1),
mdsys.SDO_ORDINATE_ARRAY(541650, 6590000, 541450, 6590150, 541450,
6590250, 541300, 6590350, 541450, 6590500, 541750, 6590650,
542050, 6590650, 542100, 6590550, 542100, 6590300, 542000,
6590100, 541750, 6590000, 541650, 6590000)));
select mdsys.sdo_geom.validate_geometry(mygeom,
MDSYS.SDO_DIM_ARRAY(
MDSYS.SDO_DIM_ELEMENT('X',0,7000000,0.000005),
MDSYS.SDO_DIM_ELEMENT('Y',0,70000000,0.000005))) status,gid
from technet;
declare
temp_geom1 mdsys.sdo_geometry;
mygeom mdsys.sdo_geometry;
cursor area_cur is select mygeom from technet;
dim_info mdsys.sdo_dim_array := mdsys.sdo_dim_array(
MDSYS.SDO_DIM_ELEMENT('X',0,7000000,0.000005),
MDSYS.SDO_DIM_ELEMENT('Y',0,70000000,0.000005));
begin
temp_geom1 := null;
for area_rec in area_cur loop
temp_geom1 := mdsys.sdo_geom.sdo_union(temp_geom1, dim_info, area_rec.mygeom, dim_info);
end loop;
end;
null

Similar Messages

  • Bizarre problem

    my ibookg4 suddenly is having quite a bizarre problem today. no problems till yesterday night.
    1. i was running firefox and safari today along with ms-word and preview. the word file open was huge (~20mb, had lots of figures/pictures in it). and at some point during doing this, i wanted to save the word document that was open. and thats when for the first time, the 'spinning wheel' came on... subsequently, the computer become amazingly slow, like it would take 5 minutes to save the word document, displaying the " spinning wheel " all the while.
    2. closing the word document and quitting word took like 8 minutes. i force quit all the program then.
    3. finally, i rebooted the machine a couple of times and also did a filefault scan. i tried to go into the disk utility and tried to check for repair disks... but no avail.. the wheel kept spinning...
    5. finally i tried resetting the pram and now the mac does not want to start up. it shows a broken folder link however i want to start up
    any ideas what is the problem?
    ibook g4   Mac OS X (10.3.9)  

    a complete description for the record./
    my ibookg4 (running 10.3.9) suddenly is having quite a bizarre problem today. no problems till yesterday night.
    1. i was running firefox and safari today along with ms-word and preview. the word file open was huge (~20mb, had lots of figures/pictures in it). and at some point during doing this, i wanted to save the word document that was open. and thats when for the first time, the 'spinning wheel' came on... subsequently, the computer become amazingly slow, like it would take 5 minutes to save the word document, displaying the " spinning wheel " all the while.
    2. closing the word document and quitting word took like 8 minutes. i force quit all the program then.
    3. i rebooted the machine a couple of times and also did a filevault scan. i tried to go into the disk utility and tried to check for repair disks... but no avail.. the wheel kept spinning...
    4. i tried resetting pram (
    http://docs.info.apple.com/article.html?artnum=2238
    http://docs.info.apple.com/article.html?artnum=14449)
    when the machine started up, a question mark blinked on the screen alternating with a folder symbol.
    5. the i tried inserting a diagnostic disc:
    http://docs.info.apple.com/article.html?artnum=58042
    it took something to the tune of 4 hours for the disk utility to try and recognise the hard disk. however in the end it gave an error: " error on mass storage" : cache and modem was fine. the 'repair file' did not start up and the harddrive did not show up on booting, only the cd did.
    6. upon trying to reinstall the OS, the "target" to install the OS was not found.
    any ideas what is the problem? what do you guys suggest, how should I go about fixing it.

  • JDBC를 이용해서 BLOB COLUMN 에 파일 INSERT하는 SAMPLE

    제품 : JAVA
    작성날짜 : 2003-01-15
    JDBC를 이용해서 BLOB COLUMN 에 파일 INSERT하는 SAMPLE
    ====================================================
    Purpose
    JDBC를 이용해서 BLOB COLUMN 에 파일 INSERT하는 방법을
    알아 봅니다.
    Explanation
    - 다음 sample은 Oracle DB v8.1.7에서 JDBC(V8.1.7)을
    이용해서 TEST한 것입니다.
    Example
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    //needed for new CLOB and BLOB classes
    import oracle.sql.*;
    public class Insert_File_BLOB
    public static void main (String args [])
    throws Exception
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn =
    DriverManager.getConnection ("jdbc:oracle:oci8:@krint-7", "scott", "tiger");
    conn.setAutoCommit (false);
    Statement stmt = conn.createStatement ();
    // Drop the basic_lob_table
    try
    stmt.execute ("drop table basic_lob_table");
    catch (SQLException e)
    // An exception could be raised here if the table did not exist already
    // but we gleefully ignore it
    // Create a table containing a BLOB and a CLOB
    stmt.execute ("create table basic_lob_table (x varchar2 (30), b blob, c clob)");
    // Populate the table
    stmt.execute ("insert into basic_lob_table values ('one',empty_blob(), 'clob column data !!!')");
    // Select the lobs
    OracleResultSet rset = (OracleResultSet)stmt.executeQuery("select b from basic_lob_table where x='one' for update");
    while (rset.next ())
    // Get the lobs
    BLOB blob = ((OracleResultSet)rset).getBLOB (1);
              try
    File file = new File("c:\\temp\\bokim.txt");
    long fileLength = (long) file.length();
    System.out.println("File Size : " + fileLength + " bytes");
    FileInputStream instream = new FileInputStream(file);
    OutputStream outstream = blob.getBinaryOutputStream();
    int size = blob.getBufferSize();
    System.out.println("BufferSize: " + size + " bytes (#)\n");
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    System.out.print("#");
    System.out.println();
    instream.close();
    outstream.close();
    System.out.println("\nUpdate Done.");
    catch (java.io.FileNotFoundException fe) {
    System.err.println ("thrown: java.io.FileNotFoundException\n");
    fe.printStackTrace ();
    System.err.println (fe.getMessage ());
    stmt.close();
    conn.commit();
    conn.close();
    결과
    SQL> select dbms_lob.getlength(b) from basic_lob_table;
    no rows selected
    SQL> /
    DBMS_LOB.GETLENGTH(B)
    4328
    Reference Documment
    ---------------------

  • Bizarre Problem: Oracle 10g disconnected

    We are facing an bizarre problem in Oracle 10G. We are trying to compile a package specification. As long as there are 10 procedures(program units) in the package it compiles successfully, As soon as we add 11th program unit(come what may a simplest of procedure declaration), It disconnects the session immediately. We asked for alert logs & there is no relevant entry in alert log file.
    Please find below the error: -
    SQL> @D:\Package_Name.sql
    ERROR:
    ORA-03114: not connected to ORACLE
    create or replace PACKAGE PACKAGE_NAME
    ERROR at line 1:
    ORA-03135: connection lost contact
    Elapsed: 00:00:18.90
    ERROR:
    ORA-03114: not connected to ORACLE
    Elapsed: 00:00:00.00
    No errors.
    SQL>
    Please Help :-(

    create or replace PACKAGE SCHEMA_NAME.PACKAGE_NAME
    IS
    -- declare public types and/or object desriptions
    TYPE t_str_list IS TABLE OF varchar2(4000)
    index by binary_integer;
    TYPE rs_type IS REF CURSOR;
    global_pkg_name varchar2(30) := 'PACKAGE_NAME';
    -- get_formulations_list
    function GFL (p_request_id number)
    return varchar2
    PRAGMA RESTRICT_REFERENCES (GFL, WNDS);
    -- Read recordsets for Objects from database
    -- Getters for Record Sets (1. Lookup Tables)
    -- 1. Get_Countries -- + + +
    -- 2. Get_l_numbers -- + + +
    -- 3. Get_mk_numbers -- + + +
    -- 4. Get_licences -- + + +
    -- 5. Get_formulations -- + + +
    -- 6. Get_request_x_frm -- + + +
    -- 7. Get_generic_names -- + + +
    -- 8. Get_global_tm -- + + +
    -- 9. Get_local_tm -- + + +
    -- 10. Get_requests -- + + +
    -- 11. Read_request_data -- + + +
    -- 12. Get_Users -- + + +
    -- 13. Get_User_Roles -- + + +
    -- 14. Read_user_data -- + + +
    -- Internal functions
    -- 1. Get_User_Type -- +
    -- Read Hierarchies for Objects from database
    -- 1. Get_Country_Hier -- + + +
    -- 2. Get_l_number_Hier -- + + +
    -- 3. Get_mk_number_Hier -- + + +
    -- 4. Get_licence_Hier -- + + +
    -- 5. Get_formulation_Hier -- + + +
    -- 7. Get_generic_name_Hier -- + + +
    -- 8. Get_global_tm_Hier -- + + +
    -- 9. Get_local_tm_Hier -- + + +
    -- 10. Get_request_list -- + + +
    -- 1.1 Get_global_tm_HStr -- + + +
    -- 2.1 Get_Country_HStr -- + + +
    -- 3.1 Get_local_tm_HStr -- + + +
    -- 4.1 Get_l_number_HStr -- + + +
    -- 5.1 Get_mk_number_HStr -- + + +
    -- 6.1 Get_licence_HStr -- + - -
    -- 7.1 Get_formulation_HStr -- - - -
    -- 8.1 Get_generic_name_HStr -- - - -
    -- 1. Get_Countries
    -- Record set Structure
    -- country_id
    -- country_name
    -- is_active
    -- role_id (for non HQ users)
    PROCEDURE GC ( p_user_id varchar2
    , p_is_active CHAR DEFAULT 'Y'
    , r_rs out rs_type )
    -- 2. Get_l_numbers
    -- Record set Structure
    -- l_number_id
    -- l_number_desc
    -- is_active
    PROCEDURE GIN ( p_user_id varchar2
    , p_is_active CHAR DEFAULT 'Y'
    , r_rs out rs_type )
    -- 3. Get_mk_numbers
    -- Record set Structure
    -- mk_number_id
    -- mk_number_desc
    -- is_active
    PROCEDURE GMN ( p_user_id varchar2
    , p_is_active CHAR DEFAULT 'Y'
    , r_rs out rs_type )
    -- 4. Get_licences
    -- Record set Structure
    -- licesnce_id
    -- licesnce_name
    -- licesnce_abrv
    -- is_active
    PROCEDURE GL ( p_user_id varchar2
    , p_is_active CHAR DEFAULT 'Y'
    , r_rs out rs_type )
    -- 5. Get_formulations
    -- Record set Structure
    -- formulation_id
    -- formulation_name
    -- is_active
    PROCEDURE GF ( p_user_id varchar2
    , p_is_active CHAR DEFAULT 'Y'
    , r_rs out rs_type )
    -- 6. Get_request_x_frm
    -- Record set Structure
    -- formulation_id
    -- formulation_name
    -- request_id
    PROCEDURE GRX ( p_user_id varchar2
    , p_request_id number
    , r_rs out rs_type )
    -- 7. Get_generic_names
    -- Record set Structure
    -- generic_name_id
    -- generic_name_text
    -- l_number_id
    -- l_number_desc
    -- mk_number_id
    -- mk_number_desc
    -- is_active
    PROCEDURE GGN ( p_user_id varchar2
    , p_is_active CHAR DEFAULT 'Y'
    , r_rs out rs_type )
    -- 8. Get_global_tm
    -- Record set Structure
    -- gtm_name_id
    -- gtm_name_text
    -- generic_name_id
    -- generic_name_text
    -- l_number_id
    -- l_number_desc
    -- mk_number_id
    -- mk_number_desc
    -- is_active
    PROCEDURE GGT ( p_user_id varchar2
    , p_is_active char default 'Y'
    , r_rs out rs_type )
    -- 9. Get_local_tm
    -- Record set Structure
    -- ltm_name_id
    -- ltm_name_text
    -- request_id
    -- country_id
    -- country_name
    -- generic_name_id
    -- generic_name_text
    -- is_default
    -- is_active
    PROCEDURE GLT ( p_user_id varchar2
    , p_country_id number DEFAULT 0
    , p_is_default CHAR DEFAULT '*'
    , p_is_active CHAR DEFAULT 'Y'
    , r_rs out rs_type )
    -- 10. Get_requests
    -- Record set Structure
    -- request_id
    -- gtm_name_id
    -- ltm_name_id
    -- licesnce_id
    -- requestor_isid
    -- hq_isid
    -- request_status_id
    -- lanch_date
    -- change_status_date
    -- country_name
    -- gtm_name_text
    -- ltm_name_text
    -- generic_name_text
    -- licesnce_name
    -- licesnce_abrv
    -- l_number_id
    -- l_number_desc
    -- mk_number_id
    -- mk_number_desc
    -- is_active
    PROCEDURE GR ( p_user_id varchar2
    , p_country_id number DEFAULT 0
    , p_global_tm number DEFAULT 0
    , p_status number DEFAULT 0
    , p_is_active CHAR DEFAULT 'Y'
    , r_rs out rs_type )
    -- 11. Read_request_data
    -- Record set Structure
    -- request_id
    -- gtm_name_id
    -- ltm_name_id
    -- licesnce_id
    -- requestor_isid
    -- hq_isid
    -- request_status_id
    -- lanch_date
    -- change_status_date
    -- country_name
    -- gtm_name_text
    -- ltm_name_text
    -- generic_name_text
    -- licesnce_name
    -- licesnce_abrv
    -- l_number_id
    -- l_number_desc
    -- mk_number_id
    -- mk_number_desc
    -- is_active
    PROCEDURE RRD ( p_user_id varchar2
    , p_request_id number
    , r_rs out rs_type )
    END PACKAGE_NAME;
    /

  • Has anyone got an answer to fix ios5 problem, no sim card inserted...

    Has anyone got an answer to fix ios5 problem, no sim card inserted...

    I bought a new sim card today at the t-mobile shop and they activated the card just by putting credit on, i got home put the sim in the iphone and still got the same message. I have restored and shut down I dont know how many times and updated itunes, I am wishing i had said no to updating the phone as i have no iphone to use and apple say i should go to an apple shop.

  • Bizarre Problem for table row deletion.please help

    Folks
    I am facing a most BIZARRE PROBLEM!!!
    I have a table with a deleteButton by the side.
    The table has 3 rows
    ABC-----DELETE
    BCD-----DELETE
    VDG-----DELETE
    I click on the delete Button of the first row,the record gets deleted from the table,
    Now there are 2 records..
    BCD-----DELETE
    VDG--- -DELETE
    I click on the delete Button of the first row,and I get the error
    java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -1
    The table.getSelectedRow() becomes -1 automatically...
    Now if I comment out the Table deletion statements, and I click on any delete Button
    i get the correct messages
    You clicked row : 1
    you clicked row : 2
    After deletion of the first record,i am unable to delete the 2nd record,i get the
    error above.
    any suggestions
    ActionListener al = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    System.out.println("Table Row clicked is : " + table.getSelectedRow());
    // Delete row from window.
    ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
    table.revalidate();
    };

    after deleting the row call this method
    fireTableRowsDeleted()
    -Ashish

  • Delete rows from table...Bizarre problem.

    Folks
    i HAVE this bizarre problem.
    I hava a Java class which displays data read into a table with a delete
    option by the side of each row.
    Now lets assume you have 3 rows in the Table.
    abc deleteButton
    efg deleteButton
    xyz deleteButton
    When I click the first delete,that row gets deleted from the table.(perfect...)
    Now I have 2 rows.
    When I click on the first row,I get the error
    'You clicked -1'
    java.lang.ArrayIndexOutofBoundsException: -1 < 0.
    Can anyone tell me why this is happening even though there are rows in the table.???
    ActionListener al = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    System.out.println("You clicked row : " + table.getSelectedRow());
    javax.swing.table.TableModel model = table.getModel();
    Object o = model.getValueAt(table.getSelectedRow(),0);
    //System.out.print(model.getValueAt(table.getSelectedRow(), 0));
    //System.out.println();
    MyDeleteFunction(o.toString());
    // Delete row from window.
    ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
    table.revalidate();
    table.repaint();

    Hi ritu,
    This class is called
    new DisplayCall_IDTodisconnect(hashTable);
    its a long file.
    its attached below.
    The rows are displayed by reading a hashtable into a vector
    and the vector is iterated and appended..
    public class DisplayCall_IDToDisconnect {
    public static JTable createTable(Vector data, String buttonLabel, ActionListener action){
    return createTable(data.iterator(), buttonLabel, action);
    public static JTable createTable(
    Iterator dataIterator,
    String buttonLabel,
    ActionListener action) {
    DefaultTableModel model = new DefaultTableModel() {
    public boolean isCellEditable(int row, int col) {
    return col == 1;
    model.setColumnCount(2);
    while (dataIterator.hasNext()) {
    Object[] row = { dataIterator.next().toString(), null };
    model.addRow(row);
    DefaultTableColumnModel columnModel = new DefaultTableColumnModel();
    columnModel.addColumn(new TableColumn(0, 100));
    columnModel.addColumn(new TableColumn(1, 80,
    new TableButtonCellRenderer(buttonLabel),
    new TableButtonCellEditor(buttonLabel, action)
    JTable table = new JTable(model, columnModel) {
    public void valueChanged(ListSelectionEvent e) {
    super.valueChanged(e);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    return table;
    private static class TableButtonCellRenderer implements TableCellRenderer {
    final JButton button;
    TableButtonCellRenderer(String buttonLabel) {
    button = new JButton(buttonLabel);
    public Component getTableCellRendererComponent(
    JTable table,
    Object value,
    boolean isSelected,
    boolean hasFocus, int row, int column) {
    return button;
    private static class TableButtonCellEditor
    extends AbstractCellEditor
    implements TableCellEditor, ActionListener {
    final JButton button;
    final ActionListener callback;
    TableButtonCellEditor(String buttonLabel, ActionListener callback) {
    button = new JButton(buttonLabel);
    this.callback = callback;
    button.addActionListener(this);
    public Component getTableCellEditorComponent(
    JTable table,
    Object value,
    boolean isSelected,
    int row, int column) {
    return button;
    public Object getCellEditorValue() {
    return null;
    public void actionPerformed(ActionEvent e) {
    button.getParent().requestFocus();
    callback.actionPerformed(e);
    static JTable table;
    Vector items;
    final ClientManager clientMgr;
    // Constructor.
    public DisplayCall_IDToDisconnect(Hashtable callLegTable,ClientManager clientMgr){
    Vector vCSeqnos = displayCSeqNos(callLegTable);
    this.clientMgr = clientMgr;
    JFrame frame = new JFrame("Disconnect Options");
    /*Vector*/ items = new Vector();
    Enumeration vEnum = vCSeqnos.elements();
    while(vEnum.hasMoreElements()){
    items.add(vEnum.nextElement());
    ActionListener al = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    //System.out.println("You clicked row ,col: " + table.getSelectedRow()+
    // table.getSelectedColumn());
    javax.swing.table.TableModel model = table.getModel();
    Object o = model.getValueAt(table.getSelectedRow(),0);
    System.out.print(model.getValueAt(table.getSelectedRow(), 0));
    System.out.println();
    closeConnection(o.toString());
    // Delete row from window too.
    ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
    table.revalidate();
    table = DisplayCSeqNos.createTable(items, "Disconnect", al);
    frame.getContentPane().add(new JScrollPane(table));
    frame.pack();
    frame.show();
    } // End Constructor.
    public void closeConnection(String s){
    /*1. Disconnect the current session*/
    this.clientMgr.disconnectCall(s);
    /*2. refresh the Disconnect window*/
    this.refreshWindow();
    public Vector displayCSeqNos(Hashtable callLegTable){
    Enumeration eNum;
    String str;
    Vector v = new Vector();
    eNum=callLegTable.keys();
    while(eNum.hasMoreElements()){
    str = (String) eNum.nextElement();
    //System.out.println("Key : " + str + " Value : " + callLegTable.get(str));
    v.addElement(str);
    return v;
    } // End of displayCSeqNos.

  • I have a problem when iTunes card insert the card number comes message the code you entered has not been properly activated

    I have a problem when iTunes card insert the card number comes message the code you entered has not been properly activated

    Is the store that you bought it from close so that you could try going back to them and ask them to activate the card properly ? If not then try contacting iTunes Support (you will probably need to give them images of the front and back of the card, and possibly its receipt) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then iTunes Cards And Codes

  • Insert Problem jdbc odbc

    I have problem with my Insertion code. here is my code:-
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    import java.lang.Class;
    import java.util.*;
    public class BookForm extends JFrame implements ActionListener
         //attributes
         private JTextField name, address, ICno;
         private JButton cancel, book;
         private JLabel lb1,lb2, lb3, lb4;
         private Container c;
         private Connection con;
         private ResultSet rs;
         private Statement stmt;
         private String looks;
         private String Busno, $seatno, $date, pric;
         public BookForm(String $Busno, String seatno, String date, String $price)
              super("Seat No. "+seatno);
              c = getContentPane();
              c.setLayout(null);
              c.setSize(260,260);
              Busno = $Busno;
              $seatno = seatno;
              $date = date;
              pric = $price;
              // ********** SET UP GUI **********
              try{
              looks = UIManager.getSystemLookAndFeelClassName();
              UIManager.setLookAndFeel(looks);
              SwingUtilities.updateComponentTreeUI(this);
              }//end of try
              catch(Exception e)
                   System.out.println("Error in UIManager");
              lb1 = new JLabel("Name");
              lb1.setSize(60,20);
              lb1.setLocation(30,30);
              lb2 = new JLabel("Address");
              lb2.setSize(60,20);
              lb2.setLocation(30,60);
              lb3 = new JLabel("IC No.");
              lb3.setSize(60,20);
              lb3.setLocation(30,90);
              lb4 = new JLabel("Seat No. : "+$seatno);
              lb4.setSize(100,20);
              lb4.setLocation(30,120);
              name = new JTextField();
              name.setSize(150,20);
              name.setLocation(100,30);
              address = new JTextField();
              address.setSize(150,20);
              address.setLocation(100,60);
              ICno = new JTextField();
              ICno.setSize(150,20);
              ICno.setLocation(100,90);
              cancel = new JButton("Cancel");
              cancel.setSize(70,30);
              cancel.setLocation(30,190);
              cancel.setMnemonic('L');
              book = new JButton("Print & Book");
              book.setSize(100,30);
              book.setLocation(140,190);
              book.setMnemonic('R');          
              c.add(lb1);
              c.add(lb2);
              c.add(lb3);
              c.add(lb4);
              c.add(name);
              c.add(address);
              c.add(ICno);
              c.add(cancel);
              c.add(book);
              cancel.addActionListener(this);
              book.addActionListener(this);
         }//end o BookForm()
         public void actionPerformed(ActionEvent e)
              Object source = e.getSource();
              if(source == book)
                   String nam = name.getText();
                   String add = address.getText();
                   String ic = ICno.getText();
                   String busn = Busno;
                   String seatn = $seatno;
                   String dat = $date;
                   boolean validation = validationFunction();
    if(validation == false)
    JOptionPane.showMessageDialog(null,"Please Fill the Form Completely");
    else{
         try{
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                        con = DriverManager.getConnection("jdbc:odbc:Bus","","");
                        stmt=con.createStatement();
                        stmt.executeUpdate("Insert Into PassengerBooking (Name,Address,ICno,BusNo,SeatNo,Date) VALUES ('"+nam+"' , '"+add+"', '"+ic+"', '"+Busno+"', '"+$seatno+"', '"+$date+"')");
         stmt.close();
                        con.close();
         catch(SQLException exc)
                             exc.printStackTrace();
                        catch(Exception exc)
                             exc.printStackTrace();
              else if(source == cancel)
                   this.setVisible(false);
         public boolean validationFunction()
              boolean check = true;
              String nam = name.getText();
              String add = address.getText();
              String ic = ICno.getText();
              if(name.equals(""))
                   check = false;
              else if(add.equals(""))
                   check = false;
              else if(ic.equals(""))
                   check = false;
              return check;
    I get syntax error in my Insert query. my database column name is: Name, Address, ICno, BusNo, SeatNo, Date
    and I have an auto number (BookNo) for that table as a primary key.
    Since I am a student and new in java, I dont know which code I type wrongly..
    Please Help me, This my Assignment which to be submited next week.
    Message was edited by:
    Triagip

    Note that there is a return value involved. I suggest you try the following first.
    executeUpdate
    public int executeUpdate(String sql)
                      throws SQLException
    Executes the given SQL statement, which may be an INSERT, UPDATE, or
    DELETE statement or an SQL statement that returns nothing, such as an
    SQL DDL statement.
    Parameters:
    sql - an SQL INSERT, UPDATE or DELETE statement or an SQL statement
    that returns nothing
    Returns:
    either the row count for INSERT, UPDATE or DELETE statements, or 0 for
    SQL statements that return nothing
    Throws:
    SQLException - if a database access error occurs or the given SQL
    statement produces a ResultSet object
    try {
      int returnValue = 0;  // Added
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      System.out.println("Step 1 complete");
      con = DriverManager.getConnection("jdbc:odbc:Bus","","");
      System.out.println("Step 2 complete");
      stmt=con.createStatement();
      System.out.println("Step 3 complete");
      returnValue = stmt.executeUpdate("Insert Into PassengerBooking "
                                      +"(Name,Address,ICno,BusNo,SeatNo,Date) "
                                      +"VALUES ('"+nam+"' , '"+add+"', '"+ic+"', '"+Busno+"', '"+$seatno+"', '"+$date+"')");
      System.out.println("Inserted ["+returnValue"+"] rows");
      stmt.close();
      con.close();
    }I absolutely agree with the advise you received in isolating the SQL pblms, by making sure the insert statement works apart from the Java wrapper code.

  • Idoc to XI to JDBC (oracle) - duplicated inserts

    All,
    I have a scenario, in which an IDoc is passed to XI and then the fields are mapped and passed to a JDBC receiver (Oracle).  The data is all inserted corectly on the first call, but then the scenario goes into a restart status and insert the data 3 more times, every 5 finutes (this coincides with the retry settings on the communication channel).  The problem is I don't understand why the scenario errors out.
    In the communication channel monitoring, everything is a success until I see this error:
    Success - MP: processing local module localejbs/com.sap.aii.messaging.adapter.ModuleXMB2DB
    Error - MP: exception caught with cause com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of com.sap.aii.messaging.adapter.ModuleXMB2DB.
    Error - Exception caught by adapter framework: Object not found in lookup of com.sap.aii.messaging.adapter.ModuleXMB2DB.
    Error - Delivery of the message to the application using connection JDBC_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Object not found in lookup of com.sap.aii.messaging.adapter.ModuleXMB2DB.: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of com.sap.aii.messaging.adapter.ModuleXMB2DB..
    The only other thing I notice is in SXMB_MONI, where things look successful, but there are 4 lines for Acknowledgement Not Possible (1 line is the original run, the other 3 are the retries).
    Everywhere but the above erorrs makes it look like everything is successfully handled.  The IDoc is mapped successfully, and the Oracle table is inserted to successfully (everytime the scenario retries).
    Does anyone have any suggestions as to what may be the problem or what I can look at to fix this?   I have reviewed numerous blogs, SAP notes, SAP help, etc. Points will gladly be rewarded.
    jake

    Ok, I have tried some more things and no luck so far.
    My JDBC receiver has these settings and I also tried the others mentioned by Matias.  I have Message Protocol of XML SQL Format.  I have tried the XML Schema Interpreter with Key Tags Mandatory as on and off.  For Exactly Once Handling I have tried with Persistence = Local and Conflict Resolution as both Redo and Error.  Everything else left as the defaults.
    I tried moving the ModuleXMB2DB to first in the list instead of second, and then nothing gets to Oracle.  I have used this before in a test scenario as the second piece and that scenario was fine (as far as I know).  I also have IDX_NOALE turned on, and the scenario still tried itself the 3 times, but didn't leave any message about Acknowledgements.
    When I tried with the logSQLstatement = True, I didn't find any extra verbage in the communication channel monitoring. Besides the already mentioned ModuleXM2DB error, I also see this
    Error Category = XI_J2EE_ADAPTER_ENGINE
    Error Code = GENERAL_ERROR
    but no other info about an error.
    Any thoughts on this?
    Jake

  • UDF JDBC -- want to insert into a database

    Hi experts,
    I need to insert into a DB using a UDF. I have written the UDF but the problem is it works fine for a select query and when i replace the query with insert, it fails.
    the JDBC CC says invalid SQL query.
    The 2 queries are :
    //insertQuery= "insert into TABLENAME (COLUMNNAME) values ('"VAR"')";
    //insertQuery= "select count(*) from TABLENAME";
    accessor = LookupService.getDataBaseAccessor(channel);
    resultSet = accessor.execute(insertQuery);
    Also if I execute the insert query in DB it works fine.
    Please advise.

    It is a very simple thing i am doing..........................
    i have a source structure in which the first field of the source is the input to the first field of the target.
    there is a UDF in between which inserts the first source field. the UDF has the channel specified which is  JDBC.
    I was just running it thru the display queue (in MM) at the  and checking the communication channel. It gets errored out......... saying invalid SQL statement. But for select query it works fine

  • JDBC/OCI8 Array inserts

    Does JDBC/OCI8 support array inserts? I'm familiar with the C/C++ array inserts, but I haven't found anything on array inserting using JDBC/OCI8.
    Array processing gives an application a real performance boost and I was hoping to use it in Java.

    Hi ,
    I am facing the same problem with
    Oracle 8.1.5 on Windows NT.
    Driver : 8.1.6 JDBC OCI Driver
    JDK 1.2.2
    Any workaround / patch to solve this problem please ?
    Thanks,
    Shubhada

  • Connecting to DB2 Database using JDBC for select/Insert

    Hi,
    I am trying to connect to an DB2 Database using  JDBC adapter, I have build an UDF for the same.
    The UDF will try to query the database in the form of Select and INSERT.I am using the LOOKUP API provided by SAP.When I try to execute the UDF I have received the following error.can any of you provide the solution for the error and also is it that the JDBC adapter has to be situated on Central Adapter engine to execute the API, can the JDBC adapter used for executing the INSERT statement.
    Exception during processing the payload.Problem when calling an adapter by using communication channel JDBC_PIDB_Receiver_CC (Party: , Service: XIDB_BSRV, Object ID: 59f2d7694acc3e81840f89b0169d9323) XI AF API call failed. Module exception: (No information available). Cause Exception: (No information available).
    com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel JDBC_PIDB_Receiver_CC (Party: , Service: XIDB_BSRV, Object ID: 59f2d7694acc3e81840f89b0169d9323) XI AF API call failed. Module exception: (No information available). Cause Exception: (No information available).
         at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.execute(AdapterProxyLocal.java:131)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.execute(SystemAccessorInternal.java:68)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:149)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:77)
         at com.sap.aii.utilxi.hmis.server.HmisServiceImpl.invokeMethod(HmisServiceImpl.java:169)
         at com.sap.aii.utilxi.hmis.server.HmisServer.process(HmisServer.java:178)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:296)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:211)
         at com.sap.aii.utilxi.hmis.web.workers.HmisInternalClient.doWork(HmisInternalClient.java:70)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doWork(HmisServletImpl.java:496)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doPost(HmisServletImpl.java:634)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    Root Cause:
    com.sap.aii.af.service.api.AFException: XI AF API call failed. Module exception: (No information available). Cause Exception: (No information available).
         at com.sap.aii.af.service.api.AdapterAccess.sendMsg(AdapterAccess.java:214)
         at com.sap.aii.af.service.api.AdapterAccess.execute(AdapterAccess.java:283)
         at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.execute(AdapterProxyLocal.java:123)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.execute(SystemAccessorInternal.java:68)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:149)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:77)
         at com.sap.aii.utilxi.hmis.server.HmisServiceImpl.invokeMethod(HmisServiceImpl.java:169)
         at com.sap.aii.utilxi.hmis.server.HmisServer.process(HmisServer.java:178)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:296)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:211)
         at com.sap.aii.utilxi.hmis.web.workers.HmisInternalClient.doWork(HmisInternalClient.java:70)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doWork(HmisServletImpl.java:496)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doPost(HmisServletImpl.java:634)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    Thanks,
    Kiran.

    Hi,
    have you deployed the JDBC driver for your DB2 database in your XI system........if not, then ask your basis guys to find the weblog to deploy the JDBC driver in XI system and then deploy your DB2 database driver in your JDBC driver in XI system............
    then again execute your scenario.
    Regards,
    Rajeev Gupta

  • Problem with overwrite and insert keyboard commands

    I'm a new user, switching from FCP. I edited one project successfully with no trouble a couple of weeks ago. Now I'm in a second project and having a weird difficulty. Using a pretty new Mac 8 core tower.
    The insert and overlay keyboard commands (comma and period keys) don't work. They still work in the old project but not this one. If I start a new sequence and copy my timeline to it, the commands will work for awhile but ONLY with video, not with the audio tracks. Drag and drop works fine but that really slows me down.
    The clips I'm using are all the same format (H.264 from Canon 5DII and some still photos) as the first project. Only difference in this project is lots of chroma keying and some resizing of background still photos. Nothing unrendered.
    I started a new project just now and imported the problem project into it, started a new sequence, copied old sequence, and I get the same problem. I can drop in video with a keyboard command but not audio. Earlier it was not even doing video. Yesterday when I'd start a new sequence and do the same thing, it would give me video on the keyboard command but then eventually that would stop and it would do nothing. At one point the cursor would move over the width of the clip, as if it had been dropped into the timeline, but then that stopped as well.
    I've trashed preferences and that didn't work. I did that according to a procedure I found online. It said open up PP while holding down the Shift and Option keys. I did that twice. Nothing.
    To summarize: Keyboard commands for overwrite and insert edit do not work in this project but do in an older project.
    Any ideas?
    Thanks.
    Bill Pryor
    [email protected]

    Well, thanks to an email from another person who was having the same problem, it's all solved not.
    Operator error. Dang. Who knew--in FCP you select a track by clicking on the V or A buttons to the far left. In Premiere Pro you have to make sure BOTH the far left button and the one to the right that says Video 1, Audio 1, etc. are also clicked. They BOTH have to be light gray. In my first project, everything was properly activated but in the next project apparently they were not and that carried over to succeeding projects (even though I didn't change anything...at least consciously).
    So all as well now. No glitch, no bug. Just good ol' fashioned operator error. I will wear the dunce hat today.

  • Problem in trigger when inserting in mtl_transactions_interface there is an added row

    hi,
    i have a problem in the trigger when i have a command of 2 lines and do a reception and insertion in table mtl_transactions_interface i found 3 lines, i didn't know where come the 3 row
    create or replace
    TRIGGER TOP_RCV_TRANSACTION_ACC_T2 AFTER
      INSERT ON PO.RCV_TRANSACTIONS FOR EACH ROW DECLARE
      CURSOR org_item_cur
      IS
        SELECT distinct organization_id,
          inventory_item_id
        FROM mtl_system_items_b
        WHERE inventory_item_id=
          (SELECT distinct item_id
          FROM rcv_shipment_lines
          WHERE shipment_line_id=:new.shipment_line_id
          CURSOR item_cur
          IS
          select distinct  RSL.item_id
    from
      RCV_SHIPMENT_HEADERS RSH
      ,RCV_shipment_lines RSL
      where :new.shipment_header_id=RSH.shipment_header_id
      and RSH.shipment_header_id=RSL.shipment_header_id;
      X_att_item      VARCHAR2(10);
      X__bc_ot        VARCHAR2(10);
      X_sum_qty       NUMBER;
      X_receipt_num   VARCHAR2(30);
      X_count_article NUMBER;
      X_item_org      NUMBER;
      X_org_id        NUMBER;
      X_serial_number NUMBER;
      X_dec_dou varchar2(100);
      X_DAE varchar2(100);
      X_LOCATOR_ID  NUMBER;
      X_ITEM_REVISION varchar2(3);
      X_ITEM_ID NUMBER ;
      X_PO_NUMBER VARCHAR2(20) ;
    BEGIN
    FOR item_rec IN item_cur
          LOOP
      IF (:new.transaction_type='DELIVER' and :new.organization_id=83 and (item_rec.item_id=61305 or item_rec.item_id=61306)) THEN
        SELECT distinct receipt_num
        INTO X_receipt_num
        FROM RCV_SHIPMENT_HEADERS
        WHERE shipment_header_id=:new.shipment_header_id;
    SELECT COUNT(*)
        INTO X_count_article
        FROM mtl_system_items_b
        WHERE inventory_item_id=
          (SELECT distinct item_id
          FROM rcv_shipment_lines
          WHERE shipment_line_id=:new.shipment_line_id
          --récupérer le numéro de commande à partir de la table PO_HEADERS_ALL
        select distinct PHA.segment1 
        into X_PO_NUMBER
        from PO_HEADERS_ALL PHA
        where PHA.PO_HEADER_ID=:new.PO_HEADER_ID;
         -- Récupérer la révision de l'article
          select distinct ITEM_REVISION
          into X_ITEM_REVISION
          from rcv_shipment_lines
          WHERE shipment_line_id=:new.shipment_line_id;
        IF (X_count_article > 1) THEN
          FOR org_item_rec IN org_item_cur
          LOOP
            IF (org_item_rec.organization_id=83 and(org_item_rec.inventory_item_id =61305 or org_item_rec.inventory_item_id =61306) ) THEN
              INSERT into inv.mtl_transactions_interface
                  transaction_interface_id,
                  SOURCE_CODE,
                  SOURCE_LINE_ID,
                  SOURCE_header_ID,
                  PROCESS_FLAG,
                  TRANSACTION_MODE,
                  INVENTORY_ITEM_ID,
                  REVISION,
                  ORGANIZATION_ID,
                  SUBINVENTORY_CODE,
                  TRANSACTION_QUANTITY,
                  TRANSACTION_UOM,
                  TRANSACTION_DATE,
                  TRANSACTION_TYPE_ID,
                  TRANSACTION_REFERENCE,
                  TRANSACTION_COST,
                  LAST_UPDATE_DATE,
                  LAST_UPDATED_BY,
                  CREATION_DATE,
                  CREATED_BY,
                  lock_flag,
                  transaction_source_name,
                  transaction_source_type_id,
                  Flow_Schedule,
                  Scheduled_Flag,
                  distribution_account_id ,
                  LOCATOR_ID
                VALUES
                  mtl_transactions_interface_s.nextval,
                  'INTERFACE',
                  0,
                  0,
                  1,
                  3,
                  org_item_rec.inventory_item_id,
                  X_ITEM_REVISION,
                  161,
                  'CENTRAL001',
                  :new.quantity,
                  :new.uom_code,
                  sysdate,
                  202,
                   X_PO_NUMBER,
                    :new.po_unit_price,
                  sysdate,
                  :new.LAST_UPDATED_BY,
                  sysdate,
                  :new.LAST_UPDATED_BY,
                  2,
                  X_receipt_num,
                  13,
                  'Y',
                  2,
                  347783,
                  :new.attribute1
            END IF;
          END LOOP;
          if org_item_cur%ISOPEN then
            close org_item_cur;
            end if;
    END IF;
      END IF;
       END LOOP;
    END;
    please help me and give me solutions to localisate the problem?

    This trigger will fire at the time of every PO receipt and receiving transactions such as Accept, Reject, Deliver, RTV etc.
    May be you forgot to put a WHEN clause in Trigger.

Maybe you are looking for