ODBC (Open Database Connectivity) database abstraction layer or API for XBMC? - Printable Version
+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Feature Suggestions (/forumdisplay.php?fid=9)
+--- Thread: ODBC (Open Database Connectivity) database abstraction layer or API for XBMC? (/showthread.php?tid=37449)
ODBC (Open Database Connectivity) database abstraction layer or API for XBMC? - Cheekyboy - 2008-09-20 00:52
I'm sure this has cropped up in one guise or another on various threads but I'm not sure theres a specific thread to discuss the technicalities of it so I thought I'd start one.
As xbmc grows and springs up on more and more platforms I was wondering if it would be possible to incorporte an ODBC layer between XBMC and the database. This would allow different platforms to use, should they wish, different database engines and would also allow users to chose their own scale of system to suite their needs, from small scale to power user. I'm sure theres a whole host of SQL Server, Oracle, MySQL devs out their itching to get their media collection onto their favorite db platform. I'd be more than happy to get stuck in on the SQL Server implimentation
- jmarshall - 2008-09-20 01:03
All the db functions (pretty much) including queries and so on are done in the *Database.cpp/h files.
There's a couple of other calls with queries, notably the Smartplaylist.cpp file, and the httpapi stuff, but that should at least be a starting place.
We ofcourse welcome with open arms anyone wanting to do work in this area.
What are the Pros and Cons with ODBC? - Gamester17 - 2008-09-21 01:23
OK, so from what I understand the ODBC API would make it simpler for XBMC to change the actual SQL database server back-end if needed/wanted, like if someone for example like to fork XBMC for Linux to use PostgresSQL or MySQL instead of SQLite, ...plus it would maybe also enable better direct access for the Web Interface (HTTP API) and Python to the databases as well, is that correct?
Are there any other Pros and Cons with ODBC?
@Cheekyboy, for tracking purposes please also submit a new feature request ticket for this on trac
By the way, I found these two related topic threads when I did a search for "ODBC" in the forums:
Here is some information I found about ODBC (Open Database Connectivity) on wikipedia:
Quote:In computing, Open Database Connectivity (ODBC) provides a standard software API method for using database management systems (DBMS). The designers of ODBC aimed to make it independent of programming languages, database systems, and operating systems.
Quote:iODBC (Independent Open DataBase Connectivity) offers an open source, platform-independent implementation of both the ODBC and X/Open specifications, generally used on platforms other than Microsoft Windows. OpenLink Software maintains and supports the iODBC project and distributes its software under the LGPL and/or BSD License. Apple chose to bundle iODBC into Mac OS X and Darwin, starting with Darwin 6.0 and Mac OS X v10.2. Programmers have ported iODBC to several other operating systems and hardware platforms, including Mac OS 9, Linux (x86, x86-64, IA-64, Alpha, MIPS, and ARM), Solaris (SPARC and x86), AIX, HP-UX (PA-RISC and Itanium), Compaq Tru64, Digital UNIX, Dynix, Generic UNIX 5.4, FreeBSD, DG-UX, and OpenVMS.
- Cheekyboy - 2008-09-21 20:53
The idea would be to put the ODBC interface layer between the XBMC code calls to the database and the actual database itself. I'm not sure if there is an official ODBC driver for SQLite but i found this as a starter for 10 http://www.ch-werner.de/sqliteodbc/html/index.html Its existence suggests there probably isnt an official one
Basically, once XBMC was changed to use ODBC as the database connection method rather than, I'm guessing here as I havent read the code, a specific SQlite one you could substitute SQLite for any other database engine that supports the SQL feature XBMC uses. Usually the changing of databases is just a configuration change with no code changes so could be controlled via advancedsettings.xml.
I tried to raise a trac but for some reason I cant log in
- Gamester17 - 2008-09-22 01:15
Cheekyboy Wrote:I tried to raise a trac but for some reason I cant log inBoth the username and password are case sensitive, (while the forum login is not), that is usually the problem so please try again with that in mind.
- Cheekyboy - 2008-09-22 11:15
Ticket #4954 raised in new Feature Requests. I have added OLEdb/ADOdb as other possibilities because really it doesnt matter which technology is used, whichever one has best support in the code across all platforms will do.
ODBC is the way to go, and iODBC cross-platform open source library is the best... - Gamester17 - 2008-09-23 14:34
After the research I now done (as a non-programmer but technically inclined person) I have come to the conclusion that ODBC is the API that I think would fit XBMC codebase for this purpose, that is as an database abstraction layer between XBMC GUI (XBMC's libGUI code) and the SQL databases it uses currently for videos and music.
FYI; OLEDB is designed by Microsoft as is not cross-platform so that goes out the door directly as it would not fit XBMC's multi-platform design.
As for ADOdb I have come to a other conclusion; it would be great to have both ODBC and ADOdb in XBMC but not to serve the same purpose. ODBC looks to be to definitely be the database abstraction layer to use between the XBMC GUI (XBMC's libGUI code) and the SQL databases for videos and music, however would also be good to have in ADOdb but as database abstraction layer between XBMC's python scripts and XBMC's Web Interface because that is what ADOdb is designed to be. So what I have done is to create a separate ticket on trac for ADOdb, see trac ticket #4946.
So I think we should only concentrate on looking at ODBC in this ticket.
In my research I found iODBC which is an cross-platform open source (LGPL) library for ODBC which I guess will probably suit XBMC codebase best for the purpose of being the database abstraction layer between XBMC GUI (XBMC's libGUI code) and the SQL databases for videos and music.
iODBC offers a platform-independent ODBC SDK and runtime offering that enables the development of ODBC-compliant applications and drivers outside the Windows platform.
Cheekyboy Wrote:Ticket #4954 raised in new Feature Requests. I have added OLEdb/ADOdb as other possibilities because really it doesnt matter which technology is used, whichever one has best support in the code across all platforms will do.I rewrote your request for ODBC only as OLEdb is not cross-platform (unlike ODBC/ADOdb) and ADOdb would not suit this purpose in XBMC, ADOdb would however serve a other purpose in XBMC (as an database abstraction layer for python scripts and the web interface) so I created a separate ticket on trac for ADOdb.
- wstewart - 2009-06-11 04:52
unixODBC is another one that looks interesting. It seems to be compatible with Microsoft's ODBC implementation and should be a good option to support the linux/OS-x builds, while remaining compatible with a windows build that uses the MS API.
Looks like unixODBC and iODBC are interchangeable.
ODBC or ADOdb? - Gamester17 - 2009-06-11 17:57
Note! I still do not fully understand if ADOdb SQL database abstraction layer API would be better here instead of ODBC or not?
Does anyone know the differences between ADOdb and ODBC?
If their function is the same for our purposes then ADOdb Lite looks very nice at first glance:
Which would be best for XBMC here, remembering that XBMC is cross-platform needing to run on multiple operating-systems and processor-architectures, and that XBMC is designed to be an embedded application with a small memory footprint as possible? Cross-platform and platform-independence is very important if it is to be accepted into the XBMC mainline code!
PS! Know that we been highly recommended by all to use PostgresSQL instead of MySQL!
http://en.wikipedia.org/wiki/PostgreSQL (worth keeping in mind so that the API is compatible)
- wstewart - 2009-06-11 18:32
I think ODBC will be a better choice since it is support in windows.
"ADOdb is a database abstraction library for PHP", which likely means there is no C library for it. We need a C library to port the code over, which ODBC does have, ODBC will also support PHP and Perl I believe.
As far as mysql vs postgresql, won`t matter which you use with ODBC as long as there is a driver for it. It is totally transparent with ODBC from what I understand. Personally I prefer mysql, I have used both mysql and postgres.
Just starting to get into it, but the code changes from Sqlite to ODBC may not be too bad. Still would use similar SQL statements that are currently in the code, just need to just different function calls for the API.