Here is an example of how you deploy an application. I will follow it up with examples of how to add publication items to the application and adding users to the application as well.
The following command should be all on one line:
java -classpath .:$ORACLE_HOME/mobile/classes/consolidator.jar:
$ORACLE_HOME/mobile/server/bin/devmgr.jar:
$ORACLE_HOME/mobile/server/bin/webtogo.jar:
$ORACLE_HOME/jdbc/lib/ojdbc14.jar Deploy MOBILEADMIN MOBILEPWD localhost 1521 XE
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import oracle.lite.sync.Consolidator;
import oracle.lite.sync.ConsolidatorException;
import oracle.lite.sync.ConsolidatorManager;
public class Deploy {
private static Connection con = null;
public static void main(String[] arg) throws ConsolidatorException,
SQLException {
if (arg.length == 5) {
ConsolidatorManager cm = new ConsolidatorManager();
String PUBLICATION = “PUBLICATION”;
// arguments are:
// 0 - Mobile Schema Repository
// 1 - Mobile Schema Repository Password
// 2 - URL
// 3 - Port
// 4 - SID
String MOBILE_SCHEMA = arg[0];
String MOBILE_PASSWORD = arg[1];
String JDBC_URL =
“jdbc:oracle:thin:@” + arg[2] + “:” + arg[3] + “:” + arg[4];
System.out.println(”JDBC URL = ” + JDBC_URL);
try {
DriverManager.registerDriver((Driver)(Class.forName(”oracle.jdbc.OracleDriver”).newInstance()));
try {
con = DriverManager.getConnection(JDBC_URL, MOBILE_SCHEMA, MOBILE_PASSWORD);
} catch (SQLException sqle) {
sqle.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
return;
}
cm.openConnection(con);
// Alter the session if you are dealing with a multilingual application
PreparedStatement stmt = null;
stmt = con.prepareStatement(”alter session SET NLS_LENGTH_SEMANTICS=’BYTE’”);
stmt.execute();
try {
cm.dropPublication(PUBLICATION);
} catch (ConsolidatorException ce) {
System.out.println(ce.getMessage());
}
cm.createPublication(PUBLICATION, Consolidator.DFLT_CREATOR_ID,
PUBLICATION.toLowerCase() + “.%s”, null);
} else {
System.out.println(”Invalid parameters!”);
System.out.println(”java -classpath :. Deploy mobileadmin mobilepass url port sid”);
}
}
}
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment