"If INSERTING then.." in Java

I'm converting a PL/SQL trigger to java and stuck with the statement of
If INSERTING then
..do something
end if
How do I convert that (if INSERTING) into Java? Is there a equivalent JDBC method I can call?
Thanks

The Strategy pattern. Maintain a Map of ID against strategy, and simply get hold of a DTO, ask for it's ID, and get hold of the correct strategy from the Map

Similar Messages

  • Insert data from java to oracle object created

    Hi
    How can i insert data from java to table test with column LIST_QRY_RES_DN_MEMBER_INFO as below after create object type
    CREATE OR REPLACE TYPE QRY_RES_SERVICE_VALUES AS OBJECT (
      PARAMETER_CODE            VARCHAR2(60),
      PARAMETER_VALUE           VARCHAR2(60)
    CREATE OR REPLACE TYPE LIST_QRY_RES_SERVICE_VALUES AS TABLE OF QRY_RES_SERVICE_VALUES;
    CREATE OR REPLACE TYPE QRY_RES_OPTIONS AS OBJECT (
      SERVICE_CODE            VARCHAR2(60),
      SERVICE_VALUE           LIST_QRY_RES_SERVICE_VALUES 
    CREATE OR REPLACE TYPE LIST_QRY_RES_OPTIONS AS TABLE OF QRY_RES_OPTIONS;
    CREATE OR REPLACE TYPE QRY_RES_MEMBER_INFO AS OBJECT (
      VARIABLE_CODE            VARCHAR2(60),
      VARIABLE_VALUE           VARCHAR2(120)
    CREATE OR REPLACE TYPE LIST_QRY_RES_MEMBER_INFO AS TABLE OF QRY_RES_MEMBER_INFO;
    CREATE OR REPLACE TYPE QRY_RES_DN_MEMBER_INFO AS OBJECT (
      DN                       VARCHAR2(60),
      MEMBER_INFO              LIST_QRY_RES_MEMBER_INFO,
      OPTIONS                  LIST_QRY_RES_OPTIONS
    CREATE OR REPLACE TYPE LIST_QRY_RES_DN_MEMBER_INFO AS TABLE OF QRY_RES_DN_MEMBER_INFO;
    CREATE TABLE test(
    DN_MEMBER_INFO          LIST_QRY_RES_DN_MEMBER_INFO,
    NESTED TABLE DN_MEMBER_INFO STORE AS LIST_QRY_RES_DN_MEMBER_TAB
        (NESTED TABLE MEMBER_INFO STORE AS MEMBER_INFO_TAB,
         NESTED TABLE OPTIONS STORE AS LIST_QRY_RES_OPTIONS_TAB
            (NESTED TABLE SERVICE_VALUE STORE AS SERVICE_VALUE_TAB));

    It appears you are trying to store java objects (types) in a database rather than raw data (string, int, date types) that the object contains. If so, I don't think that ever really caught on. Most programmers store the raw data, then pull it out and populate a class. The problem with storing the object is that new versions of classes come out and your old version is stored in the database. If you just store the data, you don't have to worry about what version is in the database. You can populate the new version of the class with the same data.
    Also, others can use sql to query your data and use it for their own use independent of what you intended it for. I think most people use the (browser) based utility that comes with the database to create the tables, normalize them, set up primary keys, set up foreign keys, etc rather then run an sql statement as you did above.

  • INSERT statement in Java and MS Access

    Hi all,
    can anyone please tell me how to insert data to an MS Access table using JSP i tried INSERT statement of java but it is getting errors saying INSERT statement is wrong. I have no idea about MS access insert statement. i am totally tired of this. Please someone help me.

    Hello,
    MS Sql can cause problems where it goes off standard, however I dont think insert is any different.
    INSERT INTO table_name (column1, column2) VALUES (variable1, variable2)
    Make sure your table and column names are exactly right, Java is case sensitive, so make sure the case is correct also.
    The other common error is if you have a required field in the database that is not populated by your program, so, if for instance there was a column3 in the table for the above example, which was a required field, the sql would fail as there is no data being entered for column3.

  • How to uninstall Java runtime 1.5 completely and then install Java 1.4...

    Dear Friends,
    I have a software running with Java runtime 1.4. When the new version of Java (1.5) became available, I installed it. And then the software I am using becomes useless since it doesn't work with the new Java 1.5. I uninstalled java 1.5 and then reinstalled Java 1.4. But it doesn't work. I'll be very glad if someone can help me uninstalling Java 1.5 completely from my computer.

    I have a similar problem under Windows XP. When I go to "Control Panel" and try to remove that Java installation, clicking on the "Change/Remove" button has no effect whatsoever: the program name simply dims for a moment, and then reappears with no evident change. Is there not a separate routine available to effect a removal, so the program may be reinstalled?
    Markus
    Toronto

  • I Mac is not reading from DVD drive. Disk will insert, then some noises but after a few seconds, nothing.

    I Mac is not reading from DVD drive. Disk will insert, then some noises but after a few seconds, nothing. I am trying to install Broterh printer disks. Any ideas? I am on Mavericks.

    Reset the NVRAM/PRAM and Reset the SMC, then try again.

  • Insert failed in Java Proc

    Here is my class
    public static String OnlyInsert(
    int v_AccommodationVendorID,
    int v_AccommodationTypeID,
    int v_AccommodationRateTypeID,
    int v_PeakPrice
    ) throws SQLException
    String val = "yes";
    String x = "";
    String insSql = "";
    String tDate = "TO_DATE('02/02/2001', 'MM/DD/YYYY')";
    OracleDriver ora = new OracleDriver();
    conn = ora.defaultConnection();
    //insSql = "INSERT INTO Accommodation_Rate_Schedule (AccommodationVendorID, AccommodationTypeID, AccommodationRateTypeID, StartDate, Price) Values (" + v_AccommodationVendorID + "," + v_AccommodationTypeID + "," + v_AccommodationRateTypeID + ",TO_DATE('02/15/2001', 'MM/DD/YYYY')," + v_PeakPrice +")";
    try
    PreparedStatement pstmt = conn.prepareStatement
    ("INSERT INTO Accommodation_Rate_Schedule (AccommodationVendorID, AccommodationTypeID, AccommodationRateTypeID, StartDate, Price) Values "
    + "(?, ?, ?, ?, ?)");
    pstmt.setInt(1, v_AccommodationVendorID);
    pstmt.setInt(2, v_AccommodationTypeID);
    pstmt.setInt(3, v_AccommodationRateTypeID);
    pstmt.setString(4, tDate);
    pstmt.setInt(5, v_PeakPrice);
    pstmt.execute();
    if(! success)
    System.err.println("Insert failed");
    x = x + "failed sql" + insSql;
    else
    System.err.println("Insert is gooooooooood");
    x = x + "good sql" + insSql;
    catch (Exception e)
    System.err.println("exception caught" + e);
    x = x + "2" + e;
    return(val + "and " + x);
    Here is my function
    CREATE OR REPLACE FUNCTION ins_acc
    (id1 NUMBER,
    id2 NUMBER,
    id3 NUMBER,
    id4 NUMBER
    RETURN VARCHAR2
    AS
    LANGUAGE JAVA
    NAME 'Accommodation.OnlyInsert(int, int, int, int)
    return java.lang.String';
    Every thing is fine till i use the following command
    select ins_acc(5, 1, 1, 100) from dual;
    I get the following error
    oracle.jdbc.driver.OracleSQLException: ORA-14551: cannot perform a DML operation inside a query
    Any one please
    Thanks
    null

    Dear Sir/Madam,
    Hi. I had a problem exactly like you.
    Your problem is for the following statement:
    select ... into ... from dual
    Here you are performing a select and then
    in your stored function you want to perform
    an insert. Oracle can not do such a thing.
    So you should convert your stored function
    to a stored procedure with an out parameter.
    Sincerely,
    Kaveh Mahdian

  • Is it impossible to burn a second copy of a DVD after you have burned the first from iDVD? i am using OS 10.6.8 and iDVD version 7.1.2. the DVD is inserted, then iDVD ejects it, but keeps running as though it is working but it's not.

    any help is much appreciated.

    thanks guys; but the problem is that iDVD does not want to burn a disk now from the original movie-project. i see the movie project on teh desktop and can launch it just fine - even play it through the iDVD application - but when i click burn, it asks for a disk (I insert a memorex DVD+RDL 8.5Gb 240 minute dual layer) and it ejects it a few seconds later. the IDVD progress bar still runs as though it is burning just fine - its progress drops from 18 minutes all the way to "less than a minute" and then it hangs. even if i insert a different memorex disk, it still doesn't start actually burning it. it only burned the very first memorex disk i inserted successfully. i have tried disk utility to burn from a .dmg file copy of the original successfully burned disk, but disk utility can't burn onto the memorex disk either. maybe something wrong with the super drive? thanks for your ideas.

  • Insert then update on same row in bean Transaction leads to deadlock

    <b>Setup Details</b>
    Hibernate version: 3.1.2
    EJB version: 2.0
    Name and version of the database : MS SQL Server 2000
    Datasource implmentation class being used : com.sap.nwmss.jdbcx.sqlserver.SQLServerDataSource
    We are using SAP NetWeaver Application Server 6.0 and Hibernate 3.1.2 in our application. We have StalessSessionBeans which use Hibernate to interact with the database. We are running into a situation where the application goes into a hang state when the following flow is bein executed:
    //transaction attribute = "Required"
    beanMethod() {
    myObj = new MyObj();
    myObj.setSomeValue();
    session = SessionFactory.openSession();
    //id is auto generated by database
    id = session.insert(myObj);
    //retrieve the recently inserted obj
    myUpdatedObj = session.load(id);
    //modify the myUpdatedObj
    myUpdatedObj.modifySomeValue();
    //update using hibernate session
    session.update(myUpdatedObj);
    //return from method 
    Here's the flow:
    1) In a CMT stateless session bean, there's a method which has transaction atrribute as "Required"
    2) This method creates a new object and inserts it
    3) Then loads this saved object and modifies some values in it
    4) Then invokes the update method on the session to update this modified object in the database.
    Note: We have enabled auto flush on transaction in the hibernate configuration file.
    And here's what we are observing:
    - The insert obtains a lock on the row as part of the transaction
    - When the update is called on the same row as part of the auto flush, the update never completes. The update statement is unable to obtain a lock on the same row.
    Here is some additional info:
    - We have set :
    session.connection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
    hibernate.cfg.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-configuration PUBLIC
                "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
       <session-factory>
          <property name="hibernate.jndi.class">
             com.sap.engine.services.jndi.InitialContextFactoryImpl
          </property>
          <property name="hibernate.session_factory_name">
             HibernateSessionFactory
          </property>
          <property name="hibernate.transaction.factory_class">
             org.hibernate.transaction.JTATransactionFactory
          </property>
          <property name="hibernate.connection.datasource">jdbc/SQLPool1</property>
          <property name="hibernate.connection.pool_size">25</property>
          <property name="show_sql">true</property>
          <property name="hibernate.connection.isolation">1</property>
          <property name="hibernate.prepare_sql">true</property>
          <property name="hibernate.statement_cache.size">10000</property>
          <!--property name="hibernate.jdbc.use_scrollable_resultset">true</property-->
          <property name="transaction.manager_lookup_class">
             com.tdemand.server.util.hibernate.SAPWebASTransactionManagerLookup
          </property>
          <property name="hibernate.jdbc.use_get_generated_keys">
                   false
          </property>
          <property name="hibernate.transaction.flush_before_completion">true</property>
          <property name="hibernate.jdbc.batch_size">1000</property>
          <property name="hibernate.cache.use_second_level_cache">false</property>
       </session-factory>
    </hibernate-configuration>
    Any clue why the update query is having problem in completing, even though update and insert are being called from the same bean method as part of a transaction?
    Here's the log:
    2006-11-01 22:10:00,310 INFO [com.tdemand.server.planning.ejbs.ForecastPlanningSessionBean] - Starting save
    2006-11-01 22:10:00,310 DEBUG [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] - saving transient instance
    2006-11-01 22:10:00,310 DEBUG [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] - saving transient instance
    2006-11-01 22:10:00,310 DEBUG [org.hibernate.event.def.AbstractSaveEventListener] - saving [com.tdemand.generated.pojo.TdForecastPlan#<null>]
    2006-11-01 22:10:00,310 DEBUG [org.hibernate.event.def.AbstractSaveEventListener] - saving [com.tdemand.generated.pojo.TdForecastPlan#<null>]
    2006-11-01 22:10:00,310 DEBUG [org.hibernate.event.def.AbstractSaveEventListener] - executing insertions
    2006-11-01 22:10:00,310 DEBUG [org.hibernate.event.def.AbstractSaveEventListener] - executing insertions
    2006-11-01 22:10:00,310 DEBUG [org.hibernate.persister.entity.BasicEntityPersister] - Inserting entity: com.tdemand.generated.pojo.TdForecastPlan (native id)
    2006-11-01 22:10:00,310 DEBUG [org.hibernate.persister.entity.BasicEntityPersister] - Inserting entity: com.tdemand.generated.pojo.TdForecastPlan (native id)
    2006-11-01 22:10:00,310 DEBUG [org.hibernate.jdbc.AbstractBatcher] - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
    2006-11-01 22:10:00,310 DEBUG [org.hibernate.jdbc.AbstractBatcher] - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
    2006-11-01 22:10:00,325 DEBUG [org.hibernate.SQL] - insert into trd0nedbo.TD_FORECAST_PLAN (ORGANIZATION_TBL_ID, USER_TBL_ID, PLAN_NAME, IS_ACTIVE, PLAN_TYPE, TIMECREATED, TIMEUPDATED, START_TIME, END_TIME, HORIZON, HORIZON_UOM, REVIEW_FREQ, ACCU_THRESHOLD, REVIEW_FREQ_UOM, FORECAST_METRIC, BASE_FORECAST, PRECISION_FORECAST, ADJUSTED_FORECAST, ORG_ID, CRON_TRIG_NAME) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) select scope_identity()
    2006-11-01 22:10:00,325 DEBUG [org.hibernate.SQL] - insert into trd0nedbo.TD_FORECAST_PLAN (ORGANIZATION_TBL_ID, USER_TBL_ID, PLAN_NAME, IS_ACTIVE, PLAN_TYPE, TIMECREATED, TIMEUPDATED, START_TIME, END_TIME, HORIZON, HORIZON_UOM, REVIEW_FREQ, ACCU_THRESHOLD, REVIEW_FREQ_UOM, FORECAST_METRIC, BASE_FORECAST, PRECISION_FORECAST, ADJUSTED_FORECAST, ORG_ID, CRON_TRIG_NAME) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) select scope_identity()
    2006-11-01 22:10:00,325 DEBUG [org.hibernate.jdbc.AbstractBatcher] - preparing statement
    2006-11-01 22:10:00,325 DEBUG [org.hibernate.jdbc.AbstractBatcher] - preparing statement
    2006-11-01 22:10:00,325 DEBUG [org.hibernate.persister.entity.BasicEntityPersister] - Dehydrating entity: [com.tdemand.generated.pojo.TdForecastPlan#<null>]
    2006-11-01 22:10:00,325 DEBUG [org.hibernate.persister.entity.BasicEntityPersister] - Dehydrating entity: [com.tdemand.generated.pojo.TdForecastPlan#<null>]
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.LongType] - binding '6' to parameter: 1
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.LongType] - binding '6' to parameter: 1
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.LongType] - binding '1' to parameter: 2
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.LongType] - binding '1' to parameter: 2
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding 'jaikiranpai' to parameter: 3
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding 'jaikiranpai' to parameter: 3
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding 'Y' to parameter: 4
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding 'Y' to parameter: 4
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding 'RetailDCOrderForecast' to parameter: 5
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding 'RetailDCOrderForecast' to parameter: 5
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.TimestampType] - binding '2006-11-01 22:10:00' to parameter: 6
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.TimestampType] - binding '2006-11-01 22:10:00' to parameter: 6
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.TimestampType] - binding null to parameter: 7
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.TimestampType] - binding null to parameter: 7
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.TimestampType] - binding '2006-11-01 22:10:00' to parameter: 8
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.TimestampType] - binding '2006-11-01 22:10:00' to parameter: 8
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.TimestampType] - binding null to parameter: 9
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.TimestampType] - binding null to parameter: 9
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.BigDecimalType] - binding '14' to parameter: 10
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.BigDecimalType] - binding '14' to parameter: 10
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding 'DAY' to parameter: 11
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding 'DAY' to parameter: 11
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.BigDecimalType] - binding '7' to parameter: 12
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.BigDecimalType] - binding '7' to parameter: 12
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.BigDecimalType] - binding '0' to parameter: 13
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.BigDecimalType] - binding '0' to parameter: 13
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding 'DAY' to parameter: 14
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding 'DAY' to parameter: 14
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding 'MAPE' to parameter: 15
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding 'MAPE' to parameter: 15
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding null to parameter: 16
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding null to parameter: 16
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding null to parameter: 17
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding null to parameter: 17
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding null to parameter: 18
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding null to parameter: 18
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.BigDecimalType] - binding null to parameter: 19
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.BigDecimalType] - binding null to parameter: 19
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding null to parameter: 20
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.type.StringType] - binding null to parameter: 20
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.id.IdentifierGeneratorFactory] - Natively generated identity: 103
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.id.IdentifierGeneratorFactory] - Natively generated identity: 103
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.jdbc.AbstractBatcher] - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.jdbc.AbstractBatcher] - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.jdbc.AbstractBatcher] - closing statement
    2006-11-01 22:10:00,341 DEBUG [org.hibernate.jdbc.AbstractBatcher] - closing statement

    "insert into aa values ('1', '2', '3','4','5',6,7);
    if sql%rowcount <> 1 then
    RAISE_APPLICATION_ERROR(-20999, 'insert aa err');
    END IF;
    /* skip some code
    update aa set dept_code = '3' where fee_month = '1';
    if sql%rowcount <> 1 then"
    Is Dept_Code the 2nd Column in the table aa. If so then
    why update the table ?
    Why not Insert Into aa Values ('1', '3', '3' ......);
    Have a look at the sample script which is doing Insert followed by updating the same table using the ROWID.
    Test Db>desc temp;
    Name Null? Type
    COL1 VARCHAR2(10)
    COL2 VARCHAR2(10)
    COL3 VARCHAR2(10)
    COL4 VARCHAR2(10)
    ID NUMBER
    Test Db>select * from temp;
    no rows selected
    Test Db>get t1
    1 Set ServerOutput On Size 999999;
    2 Declare
    3 lRow Varchar2(50);
    4 Begin
    5 Insert Into Temp (Col1, Col2, Col3, Col4, Id)
    6 Values ('A', 'B', 'C', 'D', 100)
    7 RETURNING RowId Into lRow;
    8 Dbms_Output.Put_Line ('RowId = ' || lRow);
    9 Update Temp Set col2 = 'B1'
    10 Where RowId = lRow;
    11 Dbms_Output.Put_Line ('Row Updated');
    12* End;
    13 /
    Test Db>@t1
    RowId = AAAKsqAAJAAAEbsAAG
    Row Updated
    PL/SQL procedure successfully completed.
    Test Db>select * from temp;
    COL1 COL2 COL3 COL4 ID
    A B1 C D 100
    -- Shailender Mehta --

  • SQL insert statement in java with Excel file

    Dear all,
    I wrote a program is as the follow:
    import java.io.*;
    import java.sql.*;
    public class handleExcel
         Connection con = null;
         Statement stmnt = null;
         public handleExcel()
              String excel = "C:\\EGS\\app_files\\info_update_form_exported_data.xls";
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   String str="jdbc:odbc:DRIVER=Microsoft Excel Driver (*.xls);DBQ=" + excel + ";";
         String sql = "insert into [Sheet1$] (Name, Age, Test1, Test2, Test3) values ('mary','16','aa','bb','vv')";
                   con = DriverManager.getConnection(str, "", "");
                   stmnt = con.createStatement();
                   stmnt.executeUpdate(sql);
              catch(Exception e)
                   System.out.println("con is error!!");
                   e.printStackTrace();
         public static void main(String[] args)
              handleExcel TestHpc = new handleExcel();
    But when I run it, the error is as the follow:
    java.sql.SQLException: [Microsoft][ODBC Excel Driver]
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
         at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
         at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
         at hk.gov.edb.util.handleExcel.<init>(handleExcel.java:31)
         at hk.gov.edb.util.handleExcel.main(handleExcel.java:97)
    Please help me to solve this problem. Thank you so much for your help!
    Regards,
    kzyo

    Hi
    You can use the[b] jakarta POI api in order to read/write Excel file from java. Pure Java, no drivers nedeed.
    I tested and ok.
    Hope this helps

  • Error message: "Java Script turned off, Enable Java Script" How to do this? I have gone into "Tools--then Options--Then checked Java Script--Then the "OK/Save" Button but this has not helped. What is the right course of action?

    Java Script is disabled on my HP laptop. I have done the obvious things. It still will not enable Java Script. What do I try next?

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]
    * [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

  • How to set (default )copy paste func. to ctrl+insert to textfield.java 1.5

    how do I set default
    copy func. to ctrl+insert
    paste function shift+insert
    to a textfield in java 1.5

    Quit multi-posting the same question:
    http://forum.java.sun.com/thread.jspa?threadID=5183891&tstart=0

  • ASP insert then get newly created autonumber

    I'm using ASP Javascript & Access 2003 & Dreamweaver
    8
    I want to insert a new record then grab the autonumber that
    was generated for that record and pass it as a session variable to
    the next page. From what I have read in this and many other forums
    I can use "Select @@Identity as Identity" to do this. However, I
    don't know where to place it in my code. I've tried placing it in
    several locations but it hasn't worked. I figure it needs to go
    before "MM_editCmd.ActiveConnection.Close();" to grab the right
    record. If anyone can help me I would soooo appreciate it. OR if
    you have an even better solution I would still sooooo appreciate
    it. I know I can use "Select Max(column)" but I want to make sure
    the user isn't grabbing a record that was created miliseconds after
    they created theirs. Here is the code:
    <%
    // *** Edit Operations: declare variables
    // set the form action variable
    var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
    if (Request.QueryString) {
    MM_editAction += "?" +
    Server.HTMLEncode(Request.QueryString);
    // boolean to abort record edit
    var MM_abortEdit = false;
    %>
    <%
    if (String(Request("MM_insert")) == "form1") {
    if (!MM_abortEdit) {
    // execute the insert
    var MM_editCmd = Server.CreateObject ("ADODB.Command");
    MM_editCmd.ActiveConnection = MM_Christmas_STRING;
    MM_editCmd.CommandText = "INSERT INTO tbl_Head (H_FName,
    H_LName, H_MAdd1, H_MAdd2, H_MCity, H_MState, H_MZip, H_Phone,
    H_Address1, H_Address2, H_City, H_State, H_Zip, H_Directions, H_SS,
    H_DOB, H_Sex, H_Race, H_Comments, H_Employer, H_ShirtSize,
    H_PantSize, H_ShoeSize, H_Special) VALUES (?, ?, ?, ?, ?, ?, ?, ?,
    MM_editCmd.Prepared = true;
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param1",
    202, 1, 50, trim(Request.Form("H_FName")))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param2",
    202, 1, 50, Request.Form("H_LName"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param3",
    202, 1, 50, Request.Form("H_MAdd1"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param4",
    202, 1, 50, Request.Form("H_MAdd2"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param5",
    202, 1, 50, Request.Form("H_MCity"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param6",
    202, 1, 50, Request.Form("H_MState"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param7",
    202, 1, 50, Request.Form("H_MZip"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param8",
    202, 1, 50, Request.Form("H_Phone"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param9",
    202, 1, 50, Request.Form("H_Address1"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param10",
    202, 1, 50, Request.Form("H_Address2"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param11",
    202, 1, 50, Request.Form("H_City"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param12",
    202, 1, 50, Request.Form("H_State"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param13",
    202, 1, 50, Request.Form("H_Zip"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param14",
    203, 1, 1073741823, Request.Form("H_Directions"))); //
    adLongVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param15",
    202, 1, 50, Request.Form("H_SS"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param16",
    135, 1, -1, (String(Request.Form("H_DOB")) != "undefined"
    && String(Request.Form("H_DOB")) != "") ?
    Request.Form("H_DOB") : null)); // adDBTimeStamp
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param17",
    202, 1, 50, Request.Form("H_Sex"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param18",
    5, 1, -1, (String(Request.Form("H_Race")) != "undefined" &&
    String(Request.Form("H_Race")) != "") ? Request.Form("H_Race") :
    null)); // adDouble
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param19",
    203, 1, 1073741823, Request.Form("H_Comments"))); // adLongVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param20",
    202, 1, 50, Request.Form("H_Employer"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param21",
    202, 1, 50, Request.Form("H_ShirtSize"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param22",
    202, 1, 50, Request.Form("H_PantSize"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param23",
    202, 1, 50, Request.Form("H_ShoeSize"))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param24",
    203, 1, 1073741823, Request.Form("H_Special"))); // adLongVarWChar
    MM_editCmd.Execute();
    MM_editCmd.ActiveConnection.Close();
    // append the query string to the redirect URL
    var MM_editRedirectUrl = "redirect_insert_head.asp";
    if (MM_editRedirectUrl && Request.Form &&
    Request.Form.Count > 0) {
    MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') ==
    -1) ? "?" : "&")+ Request.Form;
    Response.Redirect(MM_editRedirectUrl)
    %>
    many thanks,
    Winona

    If you can get it to work, try this. This is the wrong way to
    do this,
    but take a unique value from the submitted content (say
    email) and query
    the db for the newest record with that value. In your case,
    SS would
    work (if it is required).
    Or you can try:
    http://www.tom-muck.com/extensions/help/insertretrieve/
    Or, write your own INSERT statement and plug Select
    @@Identity as
    Identity in the appropriate spot.
    Winona wrote:
    > I'm using ASP Javascript & Access 2003 &
    Dreamweaver 8
    >
    > I want to insert a new record then grab the autonumber
    that was generated for
    > that record and pass it as a session variable to the
    next page. From what I
    > have read in this and many other forums I can use
    "Select @@Identity as
    > Identity" to do this. However, I don't know where to
    place it in my code.
    > I've tried placing it in several locations but it hasn't
    worked. I figure it
    > needs to go before
    "MM_editCmd.ActiveConnection.Close();" to grab the right
    > record. If anyone can help me I would soooo appreciate
    it. OR if you have an
    > even better solution I would still sooooo appreciate it.
    I know I can use
    > "Select Max(column)" but I want to make sure the user
    isn't grabbing a record
    > that was created miliseconds after they created theirs.
    Here is the code:
    >
    > <%
    > // *** Edit Operations: declare variables
    >
    > // set the form action variable
    > var MM_editAction =
    Request.ServerVariables("SCRIPT_NAME");
    > if (Request.QueryString) {
    > MM_editAction += "?" +
    Server.HTMLEncode(Request.QueryString);
    > }
    >
    > // boolean to abort record edit
    > var MM_abortEdit = false;
    > %>
    > <%
    > if (String(Request("MM_insert")) == "form1") {
    > if (!MM_abortEdit) {
    > // execute the insert
    >
    > var MM_editCmd = Server.CreateObject ("ADODB.Command");
    > MM_editCmd.ActiveConnection = MM_Christmas_STRING;
    > MM_editCmd.CommandText = "INSERT INTO tbl_Head (H_FName,
    H_LName, H_MAdd1,
    > H_MAdd2, H_MCity, H_MState, H_MZip, H_Phone, H_Address1,
    H_Address2, H_City,
    > H_State, H_Zip, H_Directions, H_SS, H_DOB, H_Sex,
    H_Race, H_Comments,
    > H_Employer, H_ShirtSize, H_PantSize, H_ShoeSize,
    H_Special) VALUES (?, ?, ?, ?,
    > ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
    > MM_editCmd.Prepared = true;
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param1",
    202, 1,
    > 50, trim(Request.Form("H_FName")))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param2",
    202, 1,
    > 50, Request.Form("H_LName"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param3",
    202, 1,
    > 50, Request.Form("H_MAdd1"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param4",
    202, 1,
    > 50, Request.Form("H_MAdd2"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param5",
    202, 1,
    > 50, Request.Form("H_MCity"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param6",
    202, 1,
    > 50, Request.Form("H_MState"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param7",
    202, 1,
    > 50, Request.Form("H_MZip"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param8",
    202, 1,
    > 50, Request.Form("H_Phone"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param9",
    202, 1,
    > 50, Request.Form("H_Address1"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param10",
    202, 1,
    > 50, Request.Form("H_Address2"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param11",
    202, 1,
    > 50, Request.Form("H_City"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param12",
    202, 1,
    > 50, Request.Form("H_State"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param13",
    202, 1,
    > 50, Request.Form("H_Zip"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param14",
    203, 1,
    > 1073741823, Request.Form("H_Directions"))); //
    adLongVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param15",
    202, 1,
    > 50, Request.Form("H_SS"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param16",
    135, 1,
    > -1, (String(Request.Form("H_DOB")) != "undefined"
    > String(Request.Form("H_DOB")) != "") ?
    Request.Form("H_DOB") : null)); //
    > adDBTimeStamp
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param17",
    202, 1,
    > 50, Request.Form("H_Sex"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param18",
    5, 1,
    > -1, (String(Request.Form("H_Race")) != "undefined"
    > String(Request.Form("H_Race")) != "") ?
    Request.Form("H_Race") : null)); //
    > adDouble
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param19",
    203, 1,
    > 1073741823, Request.Form("H_Comments"))); //
    adLongVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param20",
    202, 1,
    > 50, Request.Form("H_Employer"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param21",
    202, 1,
    > 50, Request.Form("H_ShirtSize"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param22",
    202, 1,
    > 50, Request.Form("H_PantSize"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param23",
    202, 1,
    > 50, Request.Form("H_ShoeSize"))); // adVarWChar
    >
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param24",
    203, 1,
    > 1073741823, Request.Form("H_Special"))); //
    adLongVarWChar
    > MM_editCmd.Execute();
    > MM_editCmd.ActiveConnection.Close();
    >
    > // append the query string to the redirect URL
    > var MM_editRedirectUrl = "redirect_insert_head.asp";
    > if (MM_editRedirectUrl && Request.Form
    && Request.Form.Count > 0) {
    > MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?')
    == -1) ? "?" :
    > "&")+ Request.Form;
    > }
    > Response.Redirect(MM_editRedirectUrl)
    > }
    > }
    > %>
    >
    > many thanks,
    > Winona
    >

  • Insert then query

    I have a small CFM application on our server. It worked well
    for several years. However, we just upgraded the coldfusion server
    and one item is not working.
    I used to have folks fill out a form. The data was inserted
    into the database. I would query the database on the same page in
    which I did the insertion and all was fine....every record was
    available.
    Now, however, when I query the database after the insertion,
    all records up to the lastest insertion are reflected. In other
    words, the page insertion data is not reflected in the query.
    However, the data is successfully inserted. (Inspection with other
    methods indicates the data was successfully inserted.)
    Here is a scaled down code snippet.
    <cfinsert datasource=#WList_DSN# tablename="Wait"
    formFields="Fname,
    Lname,
    Snumber,
    Course,
    Password,
    Phone,
    Email">
    <cfquery name="get_position" datasource=#WList_DSN#
    username=#WList_USERNAME# password=#WList_PASSWORD#>
    SELECT ID, Fname, Lname, Snumber, Phone, Email FROM Wait
    WHERE Course = '#form.Course#'
    ORDER by ID
    </cfquery>
    <html>
    <head>
    <title>Test Page</title>
    <body>
    <cfoutput query="get_data">
    #FNAME# #LNANE#<br>
    </cfoutput>
    </body>
    </html>
    #FNAME# and #LNAME# in the output show each record in the
    database except for the one just inserted. Is there a way to remedy
    this? I want to conduct the query on the same page as the
    insertion, if at all possible.
    Any help would be greatly appreciated.
    Thanks...

    Thanks guys. I had a feeling the database might be updating
    slowly so I placed a pause between the insert andf query. The code
    then performed like before. I have incorporated the somewhat
    awkward 5 second pause between insert and query into the final code
    and things are working okay.
    I'm amazed, though, that the software update took a near
    instantaneous database update and slowed it to a nearly 5 second
    update situation.

  • I need help writing an if then statement Java Script.

    In the Text Field Properties box I see the Calculate tab where I think that the form can do a logic (IF/THEN) function if I can place the correct Java Script code into the form. Unfortunately; I do not know how to write in Java Script.
         - I have a form with a field identifier called BACompnayAddress (this is the field where they would enter their address).
         - I then have a form field with two radials that says "Is the shipping address the same as the business Address" - "Yes" and "No" (the form identified for the radials is SASame.
    What I am trying to accomplish:
         - If they click Yes, I would like the Shipping Address field (field identifiier ShippingAddressAddress) to fill in the information found in BACompanyAddress and if they click No leave the  field blank to be filled out by the person filling out the form.
    I appreciate any help.
    Thanks,
    Brett

    If that's what it does, that is exactly what you said it needs to do. You said niothing about what should cause it to go back to frame 1.  If you want it to go back to frame 1 with a ROLL_OUT event, then you would add a listener for that. If you want something else to trigger it to go back, then you just need to work that out.
    The only time I can see where an if/else would be needed is if you want it to change frames for every rollover such that if it is in frame 1, then go to frame 2, and vice versa the next time you rollover it.

  • Insert then stored procedure

    Hi All:
    I am inserting through the toplink UOW and before commiting I am calling the stored procedure (SP). This SP require the toplink inserted data. But as commit is not done, inserted data is not available in the database. Also, I can not commit the toplink UOW for insert and then call then SP because this all happen in one go or not.
    TIA
    Regards,
    Viral

    There is a prepareUnitOfWork session event that is fired after the data has been written to the database but before the transaction has been committed. Executing your stored procedure at this point should provide the correct behaviour.
    --Gordon                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Weird Time Issue

    We're experiencing a weird issue with our unity server. The time on our unity server is ahead by one hour, yet our callmanager server is on time. If I go into windows time and correct the time on the unity server, I am unable to dial into the voicema

  • Unable to register service Error while deployment

    Hi All, I am getting the following error while deploying. I have attached the log details and the WSDL. Please suggest how to resolve this error. 2010-07-26T17:11:37.828+10:00] [soa_server1] [NOTIFICATION] [SOA-21046] [oracle.integration.platform.blo

  • Can I uninstall and reinstall "Pages" without losing files?

    My Pages program may be, ...IS, ...corrupted.  (Maybe by a disgruntled co-worker?)  When I type a client's name, Pages automatically misspells it.  Same with my own name, and perhaps with other words I've not yet discovered. I suppose I should uninst

  • Missing fields in subject area in vanilla rpd.

    Hi, I am trying to create a Dsicoverer report in OBIEE. The report is Vendor Bank Account information. I am unable to find any bank account information in the subject areas that came in the vanilla rpd. Is there any subject area that would fit my nee

  • Retrieving records using SQL Date Queries

    Hello, I am using Lab Windows CVI 8.5 and also SQL TOolkit for my project. I am using DBMapColumnToChar function for mapping Date to the database. And for retrieving records I am using SQL Query as follows: SELECT * FROM DBTable WHERE DATE_TABLE BETW