swstephe / py2jdbc

Python JDBC Connector
MIT No Attribution
11 stars 0 forks source link

demical datatype error #7

Open ForgotLove opened 3 years ago

ForgotLove commented 3 years ago

When i select decimal data from table,i get this erro:java.sql.SQLException: Value is not a number: java.lang.String. …… File "D:\tools\Anaconda3\lib\site-packages\py2jdbc\dbi.py", line 149, in get value = rs.getDouble(i) File "D:\tools\Anaconda3\lib\site-packages\py2jdbc\sql.py", line 875, in <lambda> self.getDouble = lambda i, o=obj: cls.getDouble(o, i) File "D:\tools\Anaconda3\lib\site-packages\py2jdbc\wrap.py", line 199, in __call__ raise self.cls.env.exception(e) py2jdbc.sql.Instance: java.sql.SQLException: Value is not a number: java.lang.String One solution is use cast in sql. Another is use java.math.BigDecimal instead of Double to get the value. I hope it was helpful.