How to send data to my database safely? - java

How can I send data to my database safely without any user forging?
Let's say, there's like 25 people using my application and I want to upload stats of their playing data.
I can't use JDBC because they could easily decompile and then get access to my database.
I was thinking of creating something in PHP but then they could easily update their values as well like http://mywebsite.com/update.php?user=x&gold=23
Any suggestions on a SAFE way of uploading stats without user forging?

Related

Way to store images, text notes and audio files in offline database. Android, Java

I would like to create an app where I could save text, image and audio notes to an offline database(without internet connection) and then show them in a list-like layout. Wouldnt like to save the files to internal storage directly.
Its my first time creating mobile app so I need help in choosing the right database for such use case. Any suggestions?
I think you may be confusing some terms.
While you can put all sorts of media in a database. Sometimes it not the most practical solution. It sounds like you might be thinking of file storage, not a database.
Further more, the files have to live somewhere, if not on a external server/database, than they will have to reside locally on the device. Your app will not have a local database service running just so that it can store media files. This would be a lot of overhead and take up a lot of resources.
the first thing to know: the database in android is SQLite, So any other offline database it's just a layer for managing the SQLite database, and It only saves numeric and text data, but you can save any other type like image, audio, array...Ect by creating convertors to save it in the database.
E.g: You can save BitMap-Image type- by converting it to ByteArray-List of 0s and 1s-, then converting the ByteArray to String-Default text type-, then you can save it to the database, and when you want to select the value, just convert by the opposite (String -> ByteArray -> BitMap), So the trick here is to know how to convert between the types.
Now the answer:
the best offline-database is RoomDatabase, the fastest way to create and manage SQLite database, with Room you don't need to build an SQLite database from the scratch, it's going to build it for you, and has a great way to create converters.
but for you as a beginner, standard SQLite is more than enough, if you will see RoomDB more difficult.

Simplest way to store and return data on google app engine

I have created an app to enable users to manually log data for their use of phytosanitary products in their fields.
I would like to store all of this data one the app engine.
I thought of storing it as entities on the google app datastore but then is there a way to gather all that data afterwards and make it downloadable as an XML file for example?
The only data that will be stored each time will be the following:
I am using Vaadin to handle the whole application
AFAIK, you will need to write code to read data you want from Datastore and convert it to the form you need - XML or something else. Then you can trigger above functionality at a specific URL (click of a button) or as a scheduled job that emails you the XML or stores it in a Cloud storage bucket.

Need to send email on database insert

This question might look similar to existing one's but is really different.
I have a scenario where I have to send emails to different users while inserting data into MySQL DB. The logical part has been completed using Java. This is reading very huge data from via CSV files on file server and after processing those data, inserting into DB.
Now my need is to send email to different users on each insert operation.
The data is quite very heavy so I think using triggers would not be a good idea.
Can you please help me to get a better solution?
I do also have php app connectivity with this database.
In my opinion you should try php library like PHPMailer, PEAR Mail, SwiftMailer, etc as you should note that php's mail function is inherently not optimized at all.

Putting media into an Access Database using Java

I'm making an email system in Java using an Access database as connectivity. What would be the best way to get and upload media/files (.gif, .au, .mpeg and .txt) attachments to the access database? What datatype would the field in the database have to have? I think that i have to convert the file to binaries to be able to store them, i have no idea how i would retrieve them so i can open them in the Java GUI. Could any body explain how to do this so i can add it into my program, or explain any alternatives?
OLE OBJECT is really the only option you have if you want the actual binaries to be stored in an Access Database.
You'll probably be able to use setBlob and getBlob to work with it.

Application Architecture Suggestion

I am preparing a J2ME application,
Which is basically data capturing utility, Which reads data from end user from form and the data will be submitted to server as the application will get connection.
I am planning to capture photo also.
Now my arch. is MIDlet will fetch data from user and will store it in RMS and as the connection is available the data will be submitted to server and it will be removed locally.
The main question is is it reliable to use RMS to store data.
My one data entry will be something like + a photo[optional]
"asdjbdabhsdfjkbahsdkfbakjsdfhasfjasdfhjasdlcjalmsdhfjasdfajksdlmcfjkanmsdfgsahjkcnfhs"
suggest me arch. changes.
I'm really struggling to understand your question.
if your asking if RMS is a reliable storage method for pictures the answer is yes.
You just have to convert your image to a byte array and save. Then when you need to make it back into an image, the Image class has a constructor for making a new Image from byte array anyway. The RMS is persistent so your data will be there if you stop the app and as a default your applications RMS should only be accessible to your application (although I think you can change this manually).
I'm currently developing a peace of software witch stores pictures, audio recordings and ID strings as well as date and time stamps on the phone it's self prior to a server upload point and I use the RMS.
I'm not actually sure if there's any other form of local storage that J2ME has access to.

Categories

Resources