Wednesday, May 27, 2009

Important Sites and Links

Link to upload large size documents and send via mail
www.youSENDit.com

Proxy links
kproxy
http://www.publicproxyservers.com/page1.html
http://www.terj.info
http://aflu.info
http://www.anonymoususer.biz
http://deeproxy.com
http://www.rosc.info

Monday, May 25, 2009

Java- Searching a matching countrycode column from database, exception code

String myNumber = destNumber.substring(1);
if(myNumber.startsWith("00")){
myNumber = myNumber.substring(2);
} else if(myNumber.startsWith("0")) {
myNumber = myNumber.substring(1);
} else if(myNumber.startsWith("+")){
myNumber = myNumber.substring(1);
}
try
{
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection (dbUrl);
s = conn.createStatement();
s.executeQuery("SELECT CountryCode, CountryName, CallRate FROM ratestable");
rs = s.getResultSet();
boolean myMatch = false;
while(rs.next())
{
String myLocalNumber = "";
String myCountryCode = rs.getString(1);
if(myNumber.startsWith(myCountryCode)){
myMatch = true;
myLocalNumber = myNumber.substring(myCountryCode.length());
System.out.println("Country Code:"+myCountryCode+"Local no="+myLocalNumber);
myArrayList.add(myCountryCode);
myArrayList.add(rs.getString(2));
myArrayList.add(rs.getString(3));
myArrayList.add(myConnectionType);
myArrayList.add(myLocalNumber);
return myArrayList;
}
}

Date Query (Records between fromdate and to date) in MYSQL DB

SELECT calldate FROM dateTable WHERE calldate between STR_TO_DATE('05/01/2009','%m/%d/%Y') and STR_TO_DATE('05/25/2009','%m/%d/%Y')

Friday, May 22, 2009

Sampel Date Example in JAVA

package mysamplesprj;import java.util.*;
public class DateSample2
{
public static void main(String[] args)
{
Calendar c1 = Calendar.getInstance();
System.out.println(c1.get(Calendar.YEAR));
int month = Integer.parseInt(String.valueOf(c1.get(Calendar.MONTH))) ;
month = month + 1;
System.out.println(month);
System.out.println(c1.get(Calendar.DATE));
}
}

Java Code to use SSO login

Q) How to bind java application to SSO i.e whenever someone tries to access application he is prompted for oracle SSO
A) Add the following code to first page of you application, and deploy you application to oas, your job is done.
String portalUser = request.getRemoteUser();
try
{
portalUser = request.getRemoteUser();
System.out.println(portalUser);
}
catch(Exception e)
{
portalUser = null;
}
if ((portalUser == null) (portalUser.length() <= 0))
{
response.sendError(499, "Oracle SSO");
}

Wednesday, May 20, 2009

Deploying java application from jdeveloper to oracle application server

Q) you want to deploy a java application on oracle application server from jdeveloper
A) once u hav created a java application in jdeveloper
1) Create a war file( right clk project->new->deployment profile->war file)
2) once the war file is created, right click the war file and deploy the war file ( rt clk war file->deploy to war)
3) In the deployment window you will see the path where the war file got deployed, copy this path.
4) Go to oracle application server, oc4j instance and application tab,
5) you will see deploy war option there , now give the copied path and the two values.. eg
application name: mytestapplication
mapping: /mytestapplication
ur application is ready , now check ur application on port 7777

eg http://myserver.com:7777/mytestapplication/index.jsp

Run Java Application Deployed on oracle application Server

assume ur application name is sample and deployed on myserver (oracle app server)
you need to execute ur application on port 7777
eg
http://myserver:7777/sample/index.jsp

Java Application On Oracle Application Server & accessible only to priviledged users

Q> Java application deployed on oracle app server, need to make it accessible only to group of users?
A>
1) Login oracle portal
2) Create a dynamic page
3) In region of this page, create an item- u may use an image or link item
4) Assign java application url to this item
5) While creating this item u will see access option, grant access to specific group or user
6) when ever these users will login they will see this link/image on clicking this the will be able to see the java application