The Oracle Lite Blog

The Rekounas Blog about Oracle's Mobile Enterprise Application Platform

The Oracle Lite Blog header image 2

WTGJdbcDriver vs. POLJDBCDriver

January 15th, 2007 · No Comments

I found a transaction test that I was performing a while back that might help you. In this example, I am using both drivers, I have an open connection with both drivers and I show an example of updating the dbname database with an insert and update statement. Note that even though I am using the webtogo driver, webtogo will know what database my application is associated to. If you are building a webtogo application use the webtogo driver, if you creating a java application, use the polite driver.

CREATE TABLE TEST_TABLE( SOME_ID NUMBER, MYCOLUMN VARCHAR2(50) );
Connection webtogo = null;
Connection polite = null;
PreparedStatement stmt1 = null;
PreparedStatement stmt2 = null;

Class.forName("oracle.lite.web.WTGJdbcDriver");
webtogo = DriverManager.getConnection("jdbc:oracle:webtogo");

Class.forName("oracle.lite.poljdbc.POLJDBCDriver");
polite = DriverManager.getConnection("jdbc:polite:USERNAME_dbname", "system", "mypassword");

stmt1 = webtogo.prepareStatement("UPDATE TEST_TABLE SET MYCOLUMN = ? WHERE SOME_ID = ?");
stmt1.setString(1, "My column update.");
stmt1.setInt(2, 123);
stmt1.executeUpdate();

stmt2 = polite.prepareStatement("INSERT INTO TEST_TABLE VALUES (?, ?)");
stmt2.setInt(1, 456);
stmt2.setString(2, "My second column I am updating");
stmt2.executeUpdate();

webtogo.rollback();
polite.commit();

Share

Tags: Java · Oracle Lite · Webtogo

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

*