Realm Java - Using raw sql - realm

I was searching the forum for a way to use a raw query in the realm database, but the examples in the forum doesn't exist or don't work.
Can anyone explain me how can I use a raw sql query on a Realm database?
Thanks for the help

Realm is not based on SQLite. It is an Object Store or Graph database. This means that SQL queries doesn't really make sense, since e.g JOIN's doesn't exist at all. So no, that isn't possible. All queries are created using realm.where() and similar methods.

Related

Query tool for RocksDB?

I have just started taking a look at rocksdb and was able to build a small springboot based app to perform basic CRUD operations on it. However, I was wondering if there is a ui tool that can be used to query or browse the data in rocksdb.
I am not sure if this is a valid question, but something like pgadmin for postgres or a client utility that can be used to browse through the data in this db?
Thanks, HK.
No, there isn't.
The reason for that is that there is no way a GUI client can know how to deserialize your data format.
I might save my values as pure strings - you might have it as json bytes - someone else might use protobuf - how would the gui client know how to deserialize it and show it in the UI?
Or would it just show the bytes? Which is unlikely to be useful

Zenoss Graph results of postgresql database query

So I just added my servers to Zenoss and installed some postgresql zenpacks. Unfortunatly I do not care for most of the postgresql monitoring tools. Instead of what they gave me, I am wondering if it is possible to send a custom query that I wrote, then graph the result using Zenoss? How do I go about doing this? Are there any good resources that you know of?
Thanks.
You will need to write your own ZenPack (or at least Template). Check Development Guide http://wiki.zenoss.org/ZenPack_Development_Guide or http://zenosslabs.readthedocs.org/en/latest/zenpack_development/
IMHO you will need zencommand datasource, which will execute your custom SQL query and this query output (number only) will be metric value, which will be processed by Zenoss.
Or you can expose metric(s) via SNMP and then it'll be only standard SNMP metric in Zenoss.
It's up to you how do you implement it. I recommend you to use community forum http://www.zenoss.org/forum for Zenoss related questions.

SDO vs DB Adapter oracle 11g

I publish this post in order to reveal the underlying idea of the real use of this tecnology.
I know this isn't a common question, but it doesn't mean that it isn't important.
If you were trying to work with lots of tables of a Database, and you were using lots of BPEL Services, would you choose SDO (Service Data Objects) instead of DBAdapters (DataBase Adapters)??
I have been working for few weeks with SDOs and I find these really useful, but I'm not sure if the use of SDOs is better than DB Adapters or not...
What do you think about this?? SDOs or DBAdapters??
Thanks in advance.
Basically SDO is Oracle SOA's attempt at an ORM and therefore you can simple look for information on ORM compared to JDBC. The DBAdaper is slight different from plain JDBC in it has extra features around polling and stored procedure integration.
DBAdapter for -> Simple SQL, Stored procedures, basic read write, delete and update and polling
SDO -> Highly reuseable code and everything that doesn't suit DBAdapter.
Here is a thread to look at http://forum.spring.io/forum/spring-projects/data/14117-jdbc-or-orm-framework-what-are-the-pros-and-cons

Convert function Postgresql to Sqlite

I have a problem with my iPad app. I have to convert a PostgreSQL database to SQLite database. Luckily I did it but I didn't know how to convert the PostgreSQL functions. Anyone knows how to did it? Or how can I get the same result in Sqlite?
Thanks in advance, Luca
As you allready discovered sqlite has no functions. So you will probably have to move some logic from the function and the single query out of your db into your app. This will probably mean executing a query looking at the result and based on that executing some more queries. So you can do the logic of the function in your app.
While this is not recommended in PostgreSQL as performance suffers from many small queries the performance loss in SQlite is much smaller as it is an embedded database (no communication overhead) and it's planner is more straight forward which makes the planning overhead of seperate queries smaller.

using SQLite with mod_perl

I have been successfully using SQLite as a data store for my web applications, but now I am implementing a web site with mod_perl, and am running into database locking issues.
As expected, my entire web application is loaded by the Plack Apache handler (Plack::Handler::Apache2) when the web server is started. Well, the first db query creates a lock on the entire database, and any subsequent query that has to modify the db fails.
What is my way out? Can I use SQLite in a persistent web environment or not? Should I be looking for some other db store?
I am not a fan of MySQL, and don't want to use it. I could potentially use PostGres, but I'd rather use something lightweight, and preferably sql-based as using key/value databases such as Tokyo Cabinet would require learning a whole new way. I'd rather really use SQLite.
If you have an open handle to the database, it can cause this issue. I have had problems when iterating over a result set during a log process causes the lock to stick around.
Try and fetch all the rows for the query and call $sth->finish() to clear up the lock. You will use a little more memory, but you will avoid the locking.
Knowing you are going to do this, you can make use of $sth->fetchall_arrayref() or $sth->fetchall_hashref()
Use Tokyo Cabinet's table database.

Resources