Re: getAutocommit assertion error

Поиск
Список
Период
Сортировка
От rob stone
Тема Re: getAutocommit assertion error
Дата
Msg-id 11e772e66843f44261d302615c438357203b6da2.camel@gmail.com
обсуждение исходный текст
Ответ на RE: getAutocommit assertion error  (adrien ruffie <adriennolarsen@hotmail.fr>)
Список pgsql-jdbc
Hello,




> > > private booleanisAutoCommit() {
> > >      try {
> > >      return pgStatement.getConnection().getAutoCommit();
> > >      } catch (SQLException e) {
> > >      assert false : "pgStatement.getConnection().getAutoCommit()
> > > should not throw";
> > >      return false;
> > >      }
> > >      }


From the doco:-

----
public static Connection getConnection(String url,
                       Properties info)
                                throws SQLException

Attempts to establish a connection to the given database URL. The
DriverManager attempts to select an appropriate driver from the set of
registered JDBC drivers.

Parameters:
    url - a database url of the form jdbc:subprotocol:subname
    info - a list of arbitrary string tag/value pairs as connection
arguments; normally at least a "user" and "password" property should be
included
Returns:
    a Connection to the URL
Throws:
    SQLException - if a database access error occurs
----

Assuming pgStatement is in fact a connection string, can't you:-

return pgStatement.getAutoCommit();


My 2 cents.

Robert




В списке pgsql-jdbc по дате отправления:

Предыдущее
От: adrien ruffie
Дата:
Сообщение: RE: getAutocommit assertion error
Следующее
От: jenca@lysator.liu.se
Дата:
Сообщение: Re: getAutocommit assertion error