Add data to database from VB program -> safe way? - mysql

I have developed a little VB program. I want the user to have the option to submit certain usage statistics/data (like some basic info about their system etc) to me. I want this data to end up in MySql db, so I can create queries/reports.
But what is the best/safest way to accomplish this? Of course, I could use the MySQL client, and just insert the data in the database. But is this a safe way? Using reverse engineering tools you could easily discover the database credentials, and add rubbish to the database (of course I would create a user that only can do inserts).
So, what would be a good approach for this?
Thanks

I think store-procedure is good solution.
link must use with class w

Related

How to make automatic backup [daily , weekly ,...] using Java and mysql database "wamp server"?

I'm creating a javafx app with using wamp server for mysql database, how to make automatic backup even if database become large for a specific location, Or what's best practice in this case?
What can I do by java for this issue?
I would suggest to create a cron job for this.
You can either invoke mysqldump tool directly or create a script in any language to export data you want to, which requires more work, but is more flexible.
Alternatively you can search the Internet for some ready tool (like this which I just found, but didn't check if it works). I'm pretty sure you would find some, since it's pretty common thing to do.

Create a New Database with Ruby on Rails

Is there a way to create a new database in an ROR app automatically.
What I'm trying to do is create a new database for each new user that signs up for my site. so if the new user sign-up is successful a new database with some empty tables will be created.
Ever new user will get a new database and ever new database will be the same tables inside of it, but the information that each user will store will be different.
the reason I believe I need this due to if the user no longer want to use my system I can provide them the information that they stored on my DB and then drop the DB and tables with great ease
what I'm looking for is something like the mysql_create_db() in php
Dont you think that you are making a simple system complex? The way you are thinking is not scalable. For example, if you have thousands of user you have to create same amount of database tables!! Where most of the tables might be of no use. That is definitely ridiculous...
If you just want to achieve the followings
Each user will have his own data.
User may want to export data.
If users close his account you will delete all his data
then you better think the whole as a single application with a single database. Design your database accordingly and better look for the best DRY practices of rails to implement that.
This is not a good way to store users in a relational database, especially when using an application framework like ruby on rails which depends on your following convention over configuration.
Have one user Model and use the Devise and then Cancan gems to manage roles and permissions. There's no need to reinvent the wheel here and that's just what this would be doing.
If there are other considerations such as size or performance, please spell them out in more detail. The reasons you give (ease of management) would not be a good reason to go down that path.
It's an interesting idea and has uses in other areas, but really not so good for your standard user tables.

Providing SQL query access to visitors on a rails app

I want to provide the ability to query the underlying mysql db on a rails-powered site to visitor on the web. The most transparent way seems to be able to take the text in a textbox and pass it to an sql connection.
However, I'd want to hide the user/password details and only make certain content tables available. Also, I only want to provide read access. Is there a convenient way to do this? It would be better if there were convenient view helpers too. Any gems like this? Perhaps something similar to PHP's MyAdmin?
The solution to this is more about configuring your database rather than finding special code.
You need to create a user in your MySQL database and grant read-only privilege to a subset of tables of your choice. Use this user in your connection string for queries from your "raw" SQL page. This is the only place you'll have to change code and all it involves is using a different connection string from your other code.
Here's an object-specific example of granting read-only permissions to a user.
To help manage this issue on the server you could make use of a schema.

Providing create table feature over GUI

I am developing a web application in which a user can Create a table in data base. I am thinking on taking the attribute names and table description from user and put them into SQL query and execute it. But the drawback is that if this application is installed somewhere else all the db connection parameters have to be changed secondly it will be hard coded. Or is this the approach in software industry?
Another approach I can think of is taking all the information about creating a new table from user and inserting them into one table and have some kind of trigger on this table which creates a new table everytime when insertion is performed into the first table.What would be the SQL Script for such thing if my approach is correct?
I am using SPRING - MVC, Hibernate, MySQL, REST web service
Please correct me if I am thinking in wrong direction. TO be honest I am not clear on how I am going to do this.
Thanks
This is risky, since a database schema with a vague and ever-expanding schema will become difficult to manage. Your problem isn't how to manage the credentials, which you would have to handle securely whether users were creating tables or not. Your problem is why it seems necessary for users to create tables.
Are you building an interface to manage arbitrary databases? Maybe phpmyadmin would give your users everything they need.
Or are you doing something not quite so general purpose and open ended? Perhaps with a sufficiently rich table design, you can give the users what they want without requiring that they build their own tables. What information do users have to put in a table that it looks like they need to build their own?
If you are more specific with your objectives, we could be more helpful.

easy way to create a username / password login

I have built a website using html and css (in Dreamveaver CS4) on which I would like to create a section that is only accessible to registered users - users would have to submit their email address and create a password to access the area. I am prepared to take the time to learn with tutorials etc, but I'm a beginner with limited ability of html etc, so I would really appreciate some advice on what would be the easiest way of doing something like this - Drupal? JQuery? I have tried searching online for tutorials but I am getting hundreds of different answers using different solutions and would really appreciate your opinions on how to do this in the easiest possible way.
Many thanks in advance :)
Just pick a tutorial for a scripting language that your web hosting supports. PHP is pretty common: http://phpeasystep.com/phptu/6.html
I would suggest using server side scripting for your login.
For this you would need
A place to store user data
A script that can validate the user
data.
Use whatever scripting language your host supports for this.
You can either use a flat file (text file) to store user data by encrypting it in it or you can use a database (best)
You can write a small script that is called when the user logs in and sets the cookie in the browser
In the pages that only logged in users can view, you can add a small piece of code to verify from the cookie, if it validates, display the data or display something like Authorized users only.
This is a very basic functionality but if that is all you want, this should do it.
Well, you'd need a database on the server to store the username/password combinations. That means you'd need some server side language to interact with the database to check for valid username/password combinations, as well as using the server side language to know -when- to check for username/pw (e.g. which page(s) are password protected).
If you're on a Windows server, MS Access is generally considered to be a good starting point for database, but I'd recommend mySQL or SQL Server for the long run.
For language, there's a ton to choose from. ASP, PHP, ColdFusion, etc. I'm a ColdFusion person, so take this with the bias that implies , but I think CF is the easiest for a beginner to learn.