Saturday, February 13, 2010

Android/ JDBC

Hi,

This week i was able to develop an Android App to get data from an Oracle Database.

Here is my Code .


package com.prem.JDBCAndroid;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import android.app.Activity;
import android.database.SQLException;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import android.util.Log;

public class JDBCAndroid extends Activity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

try {
String userName = getDataFromOraDB();
TextView tv = new TextView(this);
tv.setText(userName);
setContentView(tv);
} catch (SQLException e) {
Toast.makeText(this, e.getMessage(), 1).show();
} catch (ClassNotFoundException e) {
Toast.makeText(this, e.getMessage(), 1).show();
}

}

public String getDataFromOraDB() throws SQLException,
ClassNotFoundException {

String name = null;
String jdbcURL = "jdbc:oracle:thin:@hostname:portname:sid";
String user = "uname";
String passwd = "pwd";
// Load the Oracle JDBC driver

try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn;
ResultSet rs;
Statement stmt;
conn = DriverManager.getConnection(jdbcURL, user, passwd);
stmt = conn.createStatement();
rs = stmt.executeQuery("select USERNAME from SomeTableName");
if (rs.next()) {
name = rs.getString("USERNAME");
}
} catch (java.sql.SQLException e) {
// TODO Auto-generated catch block
System.out.println("the exception is" + e.toString());
}

Toast.makeText(getApplicationContext(), name, 1).show();
return name;
}

}





If you still have issues please check your AndroidManifest.xml file if it has the

below line

uses-permission android:name="android.permission.INTERNET"

TimeZone in Workbrain5.0.21

ETM_CLOCK_FACTOR_TIME_ZONE


Description: This parameter determines how an employee’s time zone is determined. When set to client_browser, the time zone is set by the user’s PC, although the actual date and time from the PC is not used.

When set to employee_udf, employee time zones are determined from stored values in the TIMEZONE table. If the employee does not have EMPLOYEE.TZ_ID set, then server time is used.

When set to False, all time zones are the same as the server.



Valid Values: client_browser, employee_udf, False

Default Value: False

Location: system/WORKBRAIN_PARAMETERS/

-Prem

Time out in Workbrain5.0.2.1

a.Application SessionTimeOut

This happens through registry setting

Select * from workbrain_registry where wbreg_name='timeout'



b. PageSession TimeOut


Application gives an option to the user to set their timeout on
specific pages (only sys admins can configure this.)


select * from workbrain_page gives the list of pages which are configured for a page level time out.

I changed this as we do not want this to be same as App time out for some business reasons.

A page session Time out takes Priority if it is less than Application TimeOut

-Prem

SQl Server Datasource Configuration/ORacle ESB

The below metalink note helps to configure a sql server datasource .

after which we can create a Database adapater

How To Setup Database Adapter Interfaces Using a Microsoft SQL (MSSQL) Server 2000 Database [ID 737497.1]


I was able to move the legacy data to an oracle ERP database through routing service of Oracle ESB


Thanks
Prem

Wednesday, January 27, 2010

InBound Security in BPEL

Hello All,

A simple way to protect a BPEL Process.

1. Navigate to the /$ORACLE_HOME/bpel/domains/Domain_name/config/message-handlers.xml

2. Configure the process name which needs to be protected in the 'SecuredProcesses' tag

3.



property id="SecuredProcesses"



inbound-flow
message-handler id="Domain"
message-handler id="security"
inbound-flow






4. Generate a encrypted password based on DES algorithm.(i did through a java class)

[CDATA[TOEXz08rReMqnYt1uPZFjw==]]

10.1.3.3.1 works only with a DES algortihm .

Make sure the password is a properly encrypted if you miss one character you will

get a cipher error while deploying.

5. paste the below two lines in your bpel.xml file

configurations
property name="user" encryption="plaintext" oc4jadminproperty
property name="pw" encryption="encrypted" CDATA[TOEXz08rReMqnYt1uPZFjw==]]"property
configurations

make sure the you dont miss tags in the above encryption.

6. Deploy the process

7. used Soap UI for testing. Please make sure you pass the username /password in the token through soap header


Thanks
Prem.

Sunday, January 17, 2010

JPA Databinding in JSF Page

Hello All,

The screen shots below will help you to develop a page and bind data from a jpa data control.

Steps to build this very simple app.

1.Create database connection in your connection Navigator.

2.Import the tables as entities.

3.right click the imported entity and create a service Facade.
one the facade is created write few lines of code to view your data(it returns in a list ,you can use an iterator..) from the table.

4.Right click the Javaservice facade to create data control.

5.Create a jsf jsp page(this includes adf faces,adf core taga while creating).

6.Drop a panel page from adf tags.

7.select your desired method ,from the data control palette and drop it on the Panel page ,whick will ask you to select the table type(you can choose any type )

8.Rebuild your project.set the default target and the new jsp page you created in step 5 and run the project.

9.You should see the data.

Please let me know if you have issues.

Thanks
Prem









































Sunday, December 13, 2009

Blackberry/OracleBPEL

This week i got an oppurtunity to call a BPEL webservice from a blackberry.

Blackberry developement community recommends to use ksoap2 a lightweight soap engine to call a webservice.


I Hope the notes below will help people who are new to blackberry development and BPEL

Simple Steps to get the app running on your blackberry.

a. Install Eclipse 3.4 and JDE plugin(It has JDE 4.5 component pack)

b. Start MDS

How to Start MDS?

MDS for JDE 4.5 need a JRE 1.6 .So please make sure it is installed correctly.

go to command prompt ,navigate to the below path

C:\Program Files\Eclipse2\plugins\net.rim.eide.componentpack4.5.0_4.5.0.16\components\MDS

run.bat

To Verify MDS.

in the simulator ,click the browser and verify if you are able to see a web page( http://www.google.com)

c. Add the preverified ksoap2 jar to your class path.

d. use the below code to call a Oralce bpel webservice.



try{

/*paste your end point URL from BPELConsole in the argument of HTTP Transport constructor.*/


HttpTransport ht = new HttpTransport("http://hostname:port/orabpel/domain/serviceEndPoint/1.0");

/*I am using Oracle BPEL 10.1.3.3.1 which uses soap 1.1 bindings.Please make sure about you soap version and select the version

for eg:

soap binding 1.1 choose SoapEnvelope.VER11

soap binding 1.2 choose SoapEnvelope.VER12*/


SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

SoapObject request = new SoapObject("schemaName","elementName");


//send parameters to your BPEL Process. request.addProperty("input","890");
envelope.setOutputSoapObject(request);

//the first param in the belowline of code is your operation name on the bpel webservice.

ht.call("soapAction",envelope);

Note:soapAction is the operation name in your WSDL.

//in case if you call a Synchronous webservice

Object soapIn = envelope.getResponse();

System.exit(0);

}catch(Exception e){
System.out.println("inside catch"+e.toString());
}

}
};


e. Right Click the Project . Select Generate Alx.

f. Plug your blackberry through USB. Start the Desktop manager.

G. Since this simple project is not using any api which requires signing we can deploy it without the RIM keys.

Please let me know if you have any questions.
Thanks
Prem