sakthi's blog

Monday Feb 06, 2006

Sun Studio 11 Developers - Get Expert Assistance for FREE!

The Sun Developer Tools Organization is sponsoring a new pilot on-line service: Per Incident Developer Support for Sun Studio 11. This service is now live on SDN and can be accessed at:


     http://developers.sun.com/developer_help/

For this pilot phase, the cost per incident for developers is $0 (yes, FREE). YAY!!!

Thursday Feb 02, 2006

What and Where is IDE's user directory?

For Creator 2, IDE's default user directory is at: $UserHome/.Creator/2_0

$UserHome is
- On Windows, C:\DOcument and Settings\$username
- On Unices, it is users home directory

Users can specify their own user directory with an argument while starting IDE like:
On Windows C:\Sun\Creator2\bin> creator.exe -userdir $user_specified_userdir
On Unices, \home\$username\Creator2\bin\creator -userdir $user_specified_userdir

IDE's user directory contains changes, configurations and resource additions that user's perform with IDE like
- Adding New JDBC Drivers
- Adding New DataSources
- Adding New WebServices and EJB's for consumption via Servers Window
- Making changes to IDE Options like editor settings, proxy changes

IDE usually uses new user directories across new releases. Some releases might provide a way to import users directories that contain their settings from the previous release.

Warning:

Purging the userdirectory would be equal to cleaning up all the configuration changes that has been done to the IDE installation by user, like reverting back to the Out-of-the-box state. Corrupt user directories could result in some unexplainable behavior in IDE. In such cases, users are suggested to restart their IDE with a new userdir to see if their problem goes away.

Wednesday Feb 01, 2006

How to upload and retrieve text files to/from Database CLOB column?

This Simple Creator 2 Project zip demos how to upload text files into database CLOB column and retrieve back those files.

How to get the sample app running:

  • Download and extract the project zipfile into a directory
  • Create a table DEMO_CLOB in PointBase Order datasource i.e., Invoke View Data on Order Datasource in Servers window. Copy & paste this SQL into the textarea and click RunQuery button to execute the command. This SQL creates the required table in PointBase sample database PBPUBLIC schema.
    CREATE TABLE DEMO_CLOB ( ID_COL INTEGER IDENTITY PRIMARY KEY, CLOB_COL CLOB)
  • Open the project in Creator and Click on Run Main Project (aka Green Arrow) tollbar button
  • Click Browse and choose a text file.
  • Click Upload to updload this into database. It also retrieves back all the rows in this database table and displays using in a table component.
  • What's wired in this project:

    • A ClobConverter class. It is declared in WEB-INF/faces-config.xml and the attribute converter="ClobConverter" is added in JSP to the tableColumn bound to CLOB_COL
    • Upload button action fetches the file contents and updates the database

    screenshot - click to see full size

    Friday Jan 27, 2006

    How to upload and retrieve BLOB Datatypes to/from database?

    It is very common among web applications to upload files like Images, PDF’s into database and retrieve them when user needs to view those files. This Creator 2 Project zipfile available here demos this task.

    • Download and extract the project zip into a directory
    • Create a table DEMO_BLOB in PointBase Order datasource i.e., Invoke View Data on Order Datasource in Servers window. Copy & paste this SQL and click RunQuery button to execute the command. This SQL creates the required table in PointBase sample database PBPUBLIC schema.

    CREATE TABLE DEMO_BLOB (
    IDCOL INTEGER IDENTITY (1,1) PRIMARY KEY,
    BLOBCOL BLOB)

    • Open the project in Creator and Click on Run Main Project (aka Green Arrow) toolbar button

    • Click Browse and choose an image file. A few sample images files are available in the project at $Demo_Blob/web/sample_images folder

    • Click Upload Button to updload this into database. It also retrieves back all the images in this database table and displays using in a table component.

    What’s wired in this project:

    • DisplayServlet that pulls the image for a given ID.

    • Upload Button action handler inserts a row with the imagefile into database table DEMO_BLOB.

    • Image component in the table uses the DisplayServlet URL to retrieve the image from database

    • Servets and servlet-mappings have been declared in WEB-INF/web.xml

    screenshot - click to see full size

    Navigating through a Large RowSet

    By Default, when database tables are dropped onto a page or a component like Table, it is configured to retrieve all rows on its execution. There are use cases where we don't want to be doing this, particularly, when table has thousands or millions of rows. In such cases, it would be good to set pagesize property appropriately, to limit the number of rows retrieved at a time.

    This Sun Java Studio Creator 2 Sample Project available here demo's how to set up navigation through such large rowsets. It uses cachRowSet.nextPage() and crs.previousPage() to navigate through the rowsets.


    screenshot - click to see full size

    Note: When clicking NextPage button for the first time, it doesn't navigate to the next page.Whereas successive clicks on NextPage works fine. This is a known issue in the product.

    Calendar

    Feeds

    Search

    Links

    Navigation

    Referrers

    Today's Page Hits: 16