5

Requirement: An open source alternative to MATLAB database tool box.

Background: I have MATLAB provided at workplace but unfortunately it does not have Mathwork's Database toolbox licensed.

Research done: Though I am newbie but I have searched quite a bit on internet and what I found working for me is demo version of DBtool box Dbtool(http://energy.51.net/dbtool/index.htm). However, the demo version of DB toolbox works fine only on small databases. But whenever I use it on large databases, I get 'time out error'.

Thanks for your help Nikhil

skaffman
  • 398,947
  • 96
  • 818
  • 769
nikhil
  • 51
  • 1
  • 1
  • 2
  • By the time you have finished researching what's available, wrestled with the half-baked solutions and found something that works, most of the time, and covers more than half of your requirements, you will have wasted more of your time and of your employer's money than the toolbox would cost. Make the business case. – High Performance Mark Mar 08 '12 at 11:25
  • @nikhil: check this answer for an overview of how to access databases in MATLAB: http://stackoverflow.com/a/6600301/97160 – Amro Mar 08 '12 at 11:29

3 Answers3

2

I found my answer on How to connect to Microsoft SQL Server 2008 (MSSQL) from Matlab?

However, not every approach works for me. Let me explain a bit further:

The JDBC driver usually work the best. But you must know which JDBC driver to use with your project. For MS SQL, sqljdbc4.jar works just fine. If you connect to MySQL or postgreSQL, make sure you google it for the proper driver. (mysql-connector.jar for mysql and postgresql.jdbc4.jar or postgreSQL)

I have also tried the COM method with success only through ODBC. Finding the correct connection string is really a pain. You also need to install a proper ODBC driver which related to your project. Setting up ODBC connection is actually easy. Once you have DSN set, you just use the connection string like

connectStr = 'DSN=newDSN'; 
invoke(conn,'Open',connectStr);

Finally, if you decide to go with database toolbox (maybe not in your case), don't expect too much by using it. That toolbox just a wrapper for the above methods. You can definitely complete your project without using it at all.

Community
  • 1
  • 1
Y. Chang
  • 595
  • 1
  • 5
  • 18
1

Some alternatives to what's already been suggested:

  • ZozaniDB is a database toolbox providing connectivity to Sqlite and Mysql databases (Other database connections may also be possible if you have the JDBC connector). ZozaniDB is more than a database connection; it provides on-the-fly schema generation and allows you to get/insert data without using SQL. (Disclaimer: I'm the developer of ZozaniDB).

  • If you are looking for a way to connect to SQLITE, Mksqlite does the job.

  • There's also a Mysql mex file that you would need to compile first: http://www.mathworks.com/matlabcentral/fileexchange/8663-mysql-database-connector

ahmetsacan
  • 31
  • 3
0

If you're working with MySQL you could try these submissions from the Matlab Central File Exchange. Neither require Database Toolbox. If you're not using MySQL, perhaps you could modify them to meet your needs.

queryMySQL

Access a MySQL database

Sam Roberts
  • 23,951
  • 1
  • 40
  • 64