Oracle lite is a very interesting product. As the name indicates, is it a lite version of the Oracle database and thus capable of running on a PDA, laptop and (soon) mobile phone. One of its main features are the synchronization capabilities with a master Oracle database. A special SQL+ client is also available: MSQL. In the windows environment (e.g. on a laptop with Windows XP) the actual connection with the Oracle lite database uses ODBC (I am curious how this is done in a Linux environment). This means that for Java applications a special JDBC driver, actually a JDBC ODBC bridge, is needed which is provided with olite40.jar and can be found (multiple times, but fortunately all with the same size) in the Oracle lite install directory.
package nl.amis.demo.olite; import java.sql.*; public class OliteApp { public void performQuery() { try { Class.forName("oracle.lite.poljdbc.POLJDBCDriver"); Connection conn = DriverManager.getConnection ("jdbc:polite:ODBC_dsn", "system", "userpwd"); PreparedStatement pstmt = conn.prepareStatement("select * from emp"); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { System.out.println(rs.getString("ENAME")); } } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { OliteApp oliteApp = new OliteApp(); oliteApp.performQuery(); } }
As you can see, the code is no different from any other JDBC code. The only weird thing is that you have to connect with the system user, but you need to provide the user’s password (see this OTN Oracle lite post), b.t.w. this is also the case for mSQL.
Hi,I had developed a pdf using jasper reports, the jrxm/xml file i had placed under XYZ folder and deployed it on to the server. Now using sync i got the webtogo offline application to my desktop. When i click on my report and try to generate the pdf it says the jrxml file is not found? where does the class files reside on local client machine? How do i get the realPath and contextPath of that particular jrxml/xml file? Is this feature available with olite?
For example i say my jrxml is under WEB-INF/classes/com/xyz/ folder or any other folder path.If i try to access the jrxml on my jdeveloper( developer machine i am able to get the real/context path).But the same when i deployed on mobile server and get sync to it the servlet.class says that the jrxml file doesnt exists(file not found exception) How do i get the path of the jrxml file?where does the WEB-INF folder and web.xml file reside on client machine after performing sync to the server?
please clarify my doubts Thanks
hi
You need to set classpath of oracle thin driver that will be used by your java or any other application.
you need to find a file ojdbc14.jar and copy it to oracle_lite_home\product\jdbc\lib. and set its reference in the classpath!!!!
make sure that jdk1.3 is installed on your target machine.
Hi
I’m working with Oracle Lite and I was working with an example that
I found in the Developers Guide Oracle Lite.
The example works the database connection with oracle.lite.web.WTGJdbcDriver
and I have Windows 2000, is this clase only for Linux?
Because when I test my connection with this class I get “No suitable Driver”.
If this class is only for Linux, Can I work Webtogo with
oracle.lite.poljdbc.POLJDBCDriver class?
Thanks a lot
Fabiola Palomino
Colombia
I also forgot to mention in the above that you don’t have to worry about username and password for web-to-go because the Mobile Workspace (or customized workspace) will handle that for you.
Your best bet for Linux is to create a Web-to-go (J2EE) application and use the oracle.lite.web.WTGJdbcDriver driver and the connection string is jdbc:oracle:webtogo.
Here is an example of how to use:
public Connection getConnection() throws DaoException {
if (conn == null) {
try {
Class.forName(oracle.lite.web.WTGJdbcDriver);
} catch (ClassNotFoundException e) {
throw new DaoException(e);
}
try {
conn = DriverManager.getConnection(jdbc:oracle:webtogo);
} catch (SQLException e) {
throw new DaoException(e);
}
}
return conn;
}