Tuesday, May 08, 2007

Turn on Olite SQL Trace

Want to tune your sql on Olite database? You can put the following parameter in your polite.ini file, [All databases] segment:
OLITE_SQL_TRACE = TRUE

You should see a trace file: oldb_trc.txt in your mobile client bin directory, if you are using msql to run your sql script on the Olite DB.

Monday, May 07, 2007

Oracle change xmltype column lob tablespace

One friend asked me this question today: How do you chnage xmltype column lob tablespace?

  1. xmltype is an object type, it contains XMLDATA which is a CLOB object, you can treat "column.XMLDATA" as a clob object. please refer to here.
  2. How to move a lob from one tablespace to another? The answer is to use 'alter table move lob(...) ...'; please refer to here.
To put everything together, here is how you can setup and test it:
  1. Create a test table with xmltype column:
    • CREATE TABLE xwarehouses (
      warehouse_id NUMBER,
      warehouse_spec XMLTYPE)
      XMLTYPE warehouse_spec STORE AS CLOB
      (TABLESPACE catusedt
      STORAGE (INITIAL 6144 NEXT 6144)
      CHUNK 4000
      NOCACHE LOGGING);
  2. Alter the table to change the LOB tablespace:
    • alter table xwarehouses
      move LOB(warehouse_spec.XMLDATA)
      STORE AS xwarehouses_seg
      (TABLESPACE catusedpht
      STORAGE (INITIAL 6144 NEXT 6144)
      CHUNK 4000
      NOCACHE LOGGING);

Friday, May 04, 2007

Error queue - records with "Client was out of sync" message

We are seeing Client was out of sync in our Oracle Lite Server Error Queue, my colleague found this post, which helps us understand how to fix this kind of problem. Here are my notes regarding to it:
  1. Login to Mobile Manager; goto Error Queue; select the Transaction ID you are interested in; Publication Items.
  2. Select the Publication Item you are interested in; View records; The DML Operation most likely will show 'Error'; Check th rows you would like to change the Update DML ; Select the desired 'Update DML' from the top left drop down(to choose between insert and update, depends whether that row exists in your application database), then Click Go; You should see the DML Operation changed to the desired one, rather than Error.
  3. Click 'Apply'; You should see Confirmation: Changes were applied successfully.
  4. Repeat step 2 and 3 for all the publication items in that transaction.
  5. Back to Error Queue, select the Transaction you worked on, click Execute.
  6. Go back to Mobile Manager home page you should see your transaction in the In Queue(1).
  7. Refresh the page to see the MGP active, then return to Idle, make sure your Transaction does not reenter to the Error Queue.

Wednesday, May 02, 2007

Using keepalives to prevent disconnection after idle for some time

Connection to some remote Unix server get disconnected too often? Try to set the PUTTY sending null packet in the Connection configuration Category

Please refer to here.

Set the JVM platform default character encoding to UTF-8

You could set the JVM platform defalult character encoding to UTF-8 by using the following JVM option:
-Dfile.encoding=UTF-8

Make sure this flag come before your Main program name, especially when you are calling org.apache.tools.ant.Main.

Please refer here.