Home » Applications » Oracle Fusion Apps & E-Business Suite » Problem about 9i Lite API test code.. help.. pls..
Problem about 9i Lite API test code.. help.. pls.. [message #95089] Wed, 23 October 2002 01:37 Go to next message
jerry kim
Messages: 1
Registered: October 2002
Junior Member
Hi, I wrote some code for creating publication, subscribing publication and then instiating subscription.
When I excute my sample code, I can't find any error message except some ignored kinda message..
After that I launch Mobile Server Control Center and then check if new mobile application is added.
I couldn't find my new one..
is that any fault my source code..?
my test app code like follow...
I'll appreciate for any comment.
Thanks advance..

[[Publication.java]]
import java.sql.*;
import oracle.lite.sync.*;
import oracle.mobile.admin.*;

public class Publication
{

public static void main(String args[[]])
{

try {

Statement s = null;
Connection con =getConnection( "MOBILEADMIN", "MANAGER" );
con.setAutoCommit(true);
//mgr.OpenConnection(con);
//ResourceManager.openConnection(con);
ResourceManager.openConnection( "MOBILEADMIN", "MANAGER" );
ConsolidatorManager mgr = new ConsolidatorManager();

try {
s = con.createStatement();
} catch (SQLException e) {
System.out.println("con.createStatement failed: " + e + "n");
System.exit(0);
}

/*try {

String stmt = "drop table scott.test01";

s.execute(stmt);
s.close();
} catch( Exception e ) {
e.printStackTrace();
}*/

try {

String stmt = "drop table test01";

con.commit();
s.execute(stmt);
} catch( Exception e ) {
//e.printStackTrace();
System.out.println( "==========================================================1" );
}

try {

String stmt = "create table TEST01(empno, ename, deptno, dname) as " +
"select t1.empno , t1.ename , t1.deptno , t2.dname " +
"from emp t1 ,dept t2 " +
"where t1.deptno = t2.deptno ";

con.commit();
s.execute(stmt);
s.close();
} catch( Exception e ) {
e.printStackTrace();
System.out.println( "==========================================================1" );
}

try {
s = con.createStatement();
String stmt = "ALTER TABLE TEST01 ADD(CONSTRAINT TEST01_PK PRIMARY KEY(EMPNO))";

con.commit();
s.execute(stmt);
s.close();
con.close();
System.out.println("Connection closed!!!");
} catch( Exception e ) {
e.printStackTrace();
System.out.println( "==========================================================3" );
System.exit( 0 );
}

System.out.println( "####################### OpenConnection ######################" );
try {
mgr.OpenConnection( "MOBILEADMIN", "MANAGER" );
} catch (Throwable e) {
e.printStackTrace();
System.out.println( "OpenConnection==========================================================" );
System.exit( 0 );
}

System.out.println( "####################### DropPublication ######################" );
try {
mgr.DropPublication("PUBLISH01");
} catch (Throwable e) {
e.printStackTrace();
System.out.println( "DropPublication==========================================================" );
System.exit( 0 );
}

System.out.println( "####################### CreatePublication ######################" );
try {
//mgr.CreatePublication("PUBLISH01", Consolidator.OKPI_CREATOR_ID, "%s", null );
mgr.CreatePublication( "PUBLISH01", Consolidator.OKAPI_WIN32, "%s", null );
} catch( Throwable e ) {
e.printStackTrace();
System.out.println( "CreatePublication==========================================================" );
System.exit( 0 );
}

System.out.println( "####################### DropPublicationItem ######################" );
try {
mgr.DropPublicationItem("PUBLISH01_ITEM01");
} catch (Throwable e) {
//e.printStackTrace(); ignore error
}

System.out.println( "####################### CreatePublicationItem ######################" );
try {
mgr.CreatePublicationItem( "PUBLISH01_ITEM01", "MOBILEADMIN", "TEST01", "F", "SELECT EMPNO, ENAME, DEPTNO, DNAME FROM TEST01", null, null );
//mgr.CreatePublicationItem( "PUBLISH01_ITEM01", "TEST01", "MASTER", "F",
//"SELECT EMPNO, ENAME, DEPTNO, DNAME FROM TEST01", null, null );
} catch( Throwable e ) {
e.printStackTrace();
System.out.println( "CreatePublicationItem==========================================================" );
System.exit( 0 );
}

System.out.println( "####################### CreatePublicationItemIndex ######################" );
try {
mgr.CreatePublicationItemIndex("ID_PUBLISH01_ITEM01", "PUBLISH01_ITEM01", "P", "EMPNO");
} catch( Throwable e ) {
e.printStackTrace();
System.out.println( "CreatePublicationItemIndex==========================================================" );
System.exit( 0 );
}

System.out.println( "####################### AddPublicationItem ######################" );
try {
mgr.AddPublicationItem("PUBLISH01", "PUBLISH01_ITEM01", null, null, "S", null, null);
} catch( Throwable e ) {
e.printStackTrace();
System.out.println( "AddPublicationItem==========================================================" );
System.exit( 0 );
}

/*System.out.println( "####################### createUser ######################" );
try {
ResourceManager.createUser("TESTER", "UNIBOSS", "PUB TESTER", "U");
} catch( Throwable e ) {
e.printStackTrace();
System.out.println( "createUser==========================================================" );
System.exit( 0 );
}*/

System.out.println( "####################### CreateSubscription ######################" );
try {
mgr.CreateSubscription("PUBLISH01", "otn");
} catch( Throwable e ) {
e.printStackTrace();
System.out.println( "CreateSubscription==========================================================" );
System.exit( 0 );
}

System.out.println( "####################### InstantiateSubscription ######################" );
try {
mgr.InstantiateSubscription("PUBLISH01", "otn");
} catch( Throwable e ) {
e.printStackTrace();
System.out.println( "InstantiateSubscription==========================================================" );
System.exit( 0 );
}

System.out.println( "####################### Closing...######################" );
try {
ResourceManager.commitTransaction();
ResourceManager.closeConnection();
mgr.CloseConnection();
} catch( Throwable e ) {
e.printStackTrace();
System.out.println( "commitTransaction==========================================================" );
System.exit( 0 );
}

} catch(Throwable e) {
e.printStackTrace();
System.out.println( "==========================================================all" );
System.exit( 0 );
}
}

private static Connection getConnection(String user ,String password)
{
Connection conn =null;
try
{
DriverManager.registerDriver((Driver)(Class.forName("oracle.jdbc.driver.OracleDriver").newInstance()));
}
catch(Exception e)
{
e.printStackTrace();
}

try
{
conn=null;
String jdbc_url = "jdbc:oracle:thin:@211.53.11.57:1521:ora817";
//String jdbc_url = "jdbc:oracle:oci8:@WEBTOGO.WORLD";
conn = DriverManager.getConnection(jdbc_url,user,password);
}
catch(Exception e)
{
e.printStackTrace();
}
return conn;

}

private static void dropPublicationItem(String pubItem) throws Throwable
{
try {
Consolidator.DropPublicationItem(pubItem);
} catch (ConsolidatorException e) {
if (e.getErrorCode() == oracle.lite.sync.ConsErrorMessages.PUB_ITEM_NOT_FND)
System.out.println("Pub item not found");
else
throw e;
}
}

}
Re: Problem about 9i Lite API test code.. help.. pls.. [message #95182 is a reply to message #95089] Wed, 26 February 2003 03:58 Go to previous messageGo to next message
Liza
Messages: 3
Registered: September 2002
Junior Member
Hi..

have u got the solution?
Re: Problem about 9i Lite API test code. help. pls. [message #95989 is a reply to message #95089] Thu, 15 July 2004 04:33 Go to previous message
Narendra
Messages: 10
Registered: March 2001
Junior Member
How do u implement Connection Pooling in Oralce 9i lite
Is it possible or not?If yes please give mail us in detail.
Previous Topic: Zero Amount Receipts in Oracle Financials
Next Topic: Oracle CRM Service Contracts
Goto Forum:
  


Current Time: Fri Apr 19 14:42:20 CDT 2024