Error attempting to get column 'create_time' from result set
时间: 2024-02-09 08:04:59 浏览: 42
根据提供的引用内容,报错"Error attempting to get column 'create_time' from result set"的原因是Java中的createTime属性的类型是LocalDateTime,而数据库表的create_time类型为DateTime。在Druid1.1.21版本的数据源中不支持Java8的时间、日期类型。解决这个问题有两种方法:
1. 升级Druid到1.1.21版本:通过升级Druid数据源到1.1.21版本,可以解决这个问题。
2. 保持MyBatis Plus版本为3.1.0:如果不想升级Druid,可以将MyBatis Plus版本保持在3.1.0,这样就不会出现上述问题。
另外,还可以通过修改LocalDateTime为date类型来解决这个问题。
相关问题
Error attempting to get column MAKE_TIME from result set DateLocalTime datetime2
这个错误是由于尝试从结果集中获取名为MAKE_TIME"的列时现的。根据错误消息,结果集中的"MAKE_TIME"列的数据类型被识别为datetime2类型。可能的原因,查询语句中的列名拼写错误,或者结果集中确实没有名为"MAKE_TIME"的列。
解决这个问题的方法是检查查询语句中的列名拼写是否正确,并确保结果集中存在名为"MAKE_TIME"的列。如果列名拼写正确且结果集中确实存在该列,那么可能需要进一步检查数据库表结构和数据类型定义,确保与查询语句一致。
sqlLite3 attempting to get column 'create_time' from result set.
根据提供的引用内容,我无法找到与您提到的问题相关的信息。但是,我可以为您提供有关SQLite3中获取结果集中的列的信息。
要从SQLite3结果集中获取列,您可以使用fetchall()方法获取所有行,并使用row_description属性获取列的描述信息。然后,您可以使用列的索引或名称来访问特定的列。
以下是一个示例代码,演示如何从SQLite3结果集中获取列'create_time'的值:
```python
import sqlite3
# 连接到SQLite数据库
conn = sqlite3.connect('your_database.db')
# 创建游标对象
cursor = conn.cursor()
# 执行SQL查询
cursor.execute('SELECT create_time FROM your_table')
# 获取所有行
rows = cursor.fetchall()
# 获取列的描述信息
column_names = [desc[0] for desc in cursor.description]
# 获取'create_time'列的索引
create_time_index = column_names.index('create_time')
# 遍历结果集并获取'create_time'列的值
for row in rows:
create_time = row[create_time_index]
print(create_time)
# 关闭游标和数据库连接
cursor.close()
conn.close()
```
请注意,您需要将代码中的'your_database.db'和'your_table'替换为实际的数据库文件和表名。