2023.09.23 02:04 AM - edited 2023.09.23 03:01 AM
I'm trying to connect to a 4.5 KX Platform RDB process on a remote server with the jdbc.jar using SQuirreL SQL Client or NiFi 1.23.2 with the DBCP service or using the Example1.java from the Github page but all fail to work with the following error:
Error: s.k. OS reports: No such file or directory
My connect string is jdbc:q:myservername:5007 and class is jdbc. The connection test passes and I can list tables in SQuirreL but am unable to make the most basic select statement work with any of the 3 options above.
What can I check or what am I missing?
2023.09.23 04:07 AM - edited 2023.09.23 05:12 AM
Ok I figured out that the ps.k file from the qodbc3.zip was not loaded in the q process per https://code.kx.com/q/interfaces/q-server-for-odbc3/ but even though there is no permission issue with the file it reports "no such file or directory" on trying to load it from the running process. The command that I run from ScratchPad while connected to the q process is: \l /mypath/ps.k
Edit 1: it helps to use the correct server when doing the load. So, I was able to load the ps.k file and get the connection to work for SQuirreL and the example Java program. I need to continue troubleshooting NiFi as that is giving me an error:
ExecuteSQL[id=9a500a9f-0189-1000-ffff-ffffb8a8d93d] Unable to execute SQL select query [select * from company]. No FlowFile to route to failure: org.apache.nifi.processor.exception.ProcessException: java.lang.IllegalArgumentException: createSchema: Unknown SQL type 0 / (table: NiFi_ExecuteSQL_Record, column: time) cannot be converted to Avro type - Caused by: java.lang.IllegalArgumentException: createSchema: Unknown SQL type 0 / (table: NiFi_ExecuteSQL_Record, column: time) cannot be converted to Avro type
Edit 2: The "SQL select query" entry had to have a cast added in the NiFi ExecuteSQL processor like this (cast each unrecognized column to the correct type, text in my case):
select unit,category,cast(name as text) from categoryUnits
Now everything is working as it should.
2023.09.23 04:07 AM - edited 2023.09.23 05:12 AM
Ok I figured out that the ps.k file from the qodbc3.zip was not loaded in the q process per https://code.kx.com/q/interfaces/q-server-for-odbc3/ but even though there is no permission issue with the file it reports "no such file or directory" on trying to load it from the running process. The command that I run from ScratchPad while connected to the q process is: \l /mypath/ps.k
Edit 1: it helps to use the correct server when doing the load. So, I was able to load the ps.k file and get the connection to work for SQuirreL and the example Java program. I need to continue troubleshooting NiFi as that is giving me an error:
ExecuteSQL[id=9a500a9f-0189-1000-ffff-ffffb8a8d93d] Unable to execute SQL select query [select * from company]. No FlowFile to route to failure: org.apache.nifi.processor.exception.ProcessException: java.lang.IllegalArgumentException: createSchema: Unknown SQL type 0 / (table: NiFi_ExecuteSQL_Record, column: time) cannot be converted to Avro type - Caused by: java.lang.IllegalArgumentException: createSchema: Unknown SQL type 0 / (table: NiFi_ExecuteSQL_Record, column: time) cannot be converted to Avro type
Edit 2: The "SQL select query" entry had to have a cast added in the NiFi ExecuteSQL processor like this (cast each unrecognized column to the correct type, text in my case):
select unit,category,cast(name as text) from categoryUnits
Now everything is working as it should.
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.