Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: JDBC passthru or MariaDB / PostgreSQL mock server?
1 point by m3047 on Nov 13, 2022 | hide | past | favorite | 1 comment
I'm working with an application which only logs to a SQL db; it uses JDBC. It comes with JDBC drivers for MariaDB and PostgreSQL. It is possible to install additional JDBC drivers.

I want to do some other logly things with the logs. I think what I need is either a mock server which will output the INSERTs received, or a JDBC driver which outputs the same thing (preferably to a network connection). Being able to respond to other things sent by the application with canned responses would be a bonus.

Any suggestions would be greatly appreciated, thanks in advance.




After some monkeying around with MariaDB I stumbled on this:

  use test;
  create table JsonTable ( a_str varchar(32), a_int int, a_float double(12,4) )
  engine=CONNECT table_type=JSON option_list='pretty=0' lrecl=128;
which when given

  insert into JsonTable values ('bar', 43, 3.14);
produces

  {"a_str":"bar","a_int":43,"a_float":3.1400}
in the file /var/lib/mysql/test/JsonTable.json

I note that according to the documentation and the setting of secure_file_priv it should be writing the file in /var/lib/mysql-files/ but oh well. (MariaDB 10.2.25)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: