Reputation: 605
I am using jtds driver to connect to SQLServer from a UnixBox using windows authentication from a SpringBoot+JPA application. Its a standalone application and not a WebBased application. I am successfully able to connect to the same but when I try to save some data using JPARepository, I receive the following exception :
java.lang.AbstractMethodError: null
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setCharacterStream(JtdsPreparedStatement.java:1274) ~[jtds-1.3.1.jar:1.3.1]
I checked the corresponding source code in JtdsPreparedStatement
and found that there is no implementation for this method :
@Override
public void setCharacterStream(int parameterIndex, Reader reader,
long length) throws SQLException {
// TODO Auto-generated method stub
throw new AbstractMethodError();
}
As suggested here; we can implement the same and it is supposed to work. Can someone please explain how can I register my implementation of JtdsPreparedStatement
to be picked at runtime by the Spring container and not the default one ? or if there is any other option available ?
Edit : JtdsPreparedStatement
has a constructor with default scope; Can't even extend it
Upvotes: 1
Views: 3346
Reputation: 1755
There is an open jTDS bug for this. In short, the JDBC standards specifies two different methods for setting character stream:
Old method signature:
public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException
New method signature:
public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException
With the difference being the last parameter that was changed from long to int.
jTDS haven't implemented the new method, which is used by Hibernate, and therefore you get the AbstractMethodError.
You have 2 options here:
From my experience, don't count on an official release anytime soon.
Upvotes: 3