How to install yii2 application without database config - yii2

Now i want to setup an application yii2 to test link redirect and get response result. So i dont need a database connect to it. How to setup app run without connect to a database. Thanks.

Yii modules and components are loaded only when needed. You can simple write your own controller and model, which are not using database. Just don't inherit your model from ActiveRecord, use yii\base\Model. And Yii will not instantiate unnecessary database connection when handling your route, even if database section is presented in config.

Related

Connect Heroku Add-on MySQL Database to DigitalOcean droplet for Spring Boot

Have anyone deployed Spring Boot app to DigitalOcean droplet?
I have previously created app on Heroku.com, where I also ordered MySQL Database and deployed my Web API. Due to performance issues, I want to transfer my Spring Boot app to DigitalOcean, but there is a problem: I still want to use DB I ordered on Heroku. I have all the required credentials, but can't find a way to connect my droplet. In Heroku, there is very simple way to do that, all I need to do is to change config variable DATABASE_URL, but here I cannot find the same. I hope you understand my problem and provide simple solution.
Thank You in advance!
What you need is called Environment Variables, here is the docs from DO.
Specify app-level variables on the Environment screen when creating an app. For existing apps, go to the Apps section of the DigitalOcean Control Panel. Click your app, then click the Settings tab. Next to the App-Level Environment Variables heading, click the Edit link.
https://docs.digitalocean.com/products/app-platform/how-to/use-environment-variables/

Eureka's hsqldb overriding MySQL

I have a Spring Boot project that currently consists of three microservices (all of them are maven children of the mentioned project), namely:
eureka-server : as the name says, it's simply a Eureka project that works as a server for registering other microservices
user-server : a project that holds a 'monolithic stack' (model, DAO, service and controller). Here is where the problem is. More on this later.
web-server : a project that contains the AngularJS application and a controller that is accessible from AngularJS and that communicates with the user-server module.
Eureka forces me to include a hsqldb dependency in the parent pom in order to launch the three mentioned applications.
The problem is that I was using MySQL in user-server and hsqldb has somehow overriden the MySQL data source.
In other words, the database engine of user-server is now hsqldb and I want to keep working with MySQL, and if I remove the dependency, the application will obviously not launch.
Is there any way to solve this and work with, maybe, two databases in user-server?
Thank you everyone!
I finally figured out how to get it working. I'll just post it here in case someone faces a similar problem.
It seems that application.properties wasn't being read when launching the application because telling Spring Boot which .yml configuration file for Eureka should be read, it was overriden.
In the .yml file of the microservice I wasn't able either to set the datasource to MySQL, so the solution was to hardcode the datasource properties when launching the microservice, as follows:
System.setProperty("spring.datasource.platform","mysql");
System.setProperty("spring.datasource.url","jdbc:mysql...");

Working with azure(mysql database) in node javascript with cloud API

I'm working with an API app on Azure by deploying an API written in NodeJs which stores data in MongoDb.
Make a new API for web & mobile apps from Azure portal.
Choose MongoDb by adding MongoLab module from Azure.
Create a table (collection) and populate it with few entries.
Prepare our Git repository from Azure portal and link it to our local Git on computers.
Decide which NodeJs modules to use to set the dependencies.
Edit the configuration file for NodeJs.
Make the main API file with the following functionalities:
Connection to the database.
Running the service.Making CRUD operation services (CREATE, READ,DELETE...)
Testing our API on a browser.
Making an application using our API
My question: how to use these steps to store data in mysql database(azure)?
I cannot fully understand your requirement, do you want to use the MySQL database to store your data in your API application in Node.js? If not, please clarify your purpose.
To implement connection to MySQL in Node.js, you can use some 3rd part MySQL handler modules.
For example:
node-mysql - A pure node.js JavaScript Client implementing the MySql protocol
or
Sequelize - A promise-based ORM for Node.js and io.js
Any further concern, please feel free to let me know.

is it possible to connect mysql db using angular js without php code

Is it possible to connect MySql db using angularjs without PHP code?
based on client side scripting we can't connect MySql db.
Is it any other way to connection?
If you wish to use just Angular for accessing your database, then discard PHP all together, and switch to something like Firebase. It will allow you to do almost everything from your Angular application (not saying that you should do it that way, but you could).
AngularJS is a Front-end framework, and it should be used in combination with some server side language: Java/C#/NodeJS/PHP...
But to answer your question directly: No, you can't access MySQL from Angular.
No, you cant connect MySql DB(Backend) with any client side javascript libraries so cant connect Backend DB with angularjs.
You can pick any server side programming language(not only php) to access MySql DB and write webservice interface to pass data from backend to your client.
If you are willing to have a db at client side which can be accessed with javascript(even angularjs) and no need to use any server side programming language then can go with below methods:
Indexed Database
Web SQL
localStorage
As of now we can't connect to our DB through client script. But there is alternate solution to store your data in google's FIREBASE https://www.firebase.com/tutorial/#session/omykpz5lraw.
This can be done by using nodejs as server to connect to ur database(I have done it using MangoDB). Since Angular js follows MVC architecture, you can use it as service layer too.

How to connect lift and MySQL?

I want to create a simple lift web application which read input throug form and insert it into database.
You need to add mysql jdbc driver to your project (as a maven artifact, or via sbt, or just put jar in CLASSPATH) and edit properties file (props/default.props):
db.driver=com.mysql.jdbc.Driver
db.url=jdbc:mysql://localhost/your_db_name
db.user=user
db.password=password
Also, you can setup db context in app container (Tomcat, etc.) instead. After that you can use Lift's ORM (Mapper).