|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Accessing database through a midlet using servlets
Hello
I'm tring to develope a midlet that connects to a database through a servlet but i just can seem to get it right. Cand someone please write a simple exemple so that I could see how it is supposed to work. Thank you a lot Regards, Michael |
|
#2
|
|||
|
|||
|
Do a google search for it.
-KM- |
|
#3
|
|||
|
|||
|
Thank you for your response..
It doesn't matter no more for I have succeded with my application. It works like a charm. Regards, Michael |
|
#4
|
|||
|
|||
|
J2ME (Midlet) with Databases
Quote:
Good People I'm trying to implement the Music on demand Application. The application have to Play Music, Download and save Music Files (Which I think it can work with two data storage with the original files stored at one Databases and downloaded to another Databases by Copying from the first one and INSERTING to the second Database). But my problem is that I'm new to J2ME Environment though I've managed to Develop the prototype (only the GUI's). MAY YOU PLEASE ASSIST ME IF YOU KNOW HOW TO CONNECT TO DATABASE USNG J2ME AND STORING AND RETRIEVING MUSIC FILES. May you pls send me the snippest of Code for connecting to Databases. PLEASE ASSIST IN THIS REGARD, Thanks in advance for your flowing responses!!! Londy |
|
#5
|
|||
|
|||
|
Hello
This is the code that you execute in the servlet: Statement stmt = null; ResultSet rs = null; Connection con = null; try { Class.forName("com.microsoft.jdbc.sqlserver. SQLServerDriver").newInstance(); con= DriverManager.getConnection(URL); stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * FROM Table1"); // Read the data, a line at a time boolean hasEntries = false; while (rs.next()) { hasEntries = true; out.println(...); ... } In the servlet you might have something like this: content= new String(userName.getString()+","+password. getString()); String result = ServletWrite.write(SERVLETURL + "? action=write", content); where ServletWrite is a class that writes to a OutputStream the 'content' and reads from a InputStream the results returned from the servlet. So the write method in this class should return a String representing the results read from the servlet. Hope it helps Regards, Michael |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > Accessing database through a midlet using servlets |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|