Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Oracle 9iLite with Java on Palm - Help
Hello
Perhaps you may be able to help me with this if you've worked with Oracle
lite before.
I've installed Oracle 9i lite and am developing a palm application which
talks to the oracle lite database on the palm using JDBC and SQL. I need to
clear up some issues on connecting to the lite database:
Here's some Oracle lite JDBC/SQL example code. This is a standard JDBC/SQL
operation.
import java.sql.*;
public class jdbcexample {
public static void main(String args[]) {
// to load the driver
try {
Class.forName("oracle.lite.poljdbc.POLJDBCDriver");
// connect to the database
Connection conn = DriverManager.getConnection("jdbc:polite:polite",
"system", "");
// create a table
Statement stmt = conn.createStatement();
stmt.executeUpdate("create table person (name char(20), age
integer, "+
" address char(100))");
// insert new rows into the table
PreparedStatement pstmt = conn.prepareStatement(
"insert into person values(?,?,?)");
pstmt.setString(1, "Kevin Smith");
pstmt.setInt(2, 30);
pstmt.setString(3, "123 Never Land Dr, SF, CA 11111");
pstmt.executeUpdate();
// query the table
ResultSet rset = stmt.executeQuery("select * from person");
// browse the result
while (rset.next())
{
System.out.println("Name : " + rset.getString(1)+"\n");
System.out.println("Age: " +rset.getInt(2)+"\n");
System.out.println("Address: "+rset.getString(3)+"\n\n");
}
rset.close();
stmt.close();
// commit the transaction
conn.commit();
// disconnect from database
conn.close();
}
catch (SQLException e)
// exception handling
{
System.out.println(e);
}
catch (ClassNotFoundException ee)
{
System.out.println(ee);
}
}
}
The first line of code says:
import java.sql.*;
I cannot find any of the java.sql packages in the oracle installation.
The following line loads the jdbc driver - no problem with that:
Class.forName("oracle.lite.poljdbc.POLJDBCDriver");
The next line connects to the database:
// connect to the database
Connection conn = DriverManager.getConnection("jdbc:polite:polite",
"system", "");
I cannot find the Connection and DriverManager classes which are contained
in the java.sql package, which i also cannot find.
Also, this is the database link - "jdbc:polite:polite", "system", "" - On
the Palm, I dont know whether this link would look different or not?
So this is what i'm trying to figure out. I dont know if there's some other
way of connecting to the lite database on the Palm and then carrying out the
usual SQL queries. I cannot find any documentation regarding this. Can you
help me with this?
Best Regards, Received on Fri Jan 25 2002 - 02:30:04 CST