How to make a database on c9.io - node.js

How can I make a database on c9.io?

You have here all docu about this:
https://community.c9.io/t/setting-up-phpmyadmin/1723
Basically:
mysql-ctl install
phpmyadmin-ctl install
mysql-ctl start

You can create a temporary MySQL Database in Cloud9 in the terminal using
mysql-ctl cli
See Set Up a Database.
However, if you do not wish to learn MySQL, I would recommend Getting Started.

Related

problem after moving from sqllite3 to postgresql database in django

enter image description hereI have changed an existing database for a Django project from SQLite3 to PostgreSQL. As presently i am in development environment, and was carrying some dummy data in my SQlite3 so do not need that data.
After changing the database from sqlite3 to PostgreSQL, I run the makemigrations, and migrate commands, and then created a super user.
Now when i try to access the admin panel, by http://127.0.0.1:8000/admin/ django is showing me the following error. I have search a lot for the solution, but failed. I would be grateful, if you could please help me in this.
errorerror2
Looks like your sessions wasn't migrated properly.
Ensure that you have django.contrib.sessions in INSTALLED_APPS and try migrate the sessions again from scratch.
You can do it running:
$ python manage.py migrate --fake sessions zero
$ python manage.py migrate sessions

Node JS db-migrate for different database

I'm already using db-migrate package to migrate MySQL database script and it works well, I've even setup the DATABASE_URL variable in the server environment.
Now I've a requirement to store few details in the sqlite in the same service, I checked db-migrate package for this feature apparently nothing mentioned regard to the executing sql scripts in multiple different databases at one go. Is it possible to do in db-migrate? or do I've to write my own service for this?

Migration generator files tools for nodejs and postgresql

I use nodejs and i have a postgresql database and I'm thinking of using sequelize or db-migration to migrate my existing database. Do you know a way to generate the migration files for my existing database?
Node.js database migration management for Postgresql
Here is how to go about it.
There exist a node package manager called node-pg-migrate
install the package using npm install node-pg-migrate pg
here is the github URL with code samples. https://github.com/salsita/node-pg-migrate#node-pg-migrate
Best of Luck

jhipster - how to load data from a database and show data?

I'm learning JHipster and a beginner (web developper).
Can someone show me step by step for loading data in a database (h2 or mysql or oracle) within JHipster application and showing to the home page?
Thanks in advance,
First, you should look at the jhipster documentation to generate an app : see this 12 minute video tutorial
Jhipster actually does a lot for you, it generates the back-end with your classes, logging, database interfacing ... But also creates a nice-looking front-end for you.
Next you should have a database up and running. In the choices you have mentioned, I think Mysql could be the most interesting for a beginner as you would have a good visibility on your database (h2 is mostly in memory, I use it for testing on my app) and the install should be simple enough.
In order to do that, you could use docker or install it manually.
For docker, you just have to type the following command :
docker run -p 3306:3306 --name mysql_instance_01 -e MYSQL_ROOT_PASSWORD=pass -d mysql
And then if you want to stop it :
docker stop mysql_instance_01
See the docker documentation for more information about install and usage : this link
To connect and administrate your database graphically, you can use dbeaver, it is free and easy to use.
Once you have generated the app and the database is running, you have different options : either you add your 'entities' and manually populate your database, or you create an SQL script to do it for you (Which is specific to the database you're using).
JHipster is using liquibase which will automatically translate the entities created in Jhipster into your database.
This is a short introduction, I strongly advise you read the jhipster documentation. For example, this video shows what Jhipster can do and how to use it.
Hope this helps.
You can read this link, a basic jhipster example

Developing locally using express, mongodb and mongoose

I'm currently making an app using express, mongodb and mongoose, and I'm running it locally on my machine. My problem is that if I'm not connected to the internet the app won't run at all due to the app not being able to connect to mongodb server.
I thought that if I ran the mongodb server locally on my computer along with the app then I wouldn't need an internet connection, or is my understanding wrong?
Any help would be much appreciated.
The answer is: yes.
If you install MongoDB locally then you won't need internet connection to access it.
Make sure that your connection string contains "localhost".
Also, make sure that you don't need anything else on the internet, and that you run npm install while you are connected to the internet, or otherwise your dependencies (like mongoose) won't get installed. After they are installed they can work without the internet connection just fine - if your database is on localhost.
Also, make sure that your local MongoDB server is running. You can run:
mongo test
in the command line to see if you can connect to a local database.
You're in the right path !
Here's the thing, you need to get yourself a copy of MongoDB, you can download and install the suitable version to your system from here.
Now you need to configure MongoDB in your in your path so you can launch it when you is or simply add it a process that will launch when your system starts.
In order to configure please choose the suitable conf to your system :
Windows.
Linux.
macOS.
Then, before running your application, make sure MongoDB is running in the background ad service or daemon and then simply launch your application.

Resources