Serialization vs Database?

Hi,�
I'm a J2EE developer with some "desktop type" questions. I recently started to branch out and develop some small scale desktop apps. Anyway, here is the question "In a Nutshell":
What is the "best" way to persist data on a desktop/mobile application?
For example, lets take a simple application that has only two objects, "User" and "GroceryList" where User contains a GroceryList.
Being a "J2EE guy" I am familiar with multiple RDBMS', EJB3, etc etc, but wouldn't object serialization be better here? Why would it be beneficial to tie my app to the DB? Or maybe there is a third solution I am totally missing?
Just looking for some feedback and wondering how this is normally done.
Kevin

Kevin_Cloutier wrote:
Hi,
I'm a J2EE developer with some "desktop type" questions. I recently started to branch out and develop some small scale desktop apps. Anyway, here is the question "In a Nutshell":
What is the "best" way to persist data on a desktop/mobile application?"best" is always a scalable and relative term. How much data do you have?
>
For example, lets take a simple application that has only two objects, "User" and "GroceryList" where User contains a GroceryList.
Being a "J2EE guy" I am familiar with multiple RDBMS', EJB3, etc etc, but wouldn't object serialization be better here? Why would it be beneficial to tie my app to the DB? Or maybe there is a third solution I am totally missing?IMO: it is fairly silly to tie an application into a DB for small amounts of data. When you approach a less manageable volume of data, then you enter the realm of needing a DB.
Rule of thumb--unless your Grocery List is going to read like the contents of a Safeway Super Store, then why would you even consider it for say 100 items?

Similar Messages

  • Object serialization to database

    Hi, how can objects be made persistent to database without using JDBC SQL calls ? In other words, we would like to avoid SQL calls "UPDATE...", "INSERT INTO..." entirely . They are error prone . Can it be done without EJB Entity Beans ? Or EJBs are absolutelly mandatory in this case ?
    We are using IBM Visual Age 4 and WebSphere 4.
    Thanks

    If you want to persist any data to a database, you must use SQL calls.
    If your SQL calls are not reliable, you have the wrong developer writing the SQL.

  • Isolation level serializable + EntityFramework 6.0 Concurrent Add

    Hi!
    I'm new to database programming and entity framework and currently running into
    some database behavior I don't understand. Maybe someone can explain it to me?
    I'm using a very simple table to isolate the behavior:
    ID(Primary Key), SSI(Indexed, duplicates allowed)
            static void AddTalkgroups(object state)
                for (int i = 0; i < 1000; i++)
                    Talkgroup talk = new Talkgroup();
                    talk.ID = Guid.NewGuid();
                    talk.SSI = i;
                    using (var context = new LeitstelleContext())
                        using (var transaction = context.Database.BeginTransaction(System.Data.IsolationLevel.Serializable))
                           // context.Database.Log = ShowCache;
                            try
                                if (context.Talkgroups.SingleOrDefault(t => t.SSI == i) == null)
                                    context.Talkgroups.Add(talk);
                                    context.SaveChanges();
                                transaction.Commit();
                                Console.Write("+");
                            catch (Exception e)
                                transaction.Rollback();
                                Console.Write("-");
    If I start the method in 2 concurrent threads, one of both will run into deadlocks
    over and over again. As intended, no duplicates of SSI are added, but I don't understand
    the database behavior.(The deadlocks)
    As far as I understand. The database should place a RangeI-N lock on datasets
    not found in the table during the "transaction" so no other transactions would be able
    to add a new dataset matching the "select"-statement of the active transaction.
    If I issue a "sp_lock" command during the transaction I'm seeing some RangeS-S locks.
    thanks alot for looking into this!
    best regards
    Johnny

    Hi David!
    If I just switch to IsolationLevel.ReadCommited I get 968 duplicates in
    my example. (And no PK violations)
    Talkgroup.Id  = PrimaryKey
    Talkgroup.Ssi is configured as "ununique index" in the SQL-Server 2012.
    class Program
            static object lockobject = new object();
            static Barrier barrier = new Barrier(3);
            static void Main(string[] args)
                LeitstelleContext context = new LeitstelleContext();
                //Talkgroup talk = new Talkgroup();
                //talk.ID = Guid.NewGuid();
                //talk.SSI = 1234;
                //context.Talkgroups.Add(talk);
                //context.SaveChanges();
                context.Database.ExecuteSqlCommand("delete Talkgroups");
                DateTime start = DateTime.Now;
                System.Threading.ThreadPool.QueueUserWorkItem(AddTalkgroups);
                System.Threading.ThreadPool.QueueUserWorkItem(AddTalkgroups);
                barrier.SignalAndWait();
                Console.WriteLine(DateTime.Now.Subtract(start).TotalSeconds.ToString());
                var liste = context.Talkgroups.GroupBy(t => t.SSI).Where(mygroup => mygroup.Count() > 1);
                Console.WriteLine(liste.Count().ToString());
                //foreach (var item in liste)
                //    Console.WriteLine(item.Key);
                Console.ReadLine();
            static void AddTalkgroups(object state)
                for (int i = 0; i < 1000; i++)
                    ////context.Database.Log = ShowCache;
                    //Parallel.For(6500, 7500, i =>
                    Talkgroup talk = new Talkgroup();
                    talk.ID = Guid.NewGuid();
                    talk.SSI = i;
                    using (var context = new LeitstelleContext())
                        using (var transaction = context.Database.BeginTransaction(System.Data.IsolationLevel.ReadCommitted))
                           // context.Database.Log = ShowCache;
                            try
                                if (context.Talkgroups.SingleOrDefault(t => t.SSI == i) == null)
                                    context.Talkgroups.Add(talk);
                                    context.SaveChanges();
                                transaction.Commit();
                                Console.Write("+");
                            catch (Exception e)
                                transaction.Rollback();
                                Console.Write("-");
                barrier.SignalAndWait();
    br
    Johnny

  • Jquery and serialize / passing variables

    I already put this question on the jquery forum but noone responded. My question is about jquery.
    I have this image gallery, people can drop and drag pictures, the idea is they can determine theirselves the order in which images are shown on their website.
    I have the sortable part, but I don't know how to pass the new order to the next page that should contain a query that updates the ordernumber for each item.
    My code:
    <!--- load the necessary scripts --->
         <script src="scripts/jquery-1.6.2.min.js" type="text/javascript"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
        <script src="http://jquery-ui.googlecode.com/svn/tags/latest/external/jquery.bgiframe-2.1.2.js" type="text/javascript"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/i18n/jquery-ui-i18n.min.js" type="text/javascript"></script>
    ,!--- the actual sortable image gallery --->
    <ul id="ulsortable">
        <cfoutput query="items">
            <li id="ID_#T_items_autoID#">
                <CFIF #T_items_img1# IS NOT 0>
                    <img src="../#session.foldername#/galleries/#T_items_itemid#_thumbsitemanager.#T_items_img1#" alt="Click here to update" border="0" width="125" height="125">
                    <CFELSE>
                        <img src="layoutimg/no_picture_available.jpg" alt="" width="125" height="125" border="0">
                    </CFIF><br>
                    <CFIF #T_items_title# IS NOT "">#left("#T_items_title#","15")#</CFIF>
            </li>
        </cfoutput>
    </ul>
      <script>
        $(function() {
            $( "#ulsortable" ).sortable();
            $( "#ulsortable" ).disableSelection();
            $('#frm-sort').submit(function(){
                var sort_serialized = $("#ulsortable").sortable("serialize");
        </script>
    <form action="#request.site.webroot#/actions/act_writeneworder.cfm" method="post" id="frm-sort">
      <input type="submit" name="save" id="save" value="save" />
      <input type="hidden" name="sort_serialized" id="sort_serialized" value="" />
    </form>
    When I use this and go to the next page thrugh submit button I get the error that sort_seriallized is an empty string. i must be doing something wrong. It has been 3 days i am on it:-)

    If anyone is interested, here is the working code.
    Make sure to include the right jslibraries
    Make your stylesheet so you have an unordered list that looks like an image gallery:
    <style>
             ul
                width                : 715px;
                list-style-type    : none;
                margin              : 0;
                padding             : 0;
            /* float & allow room for the widest item */
              ul li
                float                 : left;
                width                : 136px;
                height              : 165px;
                margin              : 2px;
                text-align          : center;
                border              : 1px solid gray;
               /* stop the float */
              br
                clear            : left;
              /* separate the list from subsequent markup */
              div.wrapper
                margin-bottom    : 1em;
        </style>
    Then the jquery script:
    <script type="text/javascript">
            $(document).ready(function(){
    // sortable makes the ul drag and drop
                $("#ulsortable").sortable();
    // create variable that will be submitted with form           
                    $("#frm_sort").submit(function(){
                        var order = $('#ulsortable').sortable("serialize");
                        $('#order').val(order);
        </script>
    Ouput the listitems:
    <ul id="ulsortable">
        <cfoutput query="items">
            <li id="myprimarykey_#T_items_autoID#">
                     <img src="../#session.foldername#/galleries/#T_items_itemid#_thumbsitemanager.#T_items_img1#" alt="Click here to update" border="0" width="125" height="125">
                    <br/>
                   <CFIF #T_items_title# IS NOT "">#left("#T_items_title#","15")#</CFIF>
            </li>
        </cfoutput>
    </ul>
    Finally the form with submit button and hidden field that passes variable:
    <form action="actions/act_writeneworder.cfm" method="post" id="frm_sort">
          <input type="hidden" name="order" id="order" value="" />
          <input type="submit" name="save" id="save" value="Save new order" />
    </form>
    The page that handles the serialize and database update:
    <!--- convert the serialized string to a comma delimited list --->
        <cfset idlist = ReReplaceNoCase( form.order, "(&)?myprimarykey\[\]=", ",", "all" )>
        <cfset position = 0>
        <cfset pk = 0>
    <cfloop list="#idlist#" index="pk">
          <cfset position++>
        <cfquery name="writeneworder" datasource="#request.dba#">
            UPDATE T_items
                SET T_items_order = <cfqueryparam value="#position#" cfsqltype="CF_SQL_INTEGER">
                 WHERE T_items_autoID = <cfqueryparam value="#pk#" cfsqltype="CF_SQL_INTEGER">
        </cfquery>
    </cfloop>
    <cflocation url="#request.site.webroot#/item_choose_cat.cfm?currentopic=changeorder" addtoken="no" />
    As I couldn't find anywhere a full working exemple I decided to post this code, hope it helps you.
    Bianca

  • BDBSQL & Isolation Level 2

    Does BDBSQL support isolation level 2 (READ COMMITTED DASTA) i.e. the readers release the read lock as soon as the data is read ?
    I will appreciate if you tell me how this can be configured.

    Hello,
    There is no equivalent to the DB_READ_COMMITTED isolation level through the SQL API.
    The default is documented in the Berkeley DB Reference Guide under
    "Degrees of isolation" at:
    http://download.oracle.com/docs/cd/E17076_02/html/programmer_reference/transapp_read.html
    From there:
    Transactions can be isolated from each other to different degrees. Serializable provides the most isolation, and means that, for the life of the transaction, every time a thread of control reads a data item, it will be unchanged from its previous value (assuming, of course, the thread of control does not itself modify the item). By default, Berkeley DB enforces serializability whenever database reads are wrapped in transactions.
    The other option is DB_READ_UNCOMMITTED which is a standard
    SQLite pragma documented at:
    http://www.sqlite.org/pragma.html#pragma_read_uncommitted
    Thanks,
    Sandra

  • Using database to serialize an object

    I am confused as to the simplest way to serialize an object (actually a simple JavaBean) to a database through jdbc. What classes do I extend and what methods do I overwrite? There are no transient data involved.

    If you expect to serialize a complex java object directly to a Relational database, it would not be possible. There are no data types which can directly hold 'objects'.
    If you want to serialize a java object, and want to store it as text in a database, it would be possible. For this you can serialize the object first to a file may be, and then copy the contents of file to the database text filed.
    although doing this, in my opinion, makes no sense.
    Usually when you are serializing object data to a relational database you first map the data to equivalant Relational data ... A table or few colums of a table may represent your object.

  • How to serialize a object to DataBase?

    A feasible way is that serialize the object to a file and then store this file to database. But I want to achieve it directly. How could I do?

         * Convert a serializable object to a byte array.
         * @param serializable Object to convert.
         * @return Byte array or null if failed.
         * @throws IOException on error.
        static public byte[] toByteArray(Serializable serializable) throws IOException {
            byte[] result = null;
            if (serializable != null) {
                ObjectOutputStream oos = null;
                try {
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    oos = new ObjectOutputStream(baos);
                    oos.writeObject(serializable);
                    result = baos.toByteArray();
                } finally {
                    if (oos != null) {
                        oos.flush();
                        oos.close();
            }//else: input unavailbel
            return result;
        }//toByteArray()
    byte[] ba = toByteArray(mySerializableObject);
    ByteArrayInputStream bais = new ByteArrayInputStream(ba);
    preparedStatement.setBinaryStream("BINDATA", bais, ba.length)

  • Database vs Serialization

    Dear Experts
    I am planning to do an Accounting Package for a Corporation and someone in our organization (who is great fan of serializations) is telling the higher ups that database is a wrong way to go. Serialization would be fast and cheap. I am a die hard database fanatic and i know that doing serializations would be like reinventing the wheel and security and reporting would be an issue. Please can someone suggest (there are likely to be 10000 Transactions in a year) a way to go!
    Thanks and Best Regards
    Manish

    Biggest benefit of serialization: Instead of depending on the 'database guys', we can create new data types when we need them. (in some instances, that means: to hell with standards.) So we can add new 'columns' (fields) on the fly, maybe from a table source.
    From a run time view, it can be a whole lot faster thatn extracting data from a DBl.
    Serialization has the secondary benefits of allowing someone to create administration, security, backup and recovery, validation and constraint tools from scratch.
    Sheer frustration for people who want to create ad-hoc, or defined, query systems. Popular tools don't work. In general, any data extract and any data manipulation depends on the original, and usually, ad-hoc spec.
    Serialization is a great way of creating job security.
    Been there ... thought it was wonderful. Until I couldn't get promoted (or a vacation) because I was the only one who was able to keep the system running. Even with docco.

  • Serialization Back to Database

    Hi Every one, I am facing a little problem here that i cant seem to get past.
    I have done Serialization on my Database, i can Read the File into a Text Area. inside my View. I am using MVC in my program. What i am having a problem with is Trying to get this Object that i had Created with Serialization Into my Database as a Backup
    My Database Table is made up with the following
    ID (Int)
    FirstName (text)
    LastName (text)
    Address (text)
    PhoneNumber (int)
    bytes (blob)
    WRITE_OBJECT_SQL_PATIENT =
                             connection1.prepareStatement("INSERT INTO Patient(Id,FirstName,LastName,Address,PhoneNumber,bytes)" +
                                       "VALUES(?,?,?,?,?,?)");
         public ArrayList<Person> writeJavaObject(ActionEvent evt)
              ArrayList<Person> results = null; // ArrayList <Person>
              ResultSet resultSet = null; // ResultSet Set to Null
              try
                   // executeQuery returns ResultSet containing matching entries
                   resultSet = WRITE_OBJECT_SQL_PATIENT.executeQuery(); //ResultSet equals SelectAllPeople & Execute The Query Above
                   results = new ArrayList< Person >(); // Placing Entries into ArrayList
                   WRITE_OBJECT_SQL_PATIENT.setString( 1,"Patientid");
                   WRITE_OBJECT_SQL_PATIENT.setString( 2, "FirstName" );
                   WRITE_OBJECT_SQL_PATIENT.setString( 3, "LastName" );
                   WRITE_OBJECT_SQL_PATIENT.setString( 4, "Address" );
                   WRITE_OBJECT_SQL_PATIENT.setString( 5, "PhoneNumber" );
                   WRITE_OBJECT_SQL_PATIENT.setObject( 6, "object" );
              } // end try
              catch ( SQLException sqlException )
                   sqlException.printStackTrace();
                   close();
              } // end catch
              return results;
         }This is a Method that is calling the above code but i am getting Can not issue data manipulation statements with executeQuery().
         public static void LOADITEMactionPerformed(ActionEvent evt)
              results -
                            DBSQLQueries.writeJavaObject(evt);
         }

    I doubt that design will be usable over time. As an example of why - because data model entities are not always mappable in one to one relationships.
    And given that it looks like the connection/statement scope is outside the method it probably isn't thread safe either. And perhaps leaking connections.
    Other than that your question is a bit hard to understand. I can only suppose that when you attempt the write that it fails but you don't specify how. In other words you do not supply the exception and stack trace.
    But as a guess you are not using an updatable query.

  • Serialization big object(100k--2M) into MYSQL database

    Hi all !
    I have a big object need to be persisted into MYSQL database in my application.
    I use two method to meet this request
    1 ---- the object implement interface Serializable, but there is serializationVersionID is not same Exception
    sometimes.
    2 ---- Use XMLEncoder to save my object, the XMLEncoder generate the object XML text about 200k -- 3 M
    , but another problem occur :
    when I call flush method of XMLEncoder, my application will full ocuppy CPU time, and memory usage will increase to 90M, sometimes will ocurr "Not enough memory" Error.
    Why?
    can some one help me?
    Thanks in advanced

    1. You are modifying the signature of one or more of your classes that alters the (system generated) serializationVersionUID and then recompiling. You can declare this for yourself to get control to some extent. See the serialization spec for details.
    2. Your object graph is very large, which might be a problem using native or xml formats. Again, the specification details ways in which you can control the serialized form of your objects.
    On the information you've provided there's not much more that can be said.

  • Serialize object to MSQL database

    Hi
    Is it possible to serialize object to MSQL database instaed of file/Store?
    Please guide me...
    Thank you very much in advance
    PSL

    Somebody please throw some idea...Thank you very much

  • Serialization of an Object containing an opened database connection

    Hi everyone,
    My question is simple:
    If you serialize an object containing an active databse connection, will it be de-serialized with that connection active and ready to use?

    First of all, lets look at the purpose. what is that
    making you write an object which hold the Connection
    object to a network or to the file.
    First check the condition. The conditions for
    serialization are
    1) Connection object should not be declared as
    transiant.
    2) And it should not be as static.
    It the above conditions are meet then the it is
    serializable.
    Now the obejct holding the connection object is
    written to the file or over the n/w.
    Reading
    Case 1 ) You read from the file at the server end no
    issues. You can reconstruct the Connection object and
    use it.
    case 2) If you are writing to the n/w , your client
    is some where in Aus and the java server the db
    server are in US. Java Server being public and db
    server being local to the Java Server , how you
    would use the connection object to execute the querys
    on that DB.
    Think about this :).Hi,
    Are n't you missing the whole point here? What you've said above is valid , of course, but then your readObject/writeObject methods would take care of restoring the connection object (from wherever) if such an implementation is taken up. IMHO, such an implementation is not practical in the first place, and if it's required in your project, it's bad design.
    Regards
    Hrishikesh

  • Unable to load database connector - using JRC w/report connecting to Oracle

    A simple Java program was created to test a Crystal Report using JRC. The Java program is a thick-client Swing desktop application (modified from an example of crxi_r2_migrating_rdc_to_jrc.pdf). The program failed to execute the report with the following error:
    Unable to load database connector u2018com.crystaldecisions.reports.queryengine.driverImpl.DriverLoader'
    It might be something simple to correct the problem, but I am not able to find related answers in the documentation and from the forum.
    CR version is XI R2. The Java program was compiled and run using jdk1.4.2_13. Oracle is 10.2.
    Do I have to use JDBC? or the CR Oracle driver will do? What needs to be setup? If I use JDBC, what do I need to setup (I tried to following the links in the forums or other documentation, but most of the links to http://support.businessobjects.com/.... are broken - i.e. re-route to the SAP support page but not directly linked to the articles)
    When the report JRCTestReport.rpt was saved with the option "Save Data With Report", it works fine. So the problem is only with Oracle database driver, the other jars are fine.
    In the report JRCTestReport.rpt the database properties are:
           DatabaseDLL             crdb_oralce.dll
           Password
           Server                        myTestDB
           Trusted_Connection    False
           User ID                      MyUser
    The crdb_oracle.dll is located at:
    C:\Program Files\Business Objects\Common\3.5\bin
    Files are stored in the following tree structure:
    <Testing Folder>
         JRCTest.java
         JRCTest.class
         WEB-INF
                   lib
                        All required JRC jars and CRConfig.xml
         Reports
                   JRCTestReport.rpt
    Java source code JRCTest.java
    import java.awt.*;
    import javax.swing.*;
    import java.io.*;
    import com.crystaldecisions.ReportViewer.*;
    // Use this for talking to JRC in-process
    import com.crystaldecisions.reports.sdk.*;
    import com.crystaldecisions.sdk.occa.report.reportsource.*;
    public class JRCTest
         private static void createAndShowGUI()
              try
                   //Make sure we have nice window decorations.
                   JFrame.setDefaultLookAndFeelDecorated(false);
                   //Create and set up the window.
                   JFrame frame = new JFrame("JRCTest");
                   frame.setTitle("JRCTest");
                   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   ReportViewerBean viewer = new ReportViewerBean();
                                      System.out.println("ReportViewerBean.init");
                   viewer.init(new String[0], null, null, null);
                                      System.out.println("new ReportClientDocument");
                   ReportClientDocument rpt = new ReportClientDocument();
                                      try
                                              System.out.println("Openning Report...");
                                              rpt.open("JRCTestReport.rpt", 0);
                                      catch (Exception ex)
                                              System.out.println("Failed to open report");
                                              System.out.println(ex.toString());
                                              return;
                                      try
                                              System.out.println("logon...");
                                              rpt.getDatabaseController().logon("myUser", "myPass");
                                      catch (Exception ex)
                                              System.out.println("Failed to logon");
                                              System.out.println(ex.toString());
                                              return;
                                      System.out.println("ReportClientDocument.getReportSource");
                   IReportSource rptSource = rpt.getReportSource();
                   viewer.setReportSource(rptSource);
                                                    System.out.println("viewer.setReportSource");
                   frame.getContentPane().add
                        (viewer, BorderLayout.CENTER);
                   frame.setSize(700, 500);
                   frame.setVisible(true);
                   viewer.start();
              catch (Exception exception)
                   System.out.println(exception.toString());
         public static void main(String[] args)
              javax.swing.SwingUtilities.invokeLater(new Runnable()
                   public void run()
                        createAndShowGUI();
    Execution result:
    C:\tmp\CrystalJavaTest>java -classpath .;./WEB-INF/lib;./WEB-INF/lib/ReportViewe
    r.jar;./WEB-INF/lib/jrcerom.jar;./WEB-INF/lib/jrcadapter.jar;./WEB-INF/lib/Concu
    rrent.jar;./WEB-INF/lib/CrystalCharting.jar;./WEB-INF/lib/CrystalCommon.jar;./WE
    B-INF/lib/CrystalContentModels.jar;./WEB-INF/lib/CrystalExporters.jar;./WEB-INF/
    lib/CrystalExportingBase.jar;./WEB-INF/lib/CrystalFormulas.jar;./WEB-INF/lib/Cry
    stalQueryEngine.jar;./WEB-INF/lib/CrystalReportEngine.jar;./WEB-INF/lib/CrystalR
    eportingCommon.jar;./WEB-INF/lib/icu4j.jar;./WEB-INF/lib/keycodeDecoder.jar;./WE
    B-INF/lib/log4j.jar;./WEB-INF/lib/MetafileRenderer.jar;./WEB-INF/lib/rasapp.jar;
    ./WEB-INF/lib/rascore.jar;./WEB-INF/lib/rpoifs.jar;./WEB-INF/lib/Serialization.j
    ar;./WEB-INF/lib/URIUtil.jar;./WEB-INF/lib/xercesImpl.jar;./WEB-INF/lib/xml-apis
    .jar JRCTest
    Starting
    Crystal Report Viewer 2.1.21.2
    java.vendor = Sun Microsystems Inc.
    java.version = 1.4.2_13
    os.name = Windows XP
    os.version = 5.1
    os.arch = x86
    ReportViewerBean.init
    new ReportClientDocument
    Openning Report...
    logon...
    ReportClientDocument.getReportSource
    viewer.setReportSource
    ERROR - JRCAgent1 detected an exception: Unable to load database connector 'com.
    crystaldecisions.reports.queryengine.driverImpl.DriverLoader'.
            at com.crystaldecisions.sdk.occa.report.lib.ReportSDKException.throwRepo
    rtSDKException(Unknown Source)
            at com.businessobjects.reports.sdk.b.i.if(Unknown Source)
            at com.businessobjects.reports.sdk.b.i.a(Unknown Source)
            at com.businessobjects.reports.sdk.b.i.byte(Unknown Source)
            at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unkno
    wn Source)
            at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
            at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
            at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
            at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unkno
    wn Source)
            at com.crystaldecisions.sdk.occa.report.application.ReportSource.getPage
    (Unknown Source)
            at com.crystaldecisions.sdk.occa.report.application.AdvancedReportSource
    .getPage(Unknown Source)
            at com.crystaldecisions.sdk.occa.report.application.NonDCPAdvancedReport
    Source.getPage(Unknown Source)
            at com.businessobjects.crystalreports.viewer.core.rs.b.if(Unknown Source
            at com.businessobjects.crystalreports.viewer.core.av.a(Unknown Source)
            at com.businessobjects.crystalreports.viewer.core.av.run(Unknown Source)
            at java.lang.Thread.run(Thread.java:534)
    Unable to load database connector 'com.crystaldecisions.reports.queryengine.driv
    erImpl.DriverLoader'.

    After I switched the report to use JDBC, I am still getting the same error.
    Machine has multiple jdk, oracle 10g, Oracle11g client installed though. So I need to set my path to use the jdk from Crystal Report and Oracle 10g.
    The program was compiled and ran with the following path and CLASSPATH:
    set path="C:\Program Files\Business Objects\j2sdk1.4.2_08\bin";"C:\Program Files\Business Objects\j2sdk1.4.2_08\jre\bin";"C:\Program Files\Business Objects\j2sdk1.4.2_08\jre\bin\client";c:\oracle\ora102\bin
    set CLASSPATH=.;./WEB-INF/lib;./WEB-INF/lib/ReportViewer.jar;./WEB-INF/lib/jrcerom.jar;./WEB-INF/lib/jrcadapter.jar;./WEB-INF/lib/Concurrent.jar;./WEB-INF/lib/CrystalCharting.jar;./WEB-INF/lib/CrystalCommon.jar;./WEB-INF/lib/CrystalContentModels.jar;./WEB-INF/lib/CrystalExporters.jar;./WEB-INF/lib/CrystalExportingBase.jar;./WEB-INF/lib/CrystalFormulas.jar;./WEB-INF/lib/CrystalQueryEngine.jar;./WEB-INF/lib/CrystalReportEngine.jar;./WEB-INF/lib/CrystalReportingCommon.jar;./WEB-INF/lib/icu4j.jar;./WEB-INF/lib/keycodeDecoder.jar;./WEB-INF/lib/log4j.jar;./WEB-INF/lib/MetafileRenderer.jar;./WEB-INF/lib/rasapp.jar;./WEB-INF/lib/rascore.jar;./WEB-INF/lib/rpoifs.jar;./WEB-INF/lib/Serialization.jar;./WEB-INF/lib/URIUtil.jar;./WEB-INF/lib/xercesImpl.jar;./WEB-INF/lib/xml-apis.jar;C:/oracle/ora102/jdbc/lib/ojdbc14.jar
    I modified my java testing program to display more info:
    Modified program:
    import java.awt.*;
    import javax.swing.*;
    import java.io.*;
    import com.crystaldecisions.ReportViewer.*;
    // Use this for talking to JRC in-process
    import com.crystaldecisions.reports.sdk.*;
    import com.crystaldecisions.sdk.occa.report.reportsource.*;
    import com.crystaldecisions.sdk.occa.report.exportoptions.*;
    import com.crystaldecisions.sdk.occa.report.data.*;
    import com.crystaldecisions.sdk.occa.report.lib.PropertyBag;
    import com.crystaldecisions.sdk.occa.report.lib.IStrings;
    public class JRCTest2
       private static void createAndShowGUI()
          try
             System.out.println("Starting");
             //Make sure we have nice window decorations.
             JFrame.setDefaultLookAndFeelDecorated(false);
             //Create and set up the window.
             JFrame frame = new JFrame("JRCTest2");
             frame.setTitle("Testing 1, 2, 3");
             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             System.out.println("new ReportViewerBean");
             ReportViewerBean viewer = new ReportViewerBean();
             System.out.println("ReportViewerBean.init");
             viewer.init(new String[0], null, null, null);
             System.out.println("new ReportClientDocument");
             ReportClientDocument rpt = new ReportClientDocument();
             try
                 System.out.println("Openning Report...");
                 rpt.open("JRCTestReport.rpt", 0);
             catch (Exception ex)
                System.out.println("Failed to open report");
                System.out.println(ex.toString());
                return;
             try
                // try logon here to see if any exceptions
                rpt.getDatabaseController().logon("myUser", "myPass");
             catch (Exception ex)
                System.out.println("Failed to logon");
                System.out.println(ex.toString());
                return;
             IDatabase idb = rpt.getDatabaseController().getDatabase();
             Tables dtb = idb.getTables();
             IConnectionInfo conInfo = dtb.getTable(0).getConnectionInfo();
             PropertyBag attrs = conInfo.getAttributes();
             conInfo.setPassword("myPass");
             conInfo.setUserName("myUser");
             IStrings s = attrs.getPropertyIDs();
             for (int i=0; i < s.size(); i++)
                System.out.println(s.getString(i));
                System.out.println(attrs.getStringValue(s.getString(i)));
             System.out.println(" ");
             conInfo.setAttributes(attrs);
             attrs = conInfo.getAttributes();
             s = attrs.getPropertyIDs();
             // Print property again after setting attributes
             for (int i=0; i < s.size(); i++)
               System.out.println(s.getString(i));
               System.out.println(attrs.getStringValue(s.getString(i)));
             System.out.println(" ");
             System.out.println("ReportClientDocument.getReportSource");
             IReportSource rptSource = rpt.getReportSource();
             viewer.setReportSource(rptSource);
             frame.getContentPane().add
         (viewer, BorderLayout.CENTER);
             frame.setSize(700, 500);
             frame.setVisible(true);
             viewer.start();
          catch (Exception exception)
             System.out.println(exception.toString());
       public static void main(String[] args)
          System.out.println("main");
          javax.swing.SwingUtilities.invokeLater(new Runnable()
             public void run()
                createAndShowGUI();
    Running result:
    C:\tmp\CrystalJavaTest>java JRCTest2
    main
    Starting
    new ReportViewerBean
    Crystal Report Viewer 2.1.21.2
    java.vendor = Sun Microsystems Inc.
    java.version = 1.4.2_13
    os.name = Windows XP
    os.version = 5.1
    os.arch = x86
    ReportViewerBean.init
    new ReportClientDocument
    Openning Report...
    Trusted_Connection
    false
    Server Name
    dbHost
    Connection String
    Use JDBC=b(true);Connection URL=s(jdbc:oracle:thin:@dbHost:1521:myDB);Database Class Name=s(oracle.jdbc.OracleDriver);Server=s(dbHost);User ID=s(myUser);Password=;Trusted_Connection=b(false);JDBC Connection String=s(!oracle.jdbc.OracleDriver!jdbc:oracle:thin:/@dbHost:1521:myDB)
    Server Type
    JDBC (JNDI)
    Database Class Name
    oracle.jdbc.OracleDriver
    Use JDBC
    true
    URI
    !oracle.jdbc.OracleDriver!jdbc:oracle:thin:/@dbHost:1521:myDB
    Database DLL
    crdb_jdbc.dll
    Trusted_Connection
    false
    Server Name
    dbHost
    Connection String
    Use JDBC=b(true);Connection URL=s(jdbc:oracle:thin:@dbHost:1521:myDB);Database Class Name=s(oracle.jdbc.OracleDriver);Server=s(dbHost);User ID=s(myUser);Password=;Trusted_Connection=b(false);JDBC Connection String=s(!oracle.jdbc.OracleDriver!jdbc:oracle:thin:/@dbHost:1521:myDB)
    Server Type
    JDBC (JNDI)
    Database Class Name
    oracle.jdbc.OracleDriver
    Use JDBC
    true
    URI
    !oracle.jdbc.OracleDriver!jdbc:oracle:thin:/@dbHost:1521:myDB
    Database DLL
    crdb_jdbc.dll
    ReportClientDocument.getReportSource
    ERROR - JRCAgent1 detected an exception: Unable to load database connector 'com.crystaldecisions.reports.queryengine.driverImpl.DriverLoader'.
            at com.crystaldecisions.sdk.occa.report.lib.ReportSDKException.throwReportSDKException(Unknown Source)
            at com.businessobjects.reports.sdk.b.i.if(Unknown Source)
            at com.businessobjects.reports.sdk.b.i.a(Unknown Source)
            at com.businessobjects.reports.sdk.b.i.byte(Unknown Source)
            at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
            at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
            at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
            at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
            at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
            at com.crystaldecisions.sdk.occa.report.application.ReportSource.getPage(Unknown Source)
            at com.crystaldecisions.sdk.occa.report.application.AdvancedReportSource.getPage(Unknown Source)
            at com.crystaldecisions.sdk.occa.report.application.NonDCPAdvancedReportSource.getPage(Unknown Source)
            at com.businessobjects.crystalreports.viewer.core.rs.b.if(Unknown Source)
            at com.businessobjects.crystalreports.viewer.core.av.a(Unknown Source)
            at com.businessobjects.crystalreports.viewer.core.av.run(Unknown Source)
            at java.lang.Thread.run(Thread.java:534)
    Unable to load database connector 'com.crystaldecisions.reports.queryengine.driverImpl.DriverLoader'.
    Also got similar error when the path and classpath was switched to Oracle 11g.
    Is there a way to tell which file that it failed to load?
    Thanks
    Kin

  • Database connection timeouts and datasource errors

    Connections in the pool randomly die overnight. Stack traces show that for some reason, the evermind driver is being used even though the MySql connection pool is specified.
    Also, the evermind connection pool is saying connections aren't being closed, and the stack trace shows they're being allocated by entity beans that are definitely not left hanging around.
    Sometimes we get non-serializable errors when trying to retrieve the datasource (this is only after the other errors start). Some connections returned from the pool are still good, so the application limps along.
    EJBs and DAOs both use jdbc/SQLServerDSCore.
    Has anyone seen this problem?
    <data-sources>
         <data-source
              class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"
              name="SQLServerDSCore"
              location="jdbc/SQLServerDSCore"
              xa-location="jdbc/xa/SQLServerXACore"
              ejb-location="jdbc/SQLServerDSCore"
              connection-driver="com.mysql.jdbc.Driver"
              min-connections="5"
              username="xxx"
              password="xxx"
              staleness-timeout="3600"
              alive-poll-query="SELECT 1 FROM medispan"
              url="jdbc:mysql://1.2.3.4:3306/dbo?autoReconnect=true&autoReconnectForPools=true&cachePrepStmts=true&is-connection-validation-required=true"
              inactivity-timeout="30"
         >
              <property name="autoReconnect" value="true"/>
              <property name="autoReconnectForPools" value="true"/>
              <property name="is-connection-validation-required" value="true"/>
              <property name="cachePrepStmts" value="true"/>
         </data-source>
    </data-sources>

    Rick,
    OC4J 9.0.4.0.0 - BTW, do you know of any patches?As far as I know, there are no patches for the 9.0.4
    production version of OC4J stand-alone.
    I'm using container managed persistence,It was not clear to me, from your previous post, that you
    are using CMP entity beans.
    I found staleness-timeout and alive-poll-query
    somewhere on a website when trying to track this
    down. Here's four sources:Those sources refer to OrionServer -- and an older version, too, it seems.
    Like all other Oracle products that start out as somebody
    else's -- including, for example, JBuilder (that became "JDeveloper"), Apache Web Server (that became "Oracle HTTP Server") and TopLink -- their development paths diverge, until, eventually, there is absolutely no similarity between them at all. Hence, the latest versions of OC4J and "OrionServer" are so different, that you cannot be sure that something that works for "OrionServer" will work for OC4J.
    I recall reading something, somewhere, sometime about configuring OC4J to use different databases (other than Oracle), but I really don't remember any details (since it was not relevant to me, because we only use Oracle database). In any case, it is possible to use a non-Oracle database with OC4J.
    Good Luck,
    Avi.

  • Error while saving the records in the database

    Hi,
    I am running into a wierd error.
    I have built a new page which contains the information about the employees. Some of the fields are updatable fields. The page shows the details of the person who logs into the page.
    I am not using EO in this page. The data is queried from the database from VO and displayed in the page and when the records are updated, they are saved in the databased using pl/sql procedure which is
    being called from AM. So i am basically not using VO to save the records in the database.
    The error which i am getting is,
    If 2 users are trying to update the page at the same time, user A's details are updated in user B's page.
    This is really causing the issue. Any help is greatly appreciated.
    Thanks in advance.
    PK

    I have posted the code used along with the dialog page. Please review.
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Pavan, Start1",OAFwkConstants.STATEMENT);
    if (pageContext.getParameter("XYZBack")!=null)
    pageContext.setForwardURL("OA.jsp?OAFunc=OAHOMEPAGE"// OAWebBeanConstants.RETURN_TO_MENU_URL also tryed this , same error
    ,null
    ,OAWebBeanConstants.KEEP_MENU_CONTEXT
    ,null //not needed as we are retaining menu context
    ,null // no parameters are needed,true //retain AM,OAWebBeanConstants.ADD_BREAD_CRUMB_YES
    ,true
    ,null
    ,OAWebBeanConstants.IGNORE_MESSAGES);
    if(pageContext.getParameter("XYZUpdate") !=null)//The fields and their values are loaded as soon as the update button is clicked. We do this before calling the oadialog page so that the values are not lost
    OAViewObject EmpDetailsVO3 = (OAViewObject)OAAppl.findViewObject("XYZPersInfoVO");
    OARow EmpDetailsRow3 = (OARow)EmpDetailsVO3.first(); //Bringing the control over to the first row which is nothing but the displayed row.
    if(EmpDetailsRow3 !=null)
    s_workphone = EmpDetailsRow3.getAttribute("WorkPhone").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"workphone is: "+s_workphone,OAFwkConstants.STATEMENT);
    s_fax = EmpDetailsRow3.getAttribute("WorkFax").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Fax is: "+s_fax,OAFwkConstants.STATEMENT);
    s_building = EmpDetailsRow3.getAttribute("Building").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Building is: "+s_building,OAFwkConstants.STATEMENT);
    s_room = EmpDetailsRow3.getAttribute("Room").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Room is: "+s_room,OAFwkConstants.STATEMENT);
    s_box = EmpDetailsRow3.getAttribute("Box").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Box is: "+s_box,OAFwkConstants.STATEMENT);
    s_preferedname = EmpDetailsRow3.getAttribute("KnownAs").toString();
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"Preferred name is: "+s_preferedname,OAFwkConstants.STATEMENT);
    OAException OAExcep1 = new OAException("PER","XYZ_UPDATE_DETAILS");
    OAException OAExcep2 = new OAException("PER","XYZ_UPDATE_MESSAGE");
    OADialogPage OADialogPG1 = new OADialogPage(OAException.WARNING,OAExcep1,OAExcep2,
    OADialogPG1.setOkButtonToPost(true);
    OADialogPG1.setNoButtonToPost(true);
    OADialogPG1.setOkButtonLabel("Yes");
    OADialogPG1.setNoButtonLabel("No");
    OADialogPG1.setOkButtonItemName("DoOk");
    OADialogPG1.setNoButtonItemName("DoNo");
    OADialogPG1.setPostToCallingPage(true);
    pageContext.releaseRootApplicationModule();
    pageContext.redirectToDialogPage(OADialogPG1);
    else if(pageContext.getParameter("DoOk") != null)
    OAApplicationModule EmpDetailsAM = pageContext.getApplicationModule(webBean);
    Class[] paramtypes = {String.class, String.class, String.class, String.class,String.class,String.class,String.class};
    Serializable[] params = {s_personid,s_workphone,s_fax,s_building,s_room,s_box,s_preferedname};
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"personid is :"+s_personid,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"workphone is :"+s_workphone,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"workfax is :"+s_fax,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"building is :"+s_building,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"room is :"+s_room,OAFwkConstants.STATEMENT);
    if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    pageContext.writeDiagnostics(this,"preferredname is :"+s_preferedname,OAFwkConstants.STATEMENT);
    pageContext.releaseRootApplicationModule();
    OAAppl.invokeMethod("TransactionCommit",params,paramtypes);
    OAAppl.invokeMethod("initDetails");
    throw new OAException("The Building and Phone Information have been saved successfully"
    ,OAException.INFORMATION);
    thank you

Maybe you are looking for