Dirty Writes to the database

I have a value object which was originally populated with information from database. I have a requirement to update ONLY the data that was changed in the value object. I could come up with something clever to do it myself, or I could use an existing pattern and Java API to accomplish this task. I prefer using an existing API.
If there are any APIs out there that solve this problem, please let me know. Thanks in advance!

I don't think that's the question here.
I think the question is...
Let's say four fields. One field gets updated.
Only the one updated field gets updated to the
database not a generic update for all four.Two situations.....
1. I have a section of the application that updates
ONLY that field. If so then I only update that
field. There never can be a conflict. Consequently
there is no need to discuss update strategies.
2. I have a section of the application that updates
that field and one other. Some other part of the
application can update that other field. Given
nothing more than that the two fields can be updated,
there is no way to determine which one is correct.
So you either find another rule or just use 'last
t one wins' (which means discussing strategies for
updates are meaningless.)I don't think we're talking about conflict resolution strategies. Well you are but I don't think the OP was. I think the OP is just talking about speeding up the serialization of an objects state to a database by not updating fields that haven't been modified.
I don't disagree with what you are saying per se but I just don't see update conflict resolution listed as an issue by the OP.

Similar Messages

  • Can multiple threads write to the database?

    I am a little confused from the statement in the documentation: "Berkeley DB Data Store does not support locking, and hence does not guarantee correct behavior if more than one thread of control is updating the database at a time."
    1. Can multiple threads write to the "Simple Data Store"?
    2. Considering the sample code below which writes to the DB using 5 threads - is there a possibility of data loss?
    3. If the code will cause data loss, will adding DB_INIT_LOCK and/or DB_INIT_TXN in DBENV->open make any difference?
    #include "stdafx.h"
    #include <stdio.h>
    #include <windows.h>
    #include <db.h>
    static DB *db = NULL;
    static DB_ENV *dbEnv = NULL;
    DWORD WINAPI th_write(LPVOID lpParam)
    DBT key, data;
    char key_buff[32], data_buff[32];
    DWORD i;
    printf("thread(%s) - start\n", lpParam);
    for (i = 0; i < 200; ++i)
    memset(&key, 0, sizeof(key));
    memset(&data, 0, sizeof(data));
    sprintf(key_buff, "K:%s", lpParam);
    sprintf(data_buff, "D:%s:%8d", lpParam, i);
    key.data = key_buff;
    key.size = strlen(key_buff);
    data.data = data_buff;
    data.size = strlen(data_buff);
    db->put(db, NULL, &key, &data, 0);
    Sleep(5);
    printf("thread(%s) - End\n", lpParam);
    return 0;
    int main()
    db_env_create(&dbEnv, 0);
    dbEnv->open(dbEnv, NULL, DB_CREATE | DB_INIT_MPOOL | DB_THREAD, 0);
    db_create(&db, dbEnv, 0);
    db->open(db, NULL, "test.db", NULL, DB_BTREE, DB_CREATE, 0);
    CreateThread(NULL, 0, th_write, "A", 0, 0);
    CreateThread(NULL, 0, th_write, "B", 0, 0);
    CreateThread(NULL, 0, th_write, "B", 0, 0);
    CreateThread(NULL, 0, th_write, "C", 0, 0);
    th_write("C");
    Sleep(2000);
    }

    Here some clarification about BDB Lock and Multi threads behavior
    Question 1. Can multiple threads write to the "Simple Data Store"?
    Answer 1.
    Please Refer to http://docs.oracle.com/cd/E17076_02/html/programmer_reference/intro_products.html
    A Data Store (DS) set up
    (so not using an environment or using one, but without any of the DB_INIT_LOCK, DB_INIT_TXN, DB_INIT_LOG environment regions related flags specified
    each corresponding to the appropriate subsystem, locking, transaction, logging)
    will not guard against data corruption due to accessing the same database page and overwriting the same records, corrupting the internal structure of the database etc.
    (note that in the case of the Btree, Hash and Recno access methods we lock at the database page level, only for the Queue access method we lock at record level)
    So,
    if You want to have multiple threads in the application writing concurrently or in parallel to the same database You need to use locking (and properly handle any potential deadlocks),
    otherwise You risk corrupting the data itself or the database (its internal structure).
    Of course , If You serialize at the application level the access to the database, so that no more one threads writes to the database at a time, there will be no need for locking.
    But obviously this is likely not the behavior You want.
    Hence, You need to use either a CDS (Concurrent Data Store) or TDS (Transactional Data Store) set up.
    See the table comparing the various set ups, here: http://docs.oracle.com/cd/E17076_02/html/programmer_reference/intro_products.html
    Berkeley DB Data Store
    The Berkeley DB Data Store product is an embeddable, high-performance data store. This product supports multiple concurrent threads of control, including multiple processes and multiple threads of control within a process. However, Berkeley DB Data Store does not support locking, and hence does not guarantee correct behavior if more than one thread of control is updating the database at a time. The Berkeley DB Data Store is intended for use in read-only applications or applications which can guarantee no more than one thread of control updates the database at a time.
    Berkeley DB Concurrent Data Store
    The Berkeley DB Concurrent Data Store product adds multiple-reader, single writer capabilities to the Berkeley DB Data Store product. This product provides built-in concurrency and locking feature. Berkeley DB Concurrent Data Store is intended for applications that need support for concurrent updates to a database that is largely used for reading.
    Berkeley DB Transactional Data Store
    The Berkeley DB Transactional Data Store product adds support for transactions and database recovery. Berkeley DB Transactional Data Store is intended for applications that require industrial-strength database services, including excellent performance under high-concurrency workloads of read and write operations, the ability to commit or roll back multiple changes to the database at a single instant, and the guarantee that in the event of a catastrophic system or hardware failure, all committed database changes are preserved.
    So, clearly DS is not a solution for this case, where multiple threads need to write simultaneously to the database.
    CDS (Concurrent Data Store) provides locking features, but only for multiple-reader/single-writer scenarios. You use CDS when you specify the DB_INIT_CDB flag when opening the BDB environment: http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envopen.html#envopen_DB_INIT_CDB
    TDS (Transactional Data Store) provides locking features, adds complete ACID support for transactions and offers recoverability guarantees. You use TDS when you specify the DB_INIT_TXN and DB_INIT_LOG flags when opening the environment. To have locking support, you would need to also specify the DB_INIT_LOCK flag.
    Now, since the requirement is to have multiple writers (multi-threaded writes to the database),
    then TDS would be the way to go (CDS is useful only in single-writer scenarios, when there are no needs for recoverability).
    To Summarize
    The best way to have an understanding of what set up is needed, it is to answer the following questions:
    - What is the data access scenario? Is it multiple writer threads? Will the writers access the database simultaneously?
    - Are recoverability/data durability, atomicity of operations and data isolation important for the application? http://docs.oracle.com/cd/E17076_02/html/programmer_reference/transapp_why.html
    If the answers are yes, then TDS should be used, and the environment should be opened like this:
    dbEnv->open(dbEnv, ENV_HOME, DB_CREATE | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN | DB_INIT_LOG | DB_RECOVER | DB_THREAD, 0);
    (where ENV_HOME is the filesystem directory where the BDB environment will be created)
    Question 2. Considering the sample code below which writes to the DB using 5 threads - is there a possibility of data loss?
    Answer 2.
    Definitely yes, You can see data loss and/or data corruption.
    You can check the behavior of your testcase in the following way
    1. Run your testcase
    2.After the program exits
    run db_verify to verify the database (db_verify -o test.db).
    You will likely see db_verify complaining, unless the thread scheduler on Windows weirdly starts each thread one after the other,
    IOW no two or ore threads write to the database at the same time -- kind of serializing the writes
    Question 3. If the code will cause data loss, will adding DB_INIT_LOCK and/or DB_INIT_TXN in DBENV->open make any difference?
    Answer 3.
    In Your case the TDS should be used, and the environment should be opened like this:
    dbEnv->open(dbEnv, ENV_HOME, DB_CREATE | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN | DB_INIT_LOG | DB_RECOVER | DB_THREAD, 0);
    (where ENV_HOME is the filesystem directory where the BDB environment will be created)
    doing this You have proper deadlock handling in place and proper transaction usage
    so
    You are protected against potential data corruption/data loss.
    see http://docs.oracle.com/cd/E17076_02/html/gsg_txn/C/BerkeleyDB-Core-C-Txn.pdf
    Multi-threaded and Multi-process Applications
    DB is designed to support multi-threaded and multi-process applications, but their usage
    means you must pay careful attention to issues of concurrency. Transactions help your
    application's concurrency by providing various levels of isolation for your threads of control. In
    addition, DB provides mechanisms that allow you to detect and respond to deadlocks.
    Isolation means that database modifications made by one transaction will not normally be
    seen by readers from another transaction until the first commits its changes. Different threads
    use different transaction handles, so this mechanism is normally used to provide isolation
    between database operations performed by different threads.
    Note that DB supports different isolation levels. For example, you can configure your
    application to see uncommitted reads, which means that one transaction can see data that
    has been modified but not yet committed by another transaction. Doing this might mean
    your transaction reads data "dirtied" by another transaction, but which subsequently might
    change before that other transaction commits its changes. On the other hand, lowering your
    isolation requirements means that your application can experience improved throughput due
    to reduced lock contention.
    For more information on concurrency, on managing isolation levels, and on deadlock
    detection, see Concurrency (page 32).

  • Write to the database from a BI Publisher report

    I have a requirement to setup a BI Publisher report that writes a snapshot of data to a database table whenever the report is run.
    Putting aside whether doing this is a good idea or not (I'd prefer not to do it for security reasons) if I were to do it in SQL server (that i'm more familiar with) I'd write a stored procedure that does this and enter "exec storedprocedurename" as the report query.
    From searching through this board I see that I'm supposed to use a pipelined function instead of a stored procedure but I'm unclear if once I have setup the pipelined function that I'll be able to achieve my objective of both returning the data to the report as well as writing it to a snapshot table, is this possible? If so then I have some questions as I don't really understand the syntax with my limited pl/sql knowledge.
    create type numset_t as table of number; --where does this go, it doesn't appear to be part of the function?
    create function f1(x number) return numset_t pipelined is
    begin
    for i in 1..x loop
    pipe row(i);
    end loop; -- do I need to do a looP? i just want to do select *...
    return;
    end;
    select * from table(f1(3)); -- again this appears to be outside the function, where does it go?
    Thanks
    Bruce

    Jorge:
    I was looking into something similar some time ago. The suggested solution may or may not work for you, depending on what it is you want to write to the tables. I was trying to write audit information - who ran what report when. Through BI Publisher template variables I could get the who and the when, but not what report was being run, so the report trigger option wasn't of any use to me.
    In the end, I opted to change the attributes of the report so that the "show controls" checkbox is unchecked and make users run all reports through BI Publisher Scheduler. It turns out that reports run via the scheduler have all of that data saved off and you can see it from the Schedules/History display.
    Good luck,
    Gaff

  • Database write using the Database Adapter

    i'm using Jdeveloper version 11.1.1.3.37.55.99 - and I'm not sure that I'm doing this right but:
    I've created a database table that has 3 attributes (id, name, description).
    I've then in the soa composite created a Database Adapter to have an insert operation for the newly created database table.
    In the BPM editor - I drag a service task into the process and configure it to use the recently created Database Adapter.
    While configuring the service task - I need to map my process variables into the service task but when I go to the
    implementation->use associations->simple, in the drag and drop plan is an object called a collection. I expand the collection and I get an object named recall. If I look at my datatypes my recall object shows the three attributes from the database schema for the table. (The datatype was created by the creation of the database adapter). However, I cannot expand the object in order to map in the individual process variables for the inputs for the insert parameters.
    Am I doing something incorrectly in attempting to map the process variables to the service call?
    Thanks,
    Christopher

    Christopher,
    Use the Transform in the Implementation tab instead of the Data Association to map your input process object to the service parameter. The Transform option creates an xslt file which you can use to map the input values to the database service values.
    Heidi.

  • Cannot write to the database

    I am using MySql 4.0 with Kodo.
    For the tutorials I can get pretty good result. But when I tried my own
    database, I can only browse but cannot write. when I write a new data
    item, the below exceptions popped up:
    kodo.util.FatalDataStoreException: The transaction has been rolled back.
    See the nested exceptions for details on the errors that occurred.
         at
    kodo.runtime.PersistenceManagerImpl.throwFlushException(PersistenceManagerImpl.java:1297)
         at
    kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:1159)
         at
    kodo.runtime.PersistenceManagerImpl.flushSafe(PersistenceManagerImpl.java:1042)
         at
    kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:969)
         at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
         at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:629)
         at reversetutorial.Finder.executeCreatQuery(Finder.java:108)
         at reversetutorial.Finder.main(Finder.java:44)
    NestedThrowablesStackTrace:
    kodo.util.DataStoreException: You have an error in your SQL syntax. Check
    the manual that corresponds to your MySQL server version for the right
    syntax to use near 'key, value) VALUES ('test', '50')' at line 1
    {prepstmnt 849515 INSERT INTO ns_config (key, value) VALUES (?, ?)
    [reused=0]} [code=1064, state=42000]
         at
    kodo.jdbc.sql.DBDictionary.newDataStoreException(DBDictionary.java:3400)
         at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:77)
         at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:63)
         at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:43)
         at
    kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.java:210)
         at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:220)
         at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:95)
         at kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:614)
         at
    kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:153)
         at
    kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:1159)
         at
    kodo.runtime.PersistenceManagerImpl.flushSafe(PersistenceManagerImpl.java:1042)
         at
    kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:969)
         at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
         at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:629)
         at reversetutorial.Finder.executeCreatQuery(Finder.java:108)
         at reversetutorial.Finder.main(Finder.java:44)
    NestedThrowablesStackTrace:
    com.solarmetric.jdbc.ReportingSQLException: You have an error in your SQL
    syntax. Check the manual that corresponds to your MySQL server version
    for the right syntax to use near 'key, value) VALUES ('test', '50')' at
    line 1 {prepstmnt 849515 INSERT INTO ns_config (key, value) VALUES (?, ?)
    [reused=0]} [code=1064, state=42000]
         at
    com.solarmetric.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:124)
         at
    com.solarmetric.jdbc.LoggingConnectionDecorator.access$600(LoggingConnectionDecorator.java:19)
         at
    com.solarmetric.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(LoggingConnectionDecorator.java:728)
         at
    com.solarmetric.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:362)
         at
    kodo.jdbc.runtime.JDBCStoreManager$CancelPreparedStatement.executeUpdate(JDBCStoreManager.java:1716)
         at
    kodo.jdbc.runtime.PreparedStatementManager.flushInternal(PreparedStatementManager.java:235)
         at
    kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.java:206)
         at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:220)
         at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:95)
         at kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:614)
         at
    kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:153)
         at
    kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:1159)
         at
    kodo.runtime.PersistenceManagerImpl.flushSafe(PersistenceManagerImpl.java:1042)
         at
    kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:969)
         at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
         at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:629)
         at reversetutorial.Finder.executeCreatQuery(Finder.java:108)
         at reversetutorial.Finder.main(Finder.java:44)
    java.sql.SQLException: You have an error in your SQL syntax. Check the
    manual that corresponds to your MySQL server version for the right syntax
    to use near 'key, value) VALUES ('test', '50')' at line 1
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2921)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2978)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
         at
    com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:930)
         at
    com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1159)
         at
    com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1076)
         at
    com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1061)
         at
    com.solarmetric.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:362)
         at
    com.solarmetric.jdbc.PoolConnection$PoolPreparedStatement.executeUpdate(PoolConnection.java:358)
         at
    com.solarmetric.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:362)
         at
    com.solarmetric.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:362)
         at
    com.solarmetric.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:362)
         at
    com.solarmetric.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(LoggingConnectionDecorator.java:724)
         at
    com.solarmetric.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:362)
         at
    kodo.jdbc.runtime.JDBCStoreManager$CancelPreparedStatement.executeUpdate(JDBCStoreManager.java:1716)
         at
    kodo.jdbc.runtime.PreparedStatementManager.flushInternal(PreparedStatementManager.java:235)
         at
    kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.java:206)
         at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:220)
         at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:95)
         at kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:614)
         at
    kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:153)
         at
    kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:1159)
         at
    kodo.runtime.PersistenceManagerImpl.flushSafe(PersistenceManagerImpl.java:1042)
         at
    kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:969)
         at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
         at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:629)
         at reversetutorial.Finder.executeCreatQuery(Finder.java:108)
         at reversetutorial.Finder.main(Finder.java:44)
    Exception in thread "main"
    This is not a problem of Database version.
    I found the sql statement that Kodo generated is like:
    insert into ns_config (key, value) values ("test","50")
    this is not correct, the correct should be:
    insert into ns_config (`key`, `value`) values ('test','50')
    but I found the script created with reversemappingtool is all correct
    (with the ` symbol in the statement).
    So this problem really caught me.
    ps: below is the java code I use for testing:
    1. Finder.java
    package reversetutorial;
    import java.lang.reflect.Constructor;
    import java.util.*;
    import javax.jdo.*;
    import kodo.runtime.*;
    public class Finder
         *     Usage: java reversetutorial.Finder <JDOQL query>
         public static void main (String[] args)
              if (args.length != 1)
                   System.err.println ("Usage: java reversetutorial.Finder "
                        + "<JDOQL query>");
                   return;
                   executeCreatQuery();
         private static void executeCreatQuery ()
              Constructor[] constructors = NsConfig.class.getDeclaredConstructors
              for (int i = 0; i < constructors.length; i++)
                        // Find an appropriate constructor.
                   Class[] paramTypes = constructors.getParameterTypes ();
                   if (paramTypes.length == 2 &&
                             paramTypes[0] == String.class)
                        Object[] params = new Object[] {
                             "test", "50"
                        Object newObject = null;
                        try
                        newObject = constructors[i].newInstance (params);
                        } catch (Exception e) {
                             System.out.println("error!");
                        PersistenceManagerFactory pmf =
              KodoHelper.getPersistenceManagerFactory
    ("kodo.properties");
              PersistenceManager pm = pmf.getPersistenceManager ();
                        Transaction tx = pm.currentTransaction();
                        tx.begin();
                        pm.makePersistent(newObject);
                        tx.commit();
                        pm.close ();
                        pmf.close ();
    2. NsConfig.java
    package reversetutorial;
    * Auto-generated by:
    * kodo.jdbc.meta.ReverseMappingTool$ReverseCodeGenerator
    public class NsConfig {
         private String key;
         private String value;
         public NsConfig() {
         public NsConfig(String key, String value) {
              this.key = key;
              this.value = value;
         public String getKey() {
              return key;
         public void setKey(String key) {
              this.key = key;
         public String getValue() {
              return value;
         public void setValue(String value) {
              this.value = value;

    Odd. My guess is that maybe "key" is a reserved word in MySQL 4, but
    was allowed during table creation for some reason. I assume this is a
    fresh DB created by Kodo? If so, I would drop it, delete the .mapping
    files for the classes, and start over after setting the following
    configuration property:
    kodo.jdbc.DBDictionary: ReservedWords=KEY

  • Write-lock the complete database

    Hello,
    One of my transactions changes many records in the database and often I need 30 and
    more tries, until the transaction is done without deadlocks.
    Is there a chance to simply write-lock the database (and block other transaction) until this
    expensive transaction has finished?
    Is this impossible?
    Thank you very much
    Josef

    Hi Josef,
    I would suggest starting by reviewing the information in chapters 9 and 14 in the Reference Guide ("Berkeley DB Transactional Data Store Applications", "The Locking Subsystem"):
    http://www.oracle.com/technology/documentation/berkeley-db/db/ref/toc.html
    and specifically the following links:
    http://www.oracle.com/technology/documentation/berkeley-db/db/ref/transapp/read.html
    http://www.oracle.com/technology/documentation/berkeley-db/db/ref/transapp/deadlock.html
    http://www.oracle.com/technology/documentation/berkeley-db/db/ref/transapp/tune.html
    If your application behavior allows for multiple-reader/single writer access to the database then you might want to consider setting up with CDS (Concurrent Data Store); this is presented in chapter 8 in the Reference Guide ("Berkeley DB Concurrent Data Store Applications").
    The above documentation should help you resolve this; if not, provide more information on how your application performs work (i.e. how many threads are writing concurrently, if you're using transactional cursors for writing, if you enclose reads in transactions, if you read records, analyze them and subsequently update them, what flags are set for transactions, databases, etc).
    Regards,
    Andrei

  • Trying to configure syslog process,to write the database audit logs

    Folks,
    Running Oracle 10g R2 on Sun Solaris v 10.
    I am trying to configure my database environment, so it will write all the database audit logs to a location, where Oracle userid on unix cannot modify/delete it.
    To accomplish my goal, so far I have done the following:
    I have set the following parameter with these values
    audit_file_dest /flood/u01/app/oracle/product/10.2.0/db_1/rdbms/audit
    audit_sys_operations TRUE
    audit_trail OS
    Also I asked my system administrator , to make an entry in the syslog.conf file at location /etc
    He made the following entry
    local3.notice /var/log/oraaudit.log
    and restarted the syslog process
    I also made the following entry
    alter system set audit_syslog_level='LOCAL3.NOTICE' scope=spfile and bounced the database.
    But after starting the database, i will don't see any oraaudit.log file at the location /var/log
    Any help will be much appreciated.
    Regards
    Ashish

    Hello Srini,
    I mentioned in my posting , that I already set AUDIT_SYSLOG_LEVEL=LEVEL3.NOTICE value.
    Also the permission on /var/log is such the Oracle unix userid cannot write to it and that is what I want. Since if Oracle userid can write, it can modify/delete the audit log also , which we are trying to prevent.
    Thanks
    Ashish

  • How to import an .csv file into the database?

    and can we code the program in JSP to import the.csv file into the database.

    It is better to use Java class to read the CSV file and store the contents in the database.
    You can use JSP to upload the CSV file to the server if you want, but don't use it to perform database operations.
    JSPs are good for displaying information on the front-end, and for displaying HTML forms, there are other technologies more suitable for the middle layer, back end and the database layer.
    So break you application into
    1) Front end - JSPs to display input html forms and to display data retrieved from the database.
    2) Middle layer - Servlets and JavaBeans to interact with JSPs. The code that reads the CSV file to parse it's contents should be a Java Class in the middle layer. It makes use of Java File I/O
    3) Database layer - Connects to the database using JDBC (Java Database Connectivity), and then writes to the database with SQL insert statements.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Keeping the above concepts in mind, first build a simple JSP and get it to work,
    then research on Google , for Java File I/O , discover how to read a file,
    Then search on how to readh a CSV file using Java.
    After researching you should be able to read the CSV file line by line and store each line inside a Collection.
    Then research on Google, on how to write to the database using JDBC
    Write a simple program that inserts something to a dummy table in the database.
    Then, read the data stored in the Collection, and write insert statements for each records in the collection.

  • Need to write object to database but can't find useful examples

    Hi,
    Within one servlet I need to write an Attributes object to a database to be retrieved sometime later by a second servlet. All the examples of serialization code that I can find are for writing to serial or file streams. What I need is to be able to be able to write the Attributes object to a MySQL database. How do I get it into a form that I can write to the database and how do I once again turn in back into an object? I've not been able to answer those question from the examples I've found so far.
    Any help would be greatly appreciated.
    -- Rob

    There are at least two choices.
    1. Serialize to a ByteArrayOutputStream, base-64-encode that data, and save as a string in the database.
    2. Serialize directly to a database blob.

  • Organization of the dirty buffers in the write list

    Hello,
    1.) Where places the server process the dirty buffers in the write list, at the beginning or at the end? Dirty buffers would like to become a flag in the write list? Can anybody explain me the organisation of the WRITE LIST of the database buffer cache?
    2.) My Oracle book says that the DBWr process moves the dirty buffers from the end of the LRU list to the disk. I mean that the DBWr process moves the dirty buffers from the WRITE LIST to the disk. What is correct?
    best regards,
    keule

    Great question. Hopefully, the following excerpt clarifies things for you.
    From the 9i Concepts, Chapter 7:
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96524/c08memor.htm#8537
    Organization of the Database Buffer Cache
    The buffers in the cache are organized in two lists: the write list and the least recently used (LRU) list. The write list holds dirty buffers, which contain data that has been modified but has not yet been written to disk. The LRU list holds free buffers, pinned buffers, and dirty buffers that have not yet been moved to the write list. Free buffers do not contain any useful data and are available for use. Pinned buffers are currently being accessed.
    When an Oracle process accesses a buffer, the process moves the buffer to the most recently used (MRU) end of the LRU list. As more buffers are continually moved to the MRU end of the LRU list, dirty buffers age toward the LRU end of the LRU list.
    The first time an Oracle user process requires a particular piece of data, it searches for the data in the database buffer cache. If the process finds the data already in the cache (a cache hit), it can read the data directly from memory. If the process cannot find the data in the cache (a cache miss), it must copy the data block from a datafile on disk into a buffer in the cache before accessing the data. Accessing data through a cache hit is faster than data access through a cache miss.
    Before reading a data block into the cache, the process must first find a free buffer. The process searches the LRU list, starting at the least recently used end of the list. The process searches either until it finds a free buffer or until it has searched the threshold limit of buffers.
    If the user process finds a dirty buffer as it searches the LRU list, it moves that buffer to the write list and continues to search. When the process finds a free buffer, it reads the data block from disk into the buffer and moves the buffer to the MRU end of the LRU list.
    If an Oracle user process searches the threshold limit of buffers without finding a free buffer, the process stops searching the LRU list and signals the DBW0 background process to write some of the dirty buffers to disk.

  • The Microsoft Access database engine cannot open or write to the file in Report Builder 3.0

    I am trying to build a report in Report Builder 3.0.  I created the Data Source to point to my Excel file and the Data Set.  I drag a couple of fields on to the canvas and then choose Run.  I get the error:  "The Microsoft Access
    database engine cannot open or write to the file.  It is already opened exclusively by another user".  I am using the Excel driver.  Why am I getting this message?  How can I fix this?

    No, now I am getting the error message again.  It is quite long:
    ERROR [HY000] [Microsoft][ODBC Excel Driver] The Microsoft Access database engine cannot open or write to the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view and write its data.
    ERROR [01S00] [Microsoft][ODBC Excel Driver]Invalid connection string attribute Trusted_Connection
    Please help

  • When using the Database Connectivity Toolset, reads and writes with long binary fields are incompatible.

    I am trying to write LabVIEW Variants to long binary fields in a .mdb file using the Database Connectivity Toolset. I get errors when trying to convert the field back to a variant after reading it back from the database.
    I next tried flattening the variant before writing it and ultimately wound up doing the following experiments:
    1) If I use DB Tools Insert Data to write an ordinary string and read it back using a DB Tools Select Data, the string is converted from ASCII to Unicode.
    2) If I use DB Tools Create Parameterized Query to do an INSERT INTO or an UPDATE operation, specifying that the data is BINARY, then read it back using a DB Tools Select Data,
    the length of the string is prepended to the string itself as a big-endian four-byte integer.
    I can't think of any way to do a parameterized read, although the mechanism exists to return data via parameters.
    Presuming that this same problem affects Variants when they are written to the database and read back, I could see why I get an error. At least with flattened strings I have the option of discarding the length bytes from the beginning of the string.
    Am I missing something here?

    David,
    You've missed the point. When a data item is flattened to a string, the first four bytes of the string are expected to be the total length of the string in big-endian binary format. What is happening here is that preceding this four-byte length code is another copy of the same four bytes. If an ordinary string, "abcdefg" is used in place of the flattened data item, it will come back as <00><00><00><07>abcdefg. Here I've used to represent a byte in hexadecimal notation. This problem has nothing to do with flattening and unflattening data items. It has only to do with the data channel consisting of writing to and reading from the database.
    I am attaching three files that you can use to demonstrate the problem. The VI file c
    ontains an explanation of the problem and instructions for installing and operating the demonstration.
    Ron Martin
    Attachments:
    TestLongBinaryFields.vi ‏132 KB
    Sample.UDL ‏1 KB
    Sample.mdb ‏120 KB

  • The Microsoft Access database engine cannot open or write to the file \\fileserver\db\access.mdb

    Hi,
    I have Windows Server 2012 with SQL 2012 Standard SP1. I am using linked server, and Access Database Engine 2010 Redistributable to access my database file made in Microsoft Access (.mdb) from network file server.
    EXEC master.dbo.sp_addlinkedserver @server = N'MyLinkedServer', @srvproduct=N'MyLinkedServer', @provider=N'Microsoft.ACE.OLEDB.12.0', @datasrc=N'\\myfileserver.mydomain.com\files\mydatabase.mdb'
    My SQL service is running with domain service account MYDOMAIN\SQL1$ , i have added Full control for file share and NTFS permission on my file server folder (C:\Files).
    When I open (as domain admin with UAC elevated permissions) on my DB server SQL Management studio, I can browse tables and everything works.
    The problem is, if I open SQL management studio (as domain admin with UAC elevated permissions) on my File server or any other computer, when trying to browse my linked server i got error:
    TITLE: Microsoft SQL Server Management Studio
    Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
    ADDITIONAL INFORMATION:
    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
    Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "Synesis_3PRO2013". (Microsoft SQL Server, Error: 7303)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.00.3000&EvtSrc=MSSQLServer&EvtID=7303&LinkId=20476
    When I try to place simlpe Select SQL query I got error:
    OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "MyLinkedServer" returned message "The Microsoft Access database engine cannot open or write to the file '\\myfileserver.mydomain.com\files\mydatabase.mdb'. It is already opened exclusively by another
    user, or you need permission to view and write its data.".
    I do not have any other program using my access database, and user has full control. I am trying to use in security mode - "For a login not defined in the list above, connections will be made without using a security context", i have also tried all four options.
    I am confused becouse it works from SQL server but from any SQL client domain member computer/server it does not work.
    I have same problem in another environment where I have Windows Server 2008 R2 and SQL 2008 R2 SP2.
    Please help.
    -- Hrvoje Kusulja

    NTFS must be fine since it works from same server using same accounts.
    As I understand, adding my access file to Access trusted location could be a problem. I have tried now to add my access database file location to trusted locations for user which is my SQL service user (Windows Service - AD managed service account MYDOMAIN\SQL1$)
    and my test user which I use to connect to sql server as a client from sql management studio. (Account is Domain Admins and have full permissions on SQL server also)
    I have added this .reg:
    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security]
    [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security\Trusted Documents]
    "LastPurgeTime"=dword:01592874
    "DisablePromptOpenNetworkTrustedDocuments"=dword:00000000
    [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security\Trusted Locations]
    "AllowNetworkLocations"=dword:00000001
    [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security\Trusted Locations\Location0]
    "Description"="My file server"
    "AllowSubFolders"=dword:00000001
    "Path"="\\\\myfileserver.mydomain.com\\files\\"
    I have done this for SQL service account user and my personal test account as I said. I have tried to logoff and restart sql service and all servers also.
    The same problem still persists.
    Anyway, thank you for giving me a hint.

  • How can I edit the database in Lookout OPC Modbus driver OPC sever with the address that has a write attribute?

    When I use Lookout Modbus driver OPC to communicate with my instrumnets, I edited the database number such as 41202 that has a Write attribute in my instrumnet manual, the OPC explorer got bad data, and the OPC server gave the illegal address alarm, when I input the address such as 41203 that has R/W attribute, it worked very well. Is there a way to fix this problem. When I used other OPC server, there was no this kind of problem. Thanks!

    Thanks for your suggestion. I checked the Modbus manual of my instrument, the register is 16 bit. I tried to edit the data according to the Modbus data member in lookout modbus drivere server for several different member, but the OPC still gave me the illegal address. I think the problem may be produced by their attribute, for the address 1201 and 1202, they have the write attribute, for other addresses, they have W/R attribute, and they can be read or write through Lookout OPC server perfectly. when I used the demo OPC server from other company, it can work well, but it is not convinient for me to use Labview when I use that software. I prefer NI Lookout OPc server. I am using the Lookout 4.5. I am wondering whether the Lookout has some shortcoming when I
    use the Modbus driver. Please give me any suggestion, is there any newest version of Lookout OPC sever? Thanks!

  • How to open MSWORD using JAVA/JNI and write the database entries into WORD

    Hi..
    I am searching for java codes that uses JAVA NATIVE INTERFACE (JNI) for opening MSWORD 2003.
    To be brief.
    I created HTML form called Employee_data.
    if i click on Submit button a word document should be opened.This should be using JNI.
    I have also created a servlet in jsp to process the form data and store it into database(mysql).;
    Please help me to find the codes to open MSWORD on submit click and to write the database entries into word file.Can i get the full code for that.This is so urgent.
    Thanks in advance.

    Hi Suresh,
    The easest solution I can think of is to copy the math equation from the PowerPoint then paste in the Word document directly, there's actually no way to convert it to plain text, some equation is very complext, String variable is not suitable in this case.
    For example, this code works fine:
    var powerPoint = new Application { WindowState = PpWindowState.ppWindowMinimized };
    var oPresSet = powerPoint.Presentations;
    Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(@"C:\test.pptx", MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
    var strObj = oPres.Slides[1].NotesPage.Shapes[2].TextFrame2.TextRange.MathZones.get_MathZones();
    strObj.Copy();
    Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
    wordApp.Visible = true;
    Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Add();
    doc.Range(0, 0).Paste();
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for