Oracle jdbc驱动程序在支持的映射类型上引发错误

时间:2019-06-03 22:29:10

标签: java oracle jdbc localdate java.time

我正在使用以下Oracle驱动程序:https://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html

我安装了jdk8。根据oracle的说法:我的驱动程序符合JDBC 4.2

compliance

此外,根据以下答案:https://stackoverflow.com/a/49073531/5145783 我的代码应该可以工作。


 List<TestDataObject> returnResult = new List<TestDataObject>();
            BsonDocument filter = new BsonDocument();
            Links links = new Links();
            try
            {
                filter.Add("EvaluationComplete", new BsonBoolean(isEvaluated));
                filter.Add("DateRunUtc", new BsonDateTime(DateTime.Now.AddDays(-7)),condition);
                var options = new FindOptions<BsonDocument>()
                {
                    Skip = skip,
                    Limit = limit
                };

                long count = await _testResultCollection.CountDocumentsAsync(filter);

                links = GetHATEOAS(count, skip, limit, hateoasUrl, "TestResult");

                using (var cursor = await _testResultCollection.FindAsync(filter, options))
                {
                    while (await cursor.MoveNextAsync())
                    {
                        var batch = cursor.Current;
                        foreach (BsonDocument document in batch)
                        {
                            TestDataObject testData = BsonSerializer.Deserialize<TestDataObject>(document);
                            testData.Self = self + "/self?id=" + testData.Id;
                            returnResult.Add(testData);
                        }
                    }
                }
            }

myCallableStatement.setObject("p_pr_submitted_date", myLocalDate, Types.DATE);

但是,我收到此错误:

  

java.sql.SQLException:请求了无效的转换

和/或

  

java.sql.SQLException:无效的列类型

这里也提到支持此映射:https://jcp.org/aboutJava/communityprocess/maintenance/jsr221/JDBC4.2MR-January2014.pdf

为什么会出现此错误?我的司机不正确吗?

0 个答案:

没有答案