8

1

Using Mathematica 11.1 to insert into a MySQL table with this schema...

```
TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME DATA_TYPE TYPE_NAME
example Null indexkey Record 4 MEDIUMINT UNSIGNED
example Null indexkey ID -5 BIGINT
```

produces the following:

```
SQLInsert[conn, "indexkey", {"record", "id"}, {6631, 20042069300}];
SQLExecute[conn, "select * from indexkey where record = 6631"]
```

{{6631, -1432767180}}

However using Mathematica 7.0.1 this is the result:

{{6631, 20042069300}}

To get the same result in Mathematica 11.1 requires `ToString`

, e.g.

```
SQLInsert[conn, "indexkey", {"record", "id"}, {6631, ToString[20042069300]}];
```

Is this a bug?

A clue may be the following truth:

`1432767179 == FromDigits[Drop[IntegerDigits[20042069300, 2], 4] /. {1 -> 0, 0 -> 1}, 2]`

. Looks like only the 32 least significant bits are used of your input. The`-1432767179`

is the two's complement interpretation of the remaining bit pattern. – Sjoerd C. de Vries – 2017-03-28T19:38:57.303So, the next questions would be: Are you accessing the same database in both situations? If not, are you sure you defined the 11.1 ID as BIGINT? If this does not answer it, you might try another driver. According to the documentation 11.1 comes with 3 MySQL drivers. You could try a different one. – Sjoerd C. de Vries – 2017-03-28T20:03:03.917

@SjoerdC.deVries Yes, it's the same database. Everything's the same except the Matematica version. It looks like a bug to me. – Chris Degnen – 2017-03-28T20:14:44.003

Mathematica has these three connections: JDBCDrivers["MySQL(Connector/J)"], JDBCDrivers["MySQL(Drizzle)"],

JDBCDrivers["MySQL(MariaDB)"]. Which one are you using, and did you try one of the others? – Sjoerd C. de Vries – 2017-03-28T20:17:38.947

What does

`SQLColumns[conn,"key"]`

return? – Edmund – 2017-03-29T02:31:07.850@Edmund The table is actually called indexkey:

`{SQLColumn[{"indexkey", "Record"}, "DataTypeName" -> "MEDIUMINT UNSIGNED", "Nullable" -> 0, "DataLength" -> 8], SQLColumn[{"indexkey", "ID"}, "DataTypeName" -> "BIGINT", "Nullable" -> 0, "DataLength" -> 19]}`

– Chris Degnen – 2017-03-29T08:14:26.833