I am making a simple c++ login program and I wish to connect my c++ code to my MySQL database. When the user signs up the program is supposed to send the user's mail and a hash of the password to the database and store it there. (I've already done the hashing with sha256). When the user logs in the program, it supposed to send the user's mail and password to the database where it checks if both are correct and send a acces granted or acces denied back.
I just started working with MySQL and not being able to find any video or topic online of how to do this, making a post myself is my last hope.
The best way to get this done is by:
Creating an PHP/ASP script that connecting to the MySQL (like an API), or
Creating an C++ server program that functioning as an API.
If you want to choose the second one, you need to download the C++ connector: MySQL C++ connector
Check the Documentation from MySQL for more information and the examples.
Related
I have already made front end pages using html css and js and I wanted to use the aws rds mysql database in it. The db is connected to the databse in vs code but how do I access it in the php file?
With your short explanation and screenshot's what I have understood is that you are developing an app with a front end (html, css, js) and you want to connect this app to a database through the php file.
So in order to connect and access your database in the php file you need to download the php client for Mysql, the name is mysqli and you can find many videos in YouTube. The purpose of this library is to talk to your database, is the only reasonable way to do it.
Second you need to get the credentials from the rds service. So far you have expressed that you where able to connect visual studio to the db, so you already have the credentials.
When you start to see the basic tutorials on how to use mysqli everything will come to sense
Good luck!
I am learning NODEJS addons building
I was able to build a simple application but now I have a problem in connecting to the database using addons and passing query data to NODEJS
Can anyone suggest me what should I do??
I am developing my application using electron so one main issue in electron is it's asar file even though it's protected it can access by anyone and get the password and other stuff to the database so what I am trying to do is create a nodejs c++ addons and pass query and run query in c++ and get query result back to front as a string or something and process them in frontend now I was able to create addon but still couldn't find a way to connect to database c++ there is nothing in anywhere a way to connect to the database in c++ addons actually I don't know is it possible or not but it's worth trying. now I know how to connect to database in pure c++ and when i try to do it in here it can't find libraries.
This is more of a technical question; I don't have any code to offer as I've only begun experimenting with basic output in CPP, and I currently see this as my most difficult task.
In a desktop application I'm coding, I am trying to allow users to sign into their online account they have with my web app, but obviously it would wouldn't make sense to include the same DB connection I use for hosting my site...
Is there a way I can send JUST username and password values over POST in cpp and use these values to achieve desired functionality in PHP?
Hopefully my question makes sense; I'm simply wondering how one would interact with a web server over CPP (without a direct db connection...)
I have built a website in django framework. It has a lot of features such as blog, discussion forum, basically there are lots of ways users can interact. I have built a basic notification framework where a user gets notified when somebody comments on their blog, or answers their question in the forum.
Since the notifications are stored in db, new notifications are displayed only when a page refresh is done. I would like to make it real time using some push server using something like long polling technique.
I have come across NowJS which seems to be pretty handy for this, but in all the examples that are given I could not see any example where there was any interaction with the database. In all the cases there was some information sent by one client and it was displayed to one or more clients.
What I actually want to do is to call a function using NowJS, and make it go to sleep until a new notification is added in the database. When a new notifications comes in the server responds back with the notification and a new request is done immediately.
I can figure out all other parts except how to access the database from Node server that is used by NowJS. Any help or guidance is appreciated.
Either:
Have your node.js server make an http call to the Django server via something like a REST api to get info back
Google for a database connector for node.js - I found enough evidence for a MySQL one, and rumours of a PostgreSQL one. Note this won't get you access to the Django DB API, so you'll have to work out all your related queries and craft your SQL by hand (make sure Bobby Tables doesn't bother you: http://www.xkcd.com/327)
Re-implement the NowJS protocol so that you can write a django server for it, keeping the same JS client code on the clients... but then you may as wel.....
...use django-socketio http://blog.jupo.org/2011/08/13/real-time-web-apps-with-django-and-websockets/
I'm looking for an effective approach for this problem:
Server:
Webinterface, User can use forms.
The Data entered in the forms is getting saved in a database.
Several clients:
A client program written in c++ can access database.
When I use a normal MySQL DB I would have to open the whole MySQLServer to accept remote connections, which I would like to avoid.
I found several MySQL APIs, but no alternative for my problem.
An 'webdatabase <-> remote c++ client' solution.
Will I have to write my own server which will parse the DB info to the client? :/
Hope there is an easier solution!
What you will want to do is write an API that runs on the same webinterface to which you can programatically talk. You can look at SOAP for example, or a REST based service, or simply JSON.
This will allow your C++ client to "connect" to the database on the server side through a controlled channel so that you are not opening up MySQL to access from the outside.