Pillai’s

Technology and Everything…..

Connecting to Oracle 11g from Grails

Posted by Shibu on October 20, 2010

If you are connecting to Oracle 11g and getting Hibernate Dialect related error, try adding following in the DataSource.groovy file
dialect=’org.hibernate.dialect.Oracle10gDialect’.
You should add this in the datasource section and not in the hibernate section

Advertisements

Posted in Uncategorized | Tagged: , | Leave a Comment »

Grails + Oracle

Posted by Shibu on October 19, 2010

If you are wondering how to use Grails  (from windows) with Oracle,

  • Download Grails from Grails  website. I used version 1.3.5
  • Unzip to your local folder (c:\grails-1.3.5)
  • You have to detine environment variable  JAVA_HOME. Ponit JAVA_HOME to your JDK. I am using version 5.0
  • Include the bin directory of grails installation into your PATH variable. (set PATH=%PATH%;c:\grails-1.3.5\bin)
  • Test your installation. Open a comman prompt window and type grails. You should see like below

C:\Users\xx>grails
Welcome to Grails 1.3.5 – http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: C:\grails-1.3.5

No script name specified. Use ‘grails help’ for more info or ‘grails interactive’ to enter interactive mode
C:\Users\xx>

  • If you see any error message, fix them before proceeding to next step
  •  You can see following steps in Grails website
  • Create a new project using command, grails create-app my-project, from command prompt. You issue this comman from any custom directory you have created for this project
  • Configure Data Source. This is optional, but this where we have setup if we need to connect Oracle Database. Following example shows what I have done to connect to my Oracle Database. You need to modify the DataSource.groovy file like below.

             dataSource {
                    pooled = true
                    driverClassName = “oracle.jdbc.OracleDriver”
                    username = “<schema_name>”
                    password = “<schema_password>”
                  }
                  hibernate {
                       cache.use_second_level_cache = true
                       cache.use_query_cache = true
                       cache.provider_class = ‘net.sf.ehcache.hibernate.EhCacheProvider’
                   }
                 // environment specific settings
                   environments {
                  development {
                          dataSource {
                                       dbCreate = “create-drop” // one of ‘create’, ‘create-drop’,’update’
                                        url =”jdbc:oracle:thin:@<ServerName>:<Port>:<SID>”
                                  }
                   }
                   test {
                           dataSource {
                                        dbCreate = “update”
                                         url = “jdbc:oracle:thin:@<ServerName>:<Port>:<SID>”
                            }
                     }
                     production {
                                     dataSource {
                                            dbCreate = “update”
                                            url =”jdbc:oracle:thin:@<ServerName>:<Port>:<SID>”
                                    }
                      }
               }

You have to use appropriate server names, ports and SID names

  • Now you have to copy ojdbc14.jar to the lib directory of your Grails Application. This Oracel jar file you can get from any Oracle installation. For example if you have install SQLDeveloper, JDeveloper or Orcel XE you should be able to find this jar file within the subdirectory.
  • Now create domain class using command  grails create-domain-class book
  • The above command should create Book.groovy. Edit the Book.groovy file and add your attributes. This should match with your table field names. I added like below as suggested in Grails site,
class Book {
    String title
    String author
}
  • Create controller, grails create-controller my.project.Book
  • Above command should create file BookController.groovy. Modify this controller file like below as suggested in the Grails website
class BookController {
     def scaffold = Book // Note the capital "B"
}

 

 



Posted in Uncategorized | Leave a Comment »

How to extend a VO in Oracle OAFramework

Posted by Shibu on November 10, 2008

Suppose that you want to change the sql in a LOV, how will you do that in oaframework? Ok, first make sure that you did set up your JDeveloper Environment correctly for oaframework. Now enable personalizations. Go to the page which has the LOV that you want to change. Let’s extend supplier lov in the receiving screen in iProcurement. So go to the “Receiving” tab and click on “Return” items. You will get screen like below
Return Items

Return Items

Now click on the LOV “torch” for Supplier field, you should get screen like below.

Supplier LOV

Supplier LOV

In this page click on the “About Page” link at the bottom. Click on the Business Objects and you should get page like below

AboutPage

AboutPage

Now from this screen you should be able to see the VO Name for the LOV. Since we have to change “Supplier” LOV you can figure out that the VO which we have to extend is SupplierAndSiteLovVO

Note the full name of the VO, oracle.apps.icx.lov.server.SupplierAndSiteLovVO. You should have a class named SupplierAndSiteLovVO.class in the directory <JDeveloper Install Directory>/jdevhome/jdev/myclasses/oracle/apps/icx/lov/server

Now in Jdeveloper, click on “Add to <your project name>.jpr….” link in the “Project” menu like below, in my case project name is ExtendLbSolution

Addtoproject

When you get “Add Files or Directories to <your project name>.jpr” window, open the server.xml file from <JDeveloper Install Directory>/jdevhome/jdev/myclasses/oracle/apps/icx/lov/server directory. This will create a library in your Jdeveloper project (oracle.apps.icx.server). If you expand this you will see all the VOs and AMs from that directory.

You have to make sure that you have completed these steps before proceeding further.

Now lets extend Oracles’s class SupplierAndSiteLovVO.

1) Now that you have added Oracle library to your project you should get something similar to shown below. Not that I have added oracle.apps.icx.lov.server to my project demo1.jpr

Oraclelibrary

Oraclelibrary

2) Now create a new “Business Components Package”. I created oa.demo so that all my new classes will be deployed in this package. Click on “New” from “File” menu and choose “Business Components Package” like below

Businesscomponents

Businesscomponents

3) Now let’s create a new View Object. Like above create a new components and this time choose “View Object” from the “Business Componets (BC4J)” list

4) First you will get the Welcome screen in the wizard click next . Choose oracle.apps.icx.lov.server.SupplierAndSiteLovVo in the “Extends View Object”. Package should be your package name and Name is your package name

Extendvo

Extendvo

Posted in Technology | Leave a Comment »

How to set up your JDeveloper Environment for OAFramework

Posted by Shibu on October 12, 2008

 You can see many notes in metalink as well as many other websites which explains this in detail. However I will just go thru the setups briefly

1)     Download the patch () from Metalink – Note that this patch is just a zip file, you just need to unzip to your directory

2)     Once patch is downloaded click on jdev.exe in from where you unzipped and make sure that you are getting JDeveloper window

3)     You need to download all class files from your JAVA_TOP from the server to desktop. I have downloaded all files, you can just download icx directory. Go to $JAVA_TOP in your server and zip everything from oracle. FTP this zip file to your descktop and unzip to <JDeveloper Install Directory>/jdevhome/jdev/myclasses

4)     Now you have to copy the dbc file from your server to desktop. You should have the dbc file in your server under $FND_TOP/secure directory. Copy the <SID>.dbc file to <JDeveloper Install Directory>/jdevhome/jdev/system9.xxx/oa/dbc_files/secure in your desktop

5)     In JDeveloper, create a new workspace and a new project. Once a project is created, go to the menu “Project” and click on “Project Settings” You should see the screen like below. You should choose your dbc file

Project Settings

Project Settings

6)     You should create a database connection for your server too.

Posted in Technology | Leave a Comment »

How to enable personalizations in Oracle 11i

Posted by Shibu on September 22, 2008

You can enable personalizations at any level. Normally you should enable for a particular person who maintains the personalizations. Set  following profile option to ‘Yes’ to enable personalizations

 

Personalize Sefl-Service Defn

Posted in Technology | Leave a Comment »

Accessing Oracle Database from Unix Shell Script

Posted by Shibu on August 5, 2008

Many times when you develop shell script for deployment or batch job often you have to check some database field values. I will show you how you can access database field value into unix shell variable.

DB_CHECK=NOTOK

DB_CHECK=`sqlplus -s user_name/<pass_word> <<EOF

set pages 0

set lines 2000

set heading off

select ‘OK’ from dual;

exit

EOF`

echo $DB_CHECK

Here you can have multiple line in the select statement. If you have multiple lines you have to put ‘\’ at the end of each line except the last line.

Posted in Technology | Tagged: | Leave a Comment »

Forgot default password for OWSM ?

Posted by Shibu on April 11, 2008

The default password for administration user (admin) of OWSM is oracle. In any case if you are not able to login with that user, you can create a new user with a new password.

Login into the machine where you installed your SOA components. Change your directory to …/owsm/bin. OR just find the file manageUserGroups.properties using command “find . -name manageUserGroups.properties”

Create following entries in the file

user_id=<YOUR USER ID eg: admin1 >
user_name=<YOUR USER NAME eg:admin user name >
user_password=<YOUR PASSWORD eg:welcome1>
user_email=admin@xyz.com

group_id=su1-grp
group_desc=super user group

Now we will create this user using following commands like below.

wsmadmin.sh manageUserGroups addUser
wsmadmin.sh manageUserGroups  addUserGroup

Try loging with your new user name and password

http://<yourhost&gt;:<port:/ccore

Posted in Technology | 2 Comments »

Getting Started with Oracle BAM

Posted by Shibu on March 27, 2008

What is Business Activity Monitor (BAM) ? BAM is not a just a tool for reporting or creating executive dashboards. BAM provides the ability to take corrective action in production environment by using real-time operational dashboards and monitoring business process/services or alerts.

Once you install Oracle BAM, you will get four components. You should navigate to the start page which is by default http://localhost:/oraclebm. Once you authenticate yourself using the username/password you used while installation, you will receive the starting page. In this starting page you can see link to Active Viewer, Active Studio, Architect and Administrator.

I will explain how to create a simple report by connecting to an Oracle Database. First step you have to do is to create an external data source. In order to do this, click on the Architect link. Select “External Data Sources” from the top left corner from the Architect screen. You should get screen like below


Click on the Create link. You should get a screen like shown below.
As you can see in the picture enter a name and description for the Data Source. In the Driver field enter “Microsoft ODBC for Oracle”. This should be entered exactly as you can see in the “ODBC Data Source Administrator” screen. Enter user name and password for the Oracle Database. In the Connection String field enter “server=”.

Now that you have created an external data source, you are ready to create data objects.

Choose “Data Objects” and click on create link. You should get screen shown below.
Enter name of the database object as you like. Click on the “External Data Source” and you can choose the database name in the “External Data Source”. Type in the actual table name in the “External Table Name” field. This should be the actual database table name.
Then click on “Add a field” link and enter proper values for the database table field. External Field Name should be same your database table field name.

You are set to start creating a new report in BAM. What I have done is created a view which shows sum of amount for different countries.

On the start page of BAM, click on “Active Studio”
You should get window like shown on the left side. This shows different templates. You can choose the one that fits your requirements. I have chosen a simple one, first template. Click on the first icon. You can click on the top and enter a title. From the different icons click on “3D Bar Chart”. You will get a window like one shown below right side.

You can choose the data object that you want for this report. Choose the view you have created for this report and press next button. You will get window like show below left side. Choose the fields you want to group by and the fields you want to show as the chart values.

Press next button and you should see your report. If you have created view appropriately you should get a chart like one show on the right side.

Posted in Technology | 1 Comment »

ESB Endpoint Virtulizations

Posted by Shibu on March 26, 2008

If you are using Oracle BPEL and ESB you might be wondering when and where ESB should be using? or What is the value addition of using ESB over BPEL.

Well, one of the many advantages is endpoint virtualization. Suppose that you have a BPEL process and it invokes a database procedure from a legacy application using database adapter. Most likely you will have an assign process before the invoke process to map input variables to the variables used by the partner link that invoke legacy system (as shown in the figure)
In this case BPEL Process is bound to the endpoint that communicates with the legacy system. Using ESB we can avoid this dependency make BPEL transparent to the endpoint. In this way BPEL can concentrate on Business Process and not worry about protocol transformation.

Most of artifacts in the BPEL can be reused. So using the WSDL file used for the partner link in BPEL create a ESB Service. You should have a perfect clone of the partner link as the new ESB System

You should have image as shown on the left side. Now that you have created the ESB process you have to create routing service to expose these two operations Update/Delete to outside world. Routing service will talk to the outside world using a partner link like in BPEL. I have attached diagram for routing service. (Please note that I made a screen print of the diagram and modified using <a href=http://www.gimp.org”>Gimp</a> for clarity)

Routing Rules

Now BPEL will be interacting with infrastructure end point as ESB stays within the infrastructure. Thus Actual endpoint is virtualized behind the infrastructure endpoint by ESB which is hot pluggable.

 

 

Posted in Technology | Leave a Comment »

Why SOA is Successful?

Posted by Shibu on March 20, 2008

If I try to explain SOA or define what is SOA, I think it is just waste of my time and your’s too (if you are reading this post!!). Because, I think anyone in IT industry might have at least heard once, what is SOA or what it can do? I just want to dig into the evolution of SOA and figure out how it became the current BUZZ.

The technologist’s quest for interoperability has its roots way back decades ago. Industry leaders and researchers are constantly trying to find a solution where communication between different computer system is possible without loss of meaning. By meaning, I meant data should be interpreted by the same way in all systems. This effort of companies resulted in the paradigms, OMG’s (1991) Common Object Request Broker Architecture (CORBA), Javasoft’s JAVA/ Remote Method Invocation (RMI) and Microsoft’s Distributed Component Object Model (DCOM)

Have you ever thought why CORBA did not become popular? I agree that it did not had the flexible standard interface language (XML) which currently is the basis of SOA. CORBA uses IDL (Interface definition language) which can be mapped to a number of existing languages. CORBA enabled distribution of objects implemented in a variety of programming languages using IDL. CORBA was much supported by Oracle and Netscape. DCOM was supported by Microsoft.

Technology world is ruled by big corporations like Microsoft, IBM, Oracle and SUN. So for any standard/technology to become popular it needs the blessings from these corporations. When Microsoft and others differed in their architecture for distributed computing, other vendors where in limbo as which technology their product should base on. You can see the same issue today with the DVD formats, if it is Blue Ray or High Definition DVD? After Wal-Mart pulls out all High Definition DVD’s from its store in June’ 08, do you think HD DVD supporters can survive? of course it will die.

I guess this is exactly what is behind the success of current SOA. Once Microsoft agreed on and started support on WebService with other major players like Oracle, IBM and Sun, this became widely accepted by all other vendors. Other vendors can confidently market their product based on SOA as it will most probably accepted by their client!!

Posted in Technology | Leave a Comment »