Posted By:
Grzegorz_Galezowski
Posted On:
Wednesday, December 18, 2002 06:00 AM
How do to throw open the driver the JDBC (Oracle8i) across web server (Tomcat) the written in J2ME application would can to link the connection from database? I do not know how to write servlet which connection midlet it will make possible from JDBC. JDBC it to possibly situated after side of mobile device. RMI comes off also, which it does not it act on devices CLDC. Technology stays ReqwirelessDB which it adds to J2ME -java.sql I ask about help in solution this problem. I apologize for problem and greet import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import java.util.*; import
More>>
How do to throw open the driver the JDBC (Oracle8i) across web server
(Tomcat) the written in J2ME application would can to link the connection
from database?
I do not know how to write servlet which connection midlet it will make
possible from JDBC.
JDBC it to possibly situated after side of mobile device. RMI comes off
also, which it does not it act on devices CLDC.
Technology stays ReqwirelessDB which it adds to J2ME -java.sql
I ask about help in solution this problem. I apologize for problem and greet
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;
import java.sql.*;
import com.reqwireless.sql.ReqwirelessDB;
public class PublicServerTest extends MIDlet implements CommandListener {
Form form;
Command exitCommand = new Command("Exit", Command.EXIT, 99);
public PublicServerTest() {
ReqwirelessDB.setServer( "http://hal9000:8080" );
}
public void destroyApp( boolean unconditional )
throws MIDletStateChangeException {
notifyDestroyed();
}
public void exitMidlet() {
try {
destroyApp( true );
} catch( Exception e ) {}
}
public void pauseApp(){
form = null;
}
public void startApp()
throws MIDletStateChangeException {
Connection c = null;
Statement s = null;
ResultSet r = null;
form = new Form( "Test" );
form.addCommand( exitCommand );
form.setCommandListener( this );
Display.getDisplay( this ).setCurrent( form );
try {
c = DriverManager.getConnection(
"jdbc:oracle:thin@hal9000:1521:NSA",
"test",
"test" );
s = c.createStatement();
r = s.executeQuery( "SELECT * from test_table" );
while( r.next() ) {
String str = r.getString( 1 );
System.err.println( str );
form.append( str + '
' );
}
} catch( SQLException se ) {
String msg = "Exception caught: " + se.getMessage();
System.err.println( msg );
form.append( msg );
} finally {
try {
if( r != null ) {
r.close();
}
if( s != null ) {
s.close();
}
if( c != null ) {
c.close();
}
} catch( SQLException se ) {
}
}
}
public void commandAction( Command c, Displayable d ) {
if( c == exitCommand ) {
exitMidlet();
}
}
}
<<Less