top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to connect to MariaDB cluster from Rails?

+2 votes
480 views
How to connect to MariaDB cluster from Rails?
posted Aug 26, 2015 by Kiran

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

I'm trying to connect my Rails app to MariaDB cluster.

Refer: https://www.ruby-forum.com/

answer Nov 20, 2015 by Manikandan J
Similar Questions
0 votes

We've been running for a while now using embedded Jetty but due to some upcoming infrastructure changes we're migrating to Tomcat 7. I'm having an issue getting my servlet to recognize the mariadb connector

NO SUITABLE DRIVER FOUND FOR JDBC:MARIADB:// 

This has been running in the past with Jetty, so I haven't made any code changes. I've dropped the mariadb-java-client-1.1.8.jar in the tomcathome/lib directory as in my experience in the past this was all I needed to do. However since I'm still getting this exception I'm not sure how to debug further. I've tried running tomcat with the debug option

BIN/CATALINA.BAT DEBUG  

but I'm not really sure how to use it properly other than running my servlet and viewing the classpath.

Any assistance on the matter would be helpful.

0 votes

Question, is building the source exactly the same as mysql? Meaning, if I build it with set CMAKE options building mysql, can I use those exact same options building mariab?

eg:
cmake -DCMAKE_INSTALL_PREFIX=/usr -DINSTALL_INCLUDEDIR=include/mysql
-DINSTALL_LIBDIR=lib/mysql -DMYSQL_USER=mysql
-DMYSQL_UNIX_ADDR=/var/run/mysql.sock
-DMYSQL_DATADIR=/var/lib/sql/data -DWITH_DEBUG=0 -DWITH_SSL=system
-DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1

+1 vote

I'm wonder how most people securely connect to a Postgres database on a server separate from the app server.

The ActiveRecord docs for a MySQL connection have explicit SSL options, whereas with Postgres it seems one would pass SSL options as documented for libpq.

However a quick Googling returns SO threads with suggestions to use SSH tunnels. Which I guess could be managed with something like AutoSSH.

I'd love to hear from others. Is one method faster than the other, or easier to maintain?

+2 votes

I'd like to remove all existing constraints from an ActiveRecord::Relation and leave the rest in-tact.
I am NOT looking for #unscoped since I would like to keep any joins/order clauses around.

Additionally, I would like to re-use the constraints that were removed in another query, so the ability to call #to_sql on them would be a very nice bonus.

This is the best I've been able to hack together:

Order.where(id: 1).where(id: 2).arel.constraints[0].to_sql
 => "`orders`.`id` = 1 AND `orders`.`id` = 2"

...but that just seems wrong. As far as I can tell #constraints always has one item in it, but I don't know that will always be true.

+1 vote

In my local machine I had input some data into database using SQLite3 . When I deployed it to heroku why I can't get data that i input?

I'm doing like this

-in Gemfile
group :development do
 gem 'sqlite3'
end
group :production do
 gem 'pg'
 gem 'rails_12factor'
end
-bundle install
-heroku login
-git init 
-git add .
-git commit -m "test"
-git create
-git push heroku master
-heroku run rake db:migrate

How can I get some data when I deployed it to heroku? Please help me.

...