KonaKart Community Forum

Installation / Configuration => Installation of KonaKart => Topic started by: Andreas on October 11, 2015, 07:13:57 pm

Title: 8.0.0.0 java.sql.SQLException: Could not convert
Post by: Andreas on October 11, 2015, 07:13:57 pm
Hi,

i did a fresh 8.0.0.0 installation, and did a checkout, after confirming the order, this error shown up:

[#|2015-10-11T19:01:10.656+0200|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=167;_ThreadName=Thread-2;|11-Okt 19:01:10 WARN  (?:logInsertFailure:?) Problem during INSERT : java.sql.SQLExce
ption: Could not convert [] to -1 SQL>
INSERT INTO orders_status_history (comments, customer_notified, updated_by_id, orders_status_id, orders_id, date_added) VALUES ('', 1, 7, 1, 2, '2015-10-11 19:01:10.649');
|#]
[#|2015-10-11T19:01:10.755+0200|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=167;_ThreadName=Thread-2;|11-Okt 19:01:10 WARN  (?:saveOrder:?) Exception saving an order: Query details:
Criteria:: SELECT  FROM  WHERE orders_status_id=1 AND updated_by_id=7 AND orders_id=2 AND customer_notified=1 AND comments='' AND date_added=2015-10-11 19:01:10.649
|#]

[#|2015-10-11T19:01:10.764+0200|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=167;_ThreadName=Thread-2;|11-Okt 19:01:10 ERROR (?:handleException:?) A customer has received the following exc
eption ( ref: 1444582870755 )
com.konakart.app.KKException: org.apache.torque.TorqueException: java.sql.SQLException: Could not convert [] to -1
        at com.konakart.app.KKEng.manageThrowable(Unknown Source)
        at com.konakart.app.KKEng.saveOrder(Unknown Source)
        at com.konakart.al.OrderMgr.saveOrder(Unknown Source)
        at com.konakart.actions.CheckoutConfirmationSubmitAction.execute(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)

KonaKart V8.0.0.0-C0 () built 10:27AM 7-Sep-2015 BST [DB: 8.0.0.0 MySQL]
java version "1.7.0_75" on openSuse 13.1
GlassFish 3.1.2

Title: Re: 8.0.0.0 java.sql.SQLException: Could not convert
Post by: greg on October 12, 2015, 12:01:34 pm
Could it be that you need to add "?zeroDateTimeBehavior=convertToNull" to your JDBC URL.

This is part of the default template format that we suggest.
Title: Re: 8.0.0.0 java.sql.SQLException: Could not convert
Post by: Andreas on October 12, 2015, 03:19:27 pm
I did:

torque.database.store1.adapter              = mysql
torque.dsfactory.store1.connection.driver   = com.mysql.jdbc.Driver
torque.dsfactory.store1.connection.url      = jdbc:mysql://localhost:3306/konakart?zeroDateTimeBehavior=convertToNull
torque.dsfactory.store1.connection.user     = konakart
torque.dsfactory.store1.connection.password = ...
Title: Re: 8.0.0.0 java.sql.SQLException: Could not convert
Post by: Andreas on October 12, 2015, 03:46:09 pm
The SQL command

SELECT  FROM  WHERE orders_status_id=1 AND updated_by_id=7 AND orders_id=2 AND customer_notified=1 AND comments='' AND date_added=2015-10-11 19:01:10.649

is wrong (if the statement is correct logged):

select * from orders_status_history WHERE orders_status_id=1 AND updated_by_id=7 AND orders_id=2 AND customer_notified=1 AND comments='' AND date_added='2015-10-11 19:01:10.649'.

Next issue could be that the milliseconds are not save correctly, if i do the insert by hand and do the select command, it shows no entry.

SELECT * FROM orders_status_history WHERE orders_status_id=1 AND updated_by_id=5 AND orders_id=2 AND customer_notified=1 AND comments=''

Shows the last entry.
Title: Re: 8.0.0.0 java.sql.SQLException: Could not convert
Post by: greg on October 16, 2015, 01:22:21 pm
The first "SELECT" statement you refer to does not claim to be a complete SQL statement.  Look carefully at the log and you'll see it is prefixed by: 

Exception saving an order: Query details:
Criteria::

It's just showing the Criteria details from the WHERE clause.


I see you've moved the application to Glassfish.  There's no problem with that but could you be using an incompatible JDBC driver?

When you first installed under the bundled tomcat did it work OK?   That would be a good test to try.

Which version of MySQL are you using?
Title: Re: 8.0.0.0 java.sql.SQLException: Could not convert
Post by: Andreas on November 02, 2015, 05:31:40 am
Thanks for that hint. It is a mariadb-5.5.45-10.1.x86_64.

I mixed the db config with mariadb and mysql, in torque.dsfactory.store1.connection.url was mariadb instead of mysql.