how do you ensure database Interoperability - mysql

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.

Related

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.

Locomotive with mysql

I am planning to use Locomotive for a project...But as the official website says it cannot work with MySQL. However my requirement is to use it with MySQL.
Has any one used it with mySQL? Any pointers or advises would be great. Thanks.
Cheers,
Abi
Locomotive uses Mongoid - which is an ORM for MongoDB. As such, you cannot use it with MySQL at all, since it leverages some features (dynamic attributes), which traditional RDBMS databases (such as MySQL) do not support.
That being said, MongoDB is pretty easy to install, so if you can get around your requirement of MySQL, then you should have no problems.
Decoupling Locomotive from MongoDB would be no small task at the moment, which is not to say that it is impossible.
Regarding your requirement of MySQL, if you are working on incorporating Locomotive into a larger web-application, one thing to consider is that your non-Locomotive models can still live in MySQL regardless of where Locomotive keeps its data.
From what i know it wont be possible to use locomotive only with mysql as it use heavily mondodb.
However it's not a problem to build your app living together with locomotive and use what ever orm you like.
Just configure your database.yml and the magic will happend ;)
cheers,
Gregory horion

How to integrate Visual FoxPro w/ MySQL for eCommerce website?

I'm working on an eCommerce website for a small merchant. This merchant uses Opera (which is based on Visual FoxPro) to manage his in-store inventory, and would like the online store inventory to reflect the in-store inventory.
I'm guessing that my first step is to set up a way to regularly transfer the information from the VFP database to a MySQL database on the website's server. Is there an established process for this? Am I even approaching this problem from the right angle? I've heard a lot about ODBC, but am unsure as to how to implement it or if it's what I'm looking for in this situation.
If it wasn't obvious by this point, I'm in over my head here, and would appreciate any and all advice you may have, including links to articles or tutorials that can help improve my general understanding of all the moving parts here.
Thanks much.
Co-worker developed synchronization process between VFP and MSSQL2008. WCF service which took input directly from VFP.
On other project - as far as i remember, when we tried ODBC .NET data adapter, it had problems with encodings and foreign languages. That's why we used COM+, serialization for communication with .NET.
But it seems to me you are using PHP (eCommerce=>Drupal=>PHP) so you are in completely different situation.
In your case, i would start with checking out if Opera (i guess it's this Opera) provides built-in export and eCommerce provides built-in import. Mostly because it might be tedious work to sync data manually from 2 apps coded by someone else. Then i would research if i/o can be joined and automated (something like scheduled task on win environment). Unfortunately, can't help much more because i'm unfamiliar with those tools, products and technologies.
Anyway - it seems to me like quite hard and dirty task and i wish you good luck. :)
Depend on what is that you are using to implement the website.. in general it is pretty easy with ODBC (In Java , I did it using the jdbc-odbc bridge)

Developer tools to directly access databases [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I work with several different databases and find myself trying connecting to these quite often to test a query. I use the database specific tools to connect to the DB and run the query.
I find these DB specific tools like SQL Query Analyzer (SQL-Server), Oracle Enterprise Manager, MySQL Query Browser to be quite clunky and slow when it comes to running quick queries and looking at data directly. It is also hard to remember all the userids and pwds for the develop and test databases.
What tools do you use as developers to connect to the database of choice? I use Eclipse as an IDE. So any Eclipse specific tips are also appreciated.
Even if a tool were to work with one DB and not with the other, I am willing to look into it if it were more user-friendly than the one the DB vendor provides. I am already using 3 different ones.
SQuirreL, written in java, will work with any RDBMS for which there's a JDBC driver.
It works very well for both sending SQL, rendering result sets, and allowing browsing of database objects (from a tree). For several RDBMS, it includes extensions to automatically generate common statements.
Especially nice is that the query pane executes either the selected sql, or the line the cursor is on up to the first blank line. This allows you to write several statements, and to execute them either individually or in a batch.
And it's free and open source.
I've used quite a few.
PL/SQL Developer: as the name implies this is Oracle specific but is by far my favourite DB tool. It greatly simplifies import/export;
Toad: Also Oracle-specific. I used to be a big fan of this but it's expensive and I think more DBA-oriented these days. For a developer I don't think it offers all that much (given the price difference) over PL/SQL Developer;
DBVisualizer: this tool isn't bad. I'm not sure the commercial version is worth the price they're asking for it. The free version is OK. It's good that it works with pretty much any database;
Navicat for MySQL: it's OK but honestly I wouldn't pay for it;
SQL Server management Studio: comes with SQL Server. I don't think I really need much more for SQL Server than this except perhaps a better way of importing/exporting databases, soemthing for which this is garbage;
Oracle SQL Developer: this is the poor man's tool you use on Linux when you don't have much other choice. It's fairly basic but OK given that it's free.
Also a nice tool is the AquaDataStudio
I've used:
TOAD
DBVisualizer
I prefer DBVisualizer, but it's a bit of a memory hog so it might not be the right solution if your resources are an issue.
I've tried the eclipse plugins as well. For me I'd rather keep eclipse optimized to do the work it's meant to do.
When it comes to stuff like this, I prefer portable tools. Installed once, you can put them on flash or CD and carry with you. Connecting to DB should be easy as filling out usual fields: server, user, pwd..
Sql Buddy
Decent one, open source, with syntax highlighting & code completition. Not recently updated but it generally works OK.
GiPo#DB Utilities
Very nice one, has all of the above features plus its more feature filled as it was previously commercial.
Mentioned tools are not more then few MBs in size and it takes 1 minute to install them and copy them to your portable location.
Within Eclipse you can use the Eclipse Data Tools Platform for doing database development. In recent versions you can find some kind of visual query builder as well. Oracle has a plugin for DTP and implements some Oracle-specific functions.
Database Workbench can be use for Oracle - SQL Server and MySQL
http://www.upscene.com
have a look at Rapid SQL
it is a cross-platform SQL IDE that helps database and application developers produce high quality SQL code faster.Embarcadero Rapid SQL helps you increase database development efficiency by:
Streamlining SQL coding tasks, object management, reverse-engineering, source code control and schema deployment
Improving team collaboration and resource sharing
Accelerating application development cycles with code assist, Quick Fixes, SQL to Java round-trip debugging, and profiling tools
Standardizing with one tool set with deep cross-DBMS platform support
Aqua Data Studio and RapidSQL are two great tools/IDEs for sql development. You can connect almost any database engine and they include some vendor specific features for say Oracle etc..
Also since you use Eclipse IDE, you may consider Eclipse Data Tools Platform or QuantumDB plugin.
The tools depends a bit of the kind of work to do. For most browsing I go for DbVisualizer, I can customize it exactly to my needs. The support is good and responsive. For pl/sql editing I prefer oracle sqldeveloper.
DbVisualizer is not a free tool but the price is fair, maybe even cheap when compared to Toad. It is also multi database but this is implemented in such a way that I am not limited in my oracle world and it helps me navigating on other vendor rdbms that I don't know so well.
For real time monitoring DbVisualizer has a very nice option that I have not seen in any other application. VERY usable if you are trying to debug some, for example, performance problems.
Ronald
Check out RazorSQL. It has all the features of the most expensive tools at a fraction of the price.

Writing a unit testing framework for testing SQL stored procedures

Today I had an idea of writing a unit testing framework for stored procedures in MySQL. The full idea is written on a recent post on my blog. In short it goes like this:
I want to automate my procedure testing, I want to use a standardized way to test my procedures. Unit testing is widely documented, and there are a zillion XUnit frameworks out there, why not write one for MySQL (or any other database).
It would be open source of course.
What do you think? It is silly, stupid, needless or what?
Or another idea would be to write a general database framework in SQL. Hmm, I really want to discuss that with someone, collect thoughts and ideas.
There's already one testing framework for Sql Server - TSQLUnit. Maybe you can get some useful info from it.
Yes, great idea. I've been having a fair bit of success with pgTAP. I've used it in a number of projects, both for test driven database development and to write tests for existing procedures in order to be able to effectively refactor them.
I have often been asked if there's something like it for MySQL. Maybe you've written something by now?
There are already unit tests out there. Apart from dbUnit and sqlUnit, try:
MyTAP: https://github.com/hepabolu/mytap
datacharmer.org: http://datacharmer.blogspot.com/2006/01/mysql-5-general-purpose-routine_27.html
I tend to unit test the data access layer, it is always a pain in the ass because you have to setup a proper database with proper data. There are data generators out there that can help (like RedGate's Data Generator) make the setup process simpler.
My thinking behind just testing the DAL, is that you are essentially testing the stored procedures themselves with the added .Net DB code which I don't think we need to worry about unit testing. This way you can leverage all the tools and processes you already have for unit testing. It seems like a lot of effort to develop a separate framework for something that can (IMHO) be performed equally well with existing tools.
I have an open mind though. If there are benefits I am overlooking please do tell me.
Cheers,
V
One of the benefits would be that the test would be written in the same envirment the stored procedures written and executed, maintaned by a specialized databse developer outside the main application.
There is no need for the application developer to be a master of programming a relational database nor for the database developer to master an modern application developing language.
You now have test for every thing. Why not have them for the database written sql and executed outside any in house developed application.
If you are developing a multi tier application it makes sense to separate each part and test it separately.
Try TST: http://tst.codeplex.com
There shouldn't be enough logic in the database to make testing worthwhile.