| От | Daniel Schaedler |
|---|---|
| Тема | Re: problem to get nextval of a sequence |
| Дата | |
| Msg-id | 41D1608B.10109@daniel.schaedler.name обсуждение |
| Ответ на | Re: problem to get nextval of a sequence (Guillaume Cottenceau <gc@mnc.ch>) |
| Ответы |
Re: problem to get nextval of a sequence
|
| Список | pgsql-jdbc |
Guillaume Cottenceau wrote:
> Daniel Schaedler <postgres-jdbc 'at' daniel.schaedler.name> writes:
>
>
>>Hi List
>>
>>I try to get the 'nextval' of a sequence:
>>***
>> String query = "SELECT nextval('nodes_nodeid_seq')";
>> pstmt = conn.prepareStatement(query);
>> logger.debug("statement: " + pstmt.toString());
>> ResultSet ress = pstmt.executeQuery();
>> long newID = ress.getLong("nextval"); // <-- Exception
>>***
>>
>>I get the following Exception:
>>***
>>org.postgresql.util.PSQLException: ResultSet not positioned properly,
>>perhaps you need to call next.
>
>
> "perhaps you need to call next".
>
> Have you tried calling next?
uhhh....
....now yes...and it works.
When I expect only one set of data, I never call next. That's why I
ignored the statement.
thanks anyway.
Daniel
В списке pgsql-jdbc по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера