Re: getAutocommit assertion error

rob stone <[email protected]>
Newsgroups gmane.comp.db.postgresql.jdbc
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.