Programação distribuída com J2ME

3 respostas
D

Olá a todos,

Tenho uma base de dados Oracle e necessito acessar informações através de uma aplicação J2ME. Andei pesquisando e creio que isso seja improvável. Meus conhecimentos em J2ME são terriveis, não conheço as limitações da API.

Idéias:
Criar um Socket e ler um xml do servidor
Acessar um EJB remoto
Utilizar RMI

Gostaria que alguém me desse opiniões sobre o assunto, qual o melhor modelo a utilizar, se possível. Talvez até mesmo acessar a base oracle diretamente.

Obrigado,

Alan Alves

3 Respostas

J

Olha soh…
Talvez consiga responder algumas duvidas suas dizendo q o j2me suporta HTTP e outros casos Socket. Bom… isso permitiria chamar PHPs, servlets, JSPs, etc. Suporta a RMI nao tem, porem tem suporte a Web Services. Nao da pra acessar a base Oracle diretamente nao. .no caso vc teria q usar um intermediario na historia como PHP, JSP, servlet, asp, etc.

P

Cara, te garanto que tudo o que vc precisa para fazer isto já está aqui no fórum, em post mais antigos.

Tudo vai depender da sua disponibilidade, paciência, perseverança.

Ou podes procurar um a um os posts, ou colocar palavras chave como http, xml,etc… para que tuas buscas sejam mais rápidas ou diretas.

tRuNkSnEt

Posso estar variando mas eu me lembro claramente de ter lido em algum lugar que o o midlet 1.0 só suporta comunicação via HTTP.
Os passos baixo formam tirado do livro J2ME - The Complete Reference e explica de forma simples como pegar informações de um servidor web. No livro citado tem o codigo para essas etapas …

Retrieving information from a web server
Here are the steps required to retrieve information from a web server:
1 - Declare references
2 - Obtain a reference to the instance of the Display Class.
3 - Create an instance of a command class to exit the MIDlet
4 - Create an instance of a command class to start the MIDlet
5 - Create an instance of the form class
6 - Associate the instance of the command class to the instance of the form class
7 - Associate a CommandListener wth the instance of the form class
8 - Display the instance of the form class on the screen
9 - If the Start command is selected, create references to a StreamConnection
10 - Create a StringBuffer to store characters read from the input stream
11 - Open a connection to the server
12 - Open a InputStream
13 - Read each byte from the input stream and append the byte to the StringBuffer
14 - Assing the Contents of the StringBuffer to a String after the last character is read form the input stream
15 - Parse the string if necessary, and display the string in an alert dialog box.
16 - If the Exit command is selected, terminate the MIDlet.
17 - Trap exceptions thrown within the commandAction() method.
18 - If the MIDletStateChangeExectipon is thrown, indicate that conditions are now safe to terminate the MIDlet by assingning a true value to the exit flag variable.
19 - Terminate the MIDlet when the Exit command is entered the second time.

E claro que voce vai ajudar o seu MIDlet fazendo um tratamento da requisição para que ele receba so o que realmente é necessario, conneção hoje em dia ainda esta caro $$$$$.

Criado 27 de abril de 2005
Ultima resposta 28 de abr. de 2005
Respostas 3
Participantes 4