Connecting directly to Database in Rails (Heroku?) - ruby-on-rails

I am currently writing RoR applications and deploying using Heroku.
Is there any way to connect directly to the DB using a connection string?
I guess what I am asking here is can I connect directly to the DB, is there a connection string, how can I get the connection string, etc. I want to be able to perform querys on the DB outside of the terminal I am developing. My current solution is using
heroku db:pull 'anotherPOSTGRESQLdatabasesCONNECTIONstring'
and then performing queries on that database, but this is not a valid solution, because I am developing this application for users who are not code savvy, and they should be able to perform queries on the database without me or them using the terminal.

I think what you might be asking is available here: https://postgres.heroku.com/
Click "Try For Free", Select the option where you already have a heroku account, login with the correct credentials.
Now you can choose the database you want to perform actions on, and create "Data Clips" that your clients can run to get data reports etc (data clips can be used to run arbitrary select SQL commands).

Related

No write operations are allowed directly on this database. Writes must pass through the leader. The role of this server is: FOLLOWER

Im using py2neo(2020.1.0) to connect and make queries in Neo4j, Getting below error
No write operations are allowed directly on this database. Writes must pass through the leader. The role of this server is: FOLLOWER
I use neo4j+s: scheme to connect, When I gone through the articles neo4j+s: will take care of routing. But It seems not working. Is it possible to get around with this ?
You need to use bolt+routing if you want to open connection to FOLLOWER, but writes to be sent to LEADER:
./cypher-shell -a bolt+routing://the_follower:7637

How do you change your active database connection in SQL Workbench/J?

Is it possible to change your active/default database connection in SQL Workbench/J while still under a single connection profile? There are times I am connected to a database server with multiple databases and I would like to switch my active database without having to use a USE statement, specify the full 3 part naming convention, or switch connection profiles entirely. In SSMS, there is a simple drop-down menu to easily switch between different databases. Just wondering if there is something similar in SQL Workbench/J that I'm just missing.
There is an experimental feature to enable a dropdown with the available databses in the main window.
If you run
WbSetDbConfig gui.enable.dbswitcher=true;
in a SQL editor tab when connected to a SQL Server database, then you should have a dropdown to switch the current database after restarting SQL Workbench/J.
It will essentially issue a USE in the background for the current connection when using SQL Server.

Direct connect mysql server without php in swift- 4(code) iOS

I am trying to connect to MySqlServer by code in swift directly without php file.
Is there any way to do the same? we have enterprise application where we need to direct connect with mysql db
It is possible using mySqlClient.We need to enter host name, user, password and db_name and connect to db. Using this we can query db directly and fetch data therein
There is only one way to connect with database without using php.
use firebase database. No need for server side coding .. you can get and set data using swift. it looks just like you are posting data in mobile database.

Running the same Rails code on multiple laptops and saving the data from all of them to the same Database

I am trying to run the same rails code on multiple laptops on localhost:3000. How can I save the data submitted from the different laptops to save in a single database. Or, they would share the same database and if someone has submitted data, it would automatically be on the other persons laptop. Also consider that there won't be any internet connection, but we can connect them with Ethernet cables. Also, we are using sqllite3 . Thanks!
Probably you would like to use mysql in that case - it is designed to work this way, you just specify remote host instead of 'localhost' in config.
However, you can put sqlite database in ftp/sftp/webdav server, mount as local folder (kinda complicated on windows tho), and try to use it, which will work REALLY slow.

Is it possible to view a remote database in heroku on my computer (using Induction)?

In my rails 4 application directory, I typed "heroku pg:credentials DATABASE" into terminal to get all the information about the database for my application which is deployed on heroku. Since I'd like to view the data inside my postgresql database, I tried inputting the information into Induction, but it ended up not responding and I was forced to enter the activity monitor and force quit. I followed the same procedure several more times all with the same result. Is my version of Induction faulty? Should I be using a different program to view my database? Or am I doing something wrong?
I'm new to rails, so thanks for your help!
Yes, you can. Heroku Postgres allows connections from outside Heroku's network. The credentials displayed from heroku pg:credentials will be all you need and should work. Maybe try using the official PGAdmin tool instead?

Resources