The data engines that can be embedded in Java applications seem to be rich, but in fact it is not easy to choose. Redis has poor computing power and is only suitable for simple query scenarios. The Spark architecture is complex and heavy, making deployment and maintenance very troublesome. Embedded databases such as H2\HSQLDB\Derby have simple structures, but their computing capabilities are insufficient and they do not even support basic window functions.
In contrast, SQLite has achieved a better balance in architecture and computing power, and is a widely used Java embedded data engine.
SQLite adapts to conventional basic application scenarios
SQLite has a simple structure. Although its core is developed in C language, it is well encapsulated and presented to the outside as a small Jar package, which can be easily integrated. in Java applications. SQLite provides a JDBC interface that can be called by Java:
Connection connection = DriverManager.getConnection("jdbc:sqlite::memory:"); Statement st = connection.createStatement(); st.execute("restore from d:/ex1"); ResultSet rs = st.executeQuery("SELECT * FROM orders");
SQLite provides standard SQL syntax, and there is no problem with conventional data processing and calculations. In particular, SQLite already supports window functions, which can easily implement many intra-group operations and has stronger computing power than other embedded databases.
SELECT x, y, row_number() OVER (ORDER BY y) AS row_number FROM t0 ORDER BY x; SELECT a, b, group_concat(b, '.') OVER ( ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS group_concat FROM t1;
SQLite still has shortcomings when facing complex scenarios
SQLite has outstanding advantages, but it still has some shortcomings when it comes to complex application scenarios.
Java applications may process a variety of data sources, such as csv files, RDB, Excel, and Restful, but SQLite only handles simple cases, that is, it provides a directly available command line loader for text files such as csv. :
.import --csv --skip 1 --schema temp /Users/scudata/somedata.csv tab1
For most other data sources, SQLite does not provide convenient interfaces. You can only hard-write code to load data, which requires calling the command line multiple times. The whole process is very cumbersome and timely.
Take loading RDB data source as an example. The general approach is to first use Java to execute the command line and convert the RDB library table to csv; then use JDBC to access SQLite and create the table structure; then use Java to execute the command line. Import the csv file into SQLite; finally index the new table to improve performance. This method is relatively rigid. If you want to flexibly define the table structure and table name, or determine the loaded data through calculation, the code will be more difficult to write.
Similarly, for other data sources, SQLite cannot be loaded directly, and it also needs to go through a tedious conversion process.
SQL is close to natural language, has a low learning threshold, and is easy to implement simple calculations, but it is not good at complex calculations, such as complex set calculations, ordered calculations, associated calculations, and multi-step calculations. SQLite uses SQL statements for calculations, and the advantages and disadvantages of SQL will be inherited. If you barely implement these complex calculations, the code will appear cumbersome and difficult to understand.
For example, the longest number of rising days for a certain stock, the SQL should be written like this:
select max(continuousDays)-1 from (select count(*) continuousDays from (select sum(changeSign) over(order by tradeDate) unRiseDays from (select tradeDate, case when price>lag(price) over(order by tradeDate) then 0 else 1 end changeSign from AAPL) ) group by unRiseDays)
This is not just a problem with SQLite. In fact, due to incomplete aggregation, lack of serial numbers, and lack of Due to object references and other reasons, other SQL databases are not good at these operations.
Business logic consists of structured data calculation and process control. SQLite supports SQL and has structured data calculation capabilities. However, SQLite does not provide stored procedures and does not have independent process control capabilities, so it cannot implement general Business logic usually uses the judgment and loop statements of the Java main program. Since Java does not have professional structured data objects to carry SQLite data tables and records, the conversion process is cumbersome, the processing process is not smooth, and the development efficiency is not high.
As mentioned earlier, the SQLite core is a C program. Although it can be integrated into Java applications, it cannot be seamlessly integrated with Java. Exchanging data with the Java main program requires time-consuming conversion. Performance will be significantly insufficient when large amounts of data are involved or interactions are frequent. Also because the kernel is a C program, SQLite will destroy the consistency and robustness of the Java architecture to a certain extent.
For Java applications, esProc SPL natively on the JVM is a better choice.
SPL fully supports various data sources
esProc SPL is an open source embedded data engine under the JVM. It has a simple architecture and can directly load data sources. It can be integrated and called by Java through the JDBC interface, and is convenient for subsequent calculations.
SPL has a simple architecture and does not require independent services. As long as the SPL Jar package is introduced, it can be deployed in the Java environment.
Load the data source directly, the code is short, the process is simple, and the timeliness is strong. For example, load Oracle:
The above is the detailed content of Java embedded data engine from SQLite to SPL instance analysis. For more information, please follow other related articles on the PHP Chinese website!

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于结构化数据处理开源库SPL的相关问题,下面就一起来看一下java下理想的结构化数据处理类库,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于PriorityQueue优先级队列的相关知识,Java集合框架中提供了PriorityQueue和PriorityBlockingQueue两种类型的优先级队列,PriorityQueue是线程不安全的,PriorityBlockingQueue是线程安全的,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于java锁的相关问题,包括了独占锁、悲观锁、乐观锁、共享锁等等内容,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于多线程的相关问题,包括了线程安装、线程加锁与线程不安全的原因、线程安全的标准类等等内容,希望对大家有帮助。

本篇文章给大家带来了关于Java的相关知识,其中主要介绍了关于关键字中this和super的相关问题,以及他们的一些区别,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于枚举的相关问题,包括了枚举的基本操作、集合类对枚举的支持等等内容,下面一起来看一下,希望对大家有帮助。

封装是一种信息隐藏技术,是指一种将抽象性函式接口的实现细节部分包装、隐藏起来的方法;封装可以被认为是一个保护屏障,防止指定类的代码和数据被外部类定义的代码随机访问。封装可以通过关键字private,protected和public实现。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于设计模式的相关问题,主要将装饰器模式的相关内容,指在不改变现有对象结构的情况下,动态地给该对象增加一些职责的模式,希望对大家有帮助。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 English version
Recommended: Win version, supports code prompts!

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools
