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 |
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;
}
}
}
|
|
|
|
|
Goto Forum:
Current Time: Mon Jan 27 07:20:35 CST 2025
|