DuckDB - anyone tried ?

peacemaker

Expert
Licensed User
Longtime User
 
Earlier I also come across an interesting db call HyperSQL (HSQLDB) which is written in Java.

I had thought before to support it in my DatabaseBuilder class.
 
When I was trying HSQLDB - I had it open 3 databases - 2 memory and one disk based. Think it took like 10 lines of java.
Code: Copy
public static void initDB(String dbName, String altdbName,int svrPort) throws ClassNotFoundException{

    server = new Server();
    server.setSilent(true);
    server.setLogWriter(null);
    server.setDatabaseName(0, dbName);
    server.setDatabasePath(0, "mem:"+dbName);
    server.setDatabaseName(1, altdbName);
    server.setDatabasePath(1, "file:"+altdbName);
    server.setDatabaseName(2, "groovytest");
    server.setDatabasePath(2, "mem:groovytest");
    server.setPort((int)svrPort); 
}
 
I posted it being impressed in DuckDB by

SELECT * FROM read_json("glossary.json")
SELECT * FROM read_csv('flights.csv', delim = '|', header = true, columns = { 'FlightDate': 'DATE', 'UniqueCarrier': 'VARCHAR', 'OriginCityName': 'VARCHAR', 'DestCityName': 'VARCHAR' });
SELECT
*
FROM
users AS u
JOIN read_parquet('s3://test-duckdb/project/9999-12-31/0.gzip.parquet') AS p
ON u.staff_project = p.id_project
 
Last edited:
When I was trying HSQLDB - I had it open 3 databases - 2 memory and one disk based. Think it took like 10 lines of java.
Code: Copy
public static void initDB(String dbName, String altdbName,int svrPort) throws ClassNotFoundException{

    server = new Server();
    server.setSilent(true);
    server.setLogWriter(null);
    server.setDatabaseName(0, dbName);
    server.setDatabasePath(0, "mem:"+dbName);
    server.setDatabaseName(1, altdbName);
    server.setDatabasePath(1, "file:"+altdbName);
    server.setDatabaseName(2, "groovytest");
    server.setDatabasePath(2, "mem:groovytest");
    server.setPort((int)svrPort); 
}
Do you use jdbc?
 
Do you use jdbc?
Code: Copy
    Dim driver As String = "org.hsqldb.jdbc.JDBCDriver"
    For p = 0 To chk - 1
        Dim pp As String = ($"jdbc:hsqldb:hsql://localhost:${serverPort}/"$ & tables(p))
        sqlnames(p).Initialize2(driver, pp, user(p), "")
    Next
I had it so the server would use a random port between 20000 and 30000 hence serverPort
 
Code: Copy
    Dim driver As String = "org.hsqldb.jdbc.JDBCDriver"
    For p = 0 To chk - 1
        Dim pp As String = ($"jdbc:hsqldb:hsql://localhost:${serverPort}/"$ & tables(p))
        sqlnames(p).Initialize2(driver, pp, user(p), "")
    Next
I had it so the server would use a random port between 20000 and 30000 hence serverPort
What is the purpose of random server Port?
 
What is the purpose of random server Port?
If I was looking for a database I would start with 3306 - with random port,any client that connects once validated, would get the port number to connect to.
 
If I was looking for a database I would start with 3306 - with random port,any client that connects once validated, would get the port number to connect to.
3306 is default port number used by MySQL.
So you mean you assign a dedicated port number to each client when they make a connection?
 
For DuckDB, do I need a C++ compiler?
Is there any good tool to directly create and edit the db?
I think there is also no support to use in Android.
 

What are the differences between DuckDb and the classic Sqlite?
Or better, WHY prefer DuckDb to Sqlite?
 
Back
Top