Using Couchbase with Perl Dancer - couchbase

Any best practices out there for using Couchbase with Perl Dancer? I can't seem to find any Dancer-specific plugins anywhere. Specifically I'm looking for best practices for maintaining persistent database connections, preferably using the native dancer database keyword.
I should add, I'm already aware of the Couchbase::Client cpan package. I'm looking for a Dancer-specific equivalent, or any tips/advice on how to properly use Couchbase::Client with Dancer.

I am unfamiliar with 'Dancer' as of yet but it seems from the Couchbase::Client that you can have a list of servers to try under the Typical Constructor Options and can then re-try the same server if fails.

Related

How can I connect my react native app to MySQL server?

I'm creating a mobile app for an existing website and trying to connect to a local instance I have running on a MySQL workbench. I've seen others recommend against the use of MySQL but I'm stuck with it, since that's the current database. I'm using expo to run my React Native code. Do I need to use a server, like "MAMP?"
Let me know if there is any more info that is needed.
You cannot connect your app directly to your database.
You will need a server/API that acts as an intermediate between the app and the DB. You can code it in most programming languages and if you know PHP, having MAMP on your system will allow you to build your API with PHP.
I've seen others recommend against the use of mySQL
You should definitely question their reasoning. I've been using MySQL for many years now in small and big projects and it has never been an issue. If they're comparing it to non-relational DBs like Mongo, I can understand, it's easier to setup and maintain a NoSQL database than a relational one.
I assume you're not that experienced but I still purposefully used some terms that may be new to a beginner. Since I don't know your skills, I will refrain from pointing you to specific tutorials/articles.
I recommend you to Google anything you don't understand from this answer.

Can I connect to SQL with Node.JS without an external package, or with one universal package?

I know it may be reinventing the wheel to some extent, but I'm creating a package of my own in Node.JS where I would like to keep dependencies to an absolute minimum. This program should connect to SQL (at first, just MySQL, but eventually several different flavors, so if the same answer applies to PostgreSQL, MSSQL, etc. a note about that would be much appreciated) and be able to run queries and such. Is there a way to do so through Node without using an external package like mysql or mssql?
I do understand that this sounds very impractical, and so I see the need to use "fully debugged open-source software" as the commenter put it. However, requiring a new package for every SQL flavor I extend my program to would be impractical as well. If I must install a package, is there some sort of universal one that I can use for Node.JS (something like PDO in PHP)? If so, what is the basic way of connecting to, say, MySQL?
Thanks in advance.
Node has RDBMS-specific packages like mysql, pg, sqlite3, mssql, ibm_db, oracledb, ... all the same except where they aren't.
The php world boasts a couple of database abstraction layers that can talk to multiple makes and models of RDBMS. For Java, JDBC serves the same purpose.
The npm ladc package is a similar project for nodejs; it uses the existing packages for connecting to databases. It seems to be in an early version and not heavily used, according to its npm page.
Sequelize is an object-relational database abstraction above some RDBMSs. If you are able to use an object-relational model for your data, it's probably a good choice. If you're using lots of pure SQL, ladc might make sense.
It seems as if you're blazing a trail with your project.

Using PYQT with wordpress

I hope this is not an obvious question. However, I cant find any resources online, since everytime i google wordpress with pyqt, i get websites made with wordpress talking about pyqt.
Are there are resources or tutorials on integrating pyqt with wordpress. Or is this too vague, and it should be pyqt with mysql? Or is this just a bad way to write a program in python that gets data from a mysql database?
My understanding what you're looking for here is not to integrate PyQt with WordPress, but rather Python itself. PyQt it simply a toolkit that offers the GUI (and many more) module that you're likely using, but Python is still the "backbone" of your application.
In order to manipulate the database that WordPress uses, you'd have to manipulate that very database. For that, I recommend MySQLdb Python module. Alternatively, you could use the QtSql that PyQt comes with, but I honestly don't see the need for that.
However, I have to advise you that altering the database directly could have unwanted consequences and it could potentially break your WordPress installation - so make sure to backup the database often. Also, this poses a certain security risk. If I were you, I'd create a WordPress API (there may already be one, I'm not that familiar with WordPress) that will take HTTP requests and send responses as well, which your Python program would then use.

Is there a good DAL or DAL/ORM for Node.js yet?

I want to experiment a bit with Heroku and Node.js. Heroku uses Postgres by default but I would like the option to use Amazon RDS later on (MySQL). Is there a good database abstraction layer, preferably with a simple object relational mapper around it available at this point? I checked the NPM repository, but couldn't find something that supported both, looked mature and was well documented.
You might be interested in using another hosting provider. For example Duostack is super easy to set up and allows the usage of mysql: http://docs.duostack.com/node/databases#mysql
An ORM for MySQL is e.g. sequelize ( http://sequelizejs.com | https://github.com/sdepold/sequelize ).

how do you ensure database Interoperability

I'm starting a new opensource project (for real estate) and wanted to focus on using MySQL, but would also like to ensure it works in PostgreSQL. What is the best way to doing this without having to continually test in both environments? I'm assuming the db schema is close to the same, but there could be some differences on the SQL script to set up the databases - right? what about scripts?
What Development environment are you using?
if your using .NET, JAVA you could use an ORM(Object Relational Mapper) like Hibernate (NHibernate for .net) and that will take care of you db interoperability, for PHP or ruby I would look for something equivalent.
Edit point:
After looking at your profile it looks like your a python developer so you may find this link helpful what are some good python orm solutions posed on SOF 10 months ago
Seems to me that the only way to make absolutely sure is to target them both in your testing. I'm sure both DB's have development paths that may diverge, and you'll often find yourself faced with the prospect of using some MySQL-specific feature.
It's a PITA but the longer you go between tests against both the better the chance you'll have fireworks when you do.