I've been playing with Java doing consultations with Prolog with the JPL library and it works for me, all right up there.
Then I made a Prolog connection to MySQL with ODBC and it worked great. Then I had a problem with making queries in Prolog connecting to MySQL through Java.
When I consult through Java and run the Prolog file trying to access the database, I get the following error:
% comandos.pl compiled 0.00 sec, 9 clauses
% library(error) compiled into error 0.00 sec, 81 clauses
% library(pairs) compiled into pairs 0.00 sec, 22 clauses
% library(lists) compiled into lists 0.01 sec, 205 clauses
% library(shlib) compiled into shlib 0.01 sec, 246 clauses
ERROR: /usr/lib64/swipl-6.6.6/library/odbc.pl:72:
'$open_shared_object'/3: /usr/lib64/swipl-6.6.6/lib/x86_64-</br>linux/odbc4pl.so: undefined symbol: PL_get_long
Warning: /usr/lib64/swipl-6.6.6/library/odbc.pl:72:
Goal (directive) failed: odbc:use_foreign_library(foreign(odbc4pl))
ERROR: Exported procedure odbc:odbc_query/4 is not defined
ERROR: Exported procedure odbc:odbc_fetch/3 is not defined
ERROR: Exported procedure odbc:odbc_prepare/5 is not defined
ERROR: Exported procedure odbc:odbc_execute/3 is not defined
ERROR: Exported procedure odbc:odbc_close_statement/1 is not defined
ERROR: Exported procedure odbc:odbc_debug/1 is not defined
ERROR: Exported procedure odbc:odbc_connect/3 is not defined
ERROR: Exported procedure odbc:odbc_disconnect/1 is not defined
ERROR: Exported procedure odbc:odbc_get_connection/2 is not defined
ERROR: Exported procedure odbc:odbc_end_transaction/2 is not defined
ERROR: Exported procedure odbc:odbc_set_connection/2 is not defined
ERROR: Exported procedure odbc:odbc_free_statement/1 is not defined
ERROR: Exported procedure odbc:odbc_clone_statement/2 is not defined
% /usr/lib64/swipl-6.6.6/library/odbc.pl compiled into odbc 0.02 sec, 324 clauses
ERROR: [Thread 1]: exception handler failed to define odbc:odbc_connect/3
Exception: (4) odbc:odbc_connect('DB_prolog', _G3108, [user(root), password(*******), alias(dbprolog), open(once)]) ?
I was investigating. I saw a single tutorial that was done in Windows and it worked, but the S.O. What I use is Fedora22. I'm not sure if it's my S.O. or the driver from ODBC to JLP.
Connection code in Prolog:
abrir_conexion:-
odbc_connect('DB_prolog',_, [user(root), password('*******'),
alias(dbprolog), open(once)]).
Java query code:
String t1 = "consult('comandos.pl'),abrir_conexion.";
Query q1 = new Query(t1);
System.out.println(t1 + " " + (q1.hasSolution() ? "correcto" : "fallo"));