Я заметил, что Javacachedrowset.updateDate(null) илиcachedrowset.updateNull(DateColumn) не работает. Всегда возникает ошибка. Я попробовал это в базе данных Apache derby версии 16.1 в столбце даты с нулевым значением. Кто-нибудь испытывает эту ошибку? Я использую openjdk 17. Думаю, это ошибка.
Я пытался использовать Statement.execute(query). Базовый столбец даты, допускающий значение NULL, в моей базе данных Apache derby 16.1 может быть установлен в значение NULL, если я обновлю его, выполнив Statement.execute(). но не с помощью cachedrowset.updatexxx(). Кто-нибудь может мне помочь?
**This is just a part of my code:**
JDBC_DRIVER = "org.apache.derby.jdbc.EmbeddedDriver";
private CachedRowSet cached_RowSet;
RowSetFactory myRowSetFactory;
**This is my code that creates the CachedRowSet object:**
myRowSetFactory = RowSetProvider.newFactory();
cached_RowSet = myRowSetFactory.createCachedRowSet();
cached_RowSet.setTableName("PROJECTS"); // it is necessary to setTableName equal to the table being queried, in order to update the cached rowset
// CachedRowSetImpl crs = new CachedRowSetImpl(); это не работает.
cached_RowSet.setUrl(DATABASE_URL);
cached_RowSet.setUsername(USERNAME);
cached_RowSet.setPassword(PASSWORD);
int [] keys = {1};
cached_RowSet.setKeyColumns(keys);
cached_RowSet.setConcurrency(ResultSet.CONCUR_UPDATABLE );
cached_RowSet.setCommand(strQuery);
cached_RowSet.execute();
**This is the code that updates to Null the Nullable Date Column in Apache Derby:**
cached_RowSet.absolute(row + 1);
cached_RowSet.updateDate("NullableDateColumn", null); --> gets error
cached_RowSet.updateNull("NullableDateColumn"); --> gets error
cached_RowSet.updateRow();
cached_RowSet.acceptChanges();
**This is the error that i get:**
java.sql.SQLDataException: 22005 : [0] DATE, [1] INTEGER
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:225)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:220)
at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(EmbedConnection.java:3208)
at org.apache.derby.impl.jdbc.ConnectionChild.newSQLException(ConnectionChild.java:153)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.dataTypeConversion(EmbedPreparedStatement.java:1714)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.setNull(EmbedPreparedStatement.java:345)
at java.sql.rowset/com.sun.rowset.internal.CachedRowSetWriter.updateOriginalRow(CachedRowSetWriter.java:752)
at java.sql.rowset/com.sun.rowset.internal.CachedRowSetWriter.writeData(CachedRowSetWriter.java:366)
at java.sql.rowset/com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:898) ........ xxxxxxxxx
**But, I can use this:**
cached_RowSet.updateNull("NullableDoubleColumn"); --> this is ok!
cached_RowSet.updateNull("NullableVarCharColumn"); --> this is ok!
cached_RowSet.updateNull("NullableIntegerColumn"); --> this is ok!
cached_RowSet.updateDate("NullableDateColumn",java.sql.Date.valueOf("2023-05-18")); --> this is ok!
I mean the CachedRowSet object can update to Null every other nullable column but not the nullable date column.
I really think this is a bug. Is this a bug?
I am using Apache Derby Database 16.1 and OpenJDK 17.
Подробнее здесь: https://stackoverflow.com/questions/764 ... -get-error
Java CachedRowSet.UpdateDate(null) всегда получает ошибку ⇐ JAVA
Программисты JAVA общаются здесь
-
Anonymous
1727239532
Anonymous
Я заметил, что Javacachedrowset.updateDate(null) илиcachedrowset.updateNull(DateColumn) не работает. Всегда возникает ошибка. Я попробовал это в базе данных Apache derby версии 16.1 в столбце даты с нулевым значением. Кто-нибудь испытывает эту ошибку? Я использую openjdk 17. Думаю, это ошибка.
Я пытался использовать Statement.execute(query). Базовый столбец даты, допускающий значение NULL, в моей базе данных Apache derby 16.1 может быть установлен в значение NULL, если я обновлю его, выполнив Statement.execute(). но не с помощью cachedrowset.updatexxx(). Кто-нибудь может мне помочь?
**This is just a part of my code:**
JDBC_DRIVER = "org.apache.derby.jdbc.EmbeddedDriver";
private CachedRowSet cached_RowSet;
RowSetFactory myRowSetFactory;
**This is my code that creates the CachedRowSet object:**
myRowSetFactory = RowSetProvider.newFactory();
cached_RowSet = myRowSetFactory.createCachedRowSet();
cached_RowSet.setTableName("PROJECTS"); // it is necessary to setTableName equal to the table being queried, in order to update the cached rowset
// CachedRowSetImpl crs = new CachedRowSetImpl(); это не работает.
cached_RowSet.setUrl(DATABASE_URL);
cached_RowSet.setUsername(USERNAME);
cached_RowSet.setPassword(PASSWORD);
int [] keys = {1};
cached_RowSet.setKeyColumns(keys);
cached_RowSet.setConcurrency(ResultSet.CONCUR_UPDATABLE );
cached_RowSet.setCommand(strQuery);
cached_RowSet.execute();
**This is the code that updates to Null the Nullable Date Column in Apache Derby:**
cached_RowSet.absolute(row + 1);
cached_RowSet.updateDate("NullableDateColumn", null); --> gets error
cached_RowSet.updateNull("NullableDateColumn"); --> gets error
cached_RowSet.updateRow();
cached_RowSet.acceptChanges();
**This is the error that i get:**
java.sql.SQLDataException: 22005 : [0] DATE, [1] INTEGER
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:225)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:220)
at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(EmbedConnection.java:3208)
at org.apache.derby.impl.jdbc.ConnectionChild.newSQLException(ConnectionChild.java:153)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.dataTypeConversion(EmbedPreparedStatement.java:1714)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.setNull(EmbedPreparedStatement.java:345)
at java.sql.rowset/com.sun.rowset.internal.CachedRowSetWriter.updateOriginalRow(CachedRowSetWriter.java:752)
at java.sql.rowset/com.sun.rowset.internal.CachedRowSetWriter.writeData(CachedRowSetWriter.java:366)
at java.sql.rowset/com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:898) ........ xxxxxxxxx
**But, I can use this:**
cached_RowSet.updateNull("NullableDoubleColumn"); --> this is ok!
cached_RowSet.updateNull("NullableVarCharColumn"); --> this is ok!
cached_RowSet.updateNull("NullableIntegerColumn"); --> this is ok!
cached_RowSet.updateDate("NullableDateColumn",java.sql.Date.valueOf("2023-05-18")); --> this is ok!
I mean the CachedRowSet object can update to Null every other nullable column but not the nullable date column.
I really think this is a bug. Is this a bug?
I am using Apache Derby Database 16.1 and OpenJDK 17.
Подробнее здесь: [url]https://stackoverflow.com/questions/76441988/java-cachedrowset-updatedatenull-always-get-error[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия