Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java 8 to Java 11 migration of RowSet (getting error)

Tags:

java

When migrating our project to Java 11, we are getting this error related to our use of RowSet technology (see Tutorial).

java: cannot access com.sun.rowset.CachedRowSetImpl

class file for com.sun.rowset.CachedRowSetImpl not found.

java: incompatible types: com.sun.rowset.CachedRowSetImpl cannot be converted to java.sql.ResultSet

I came to know in Java 11, com.sun packages are not accessible.

How can I solve this?

like image 920
Sahasra Avatar asked Sep 08 '26 01:09

Sahasra


1 Answers

You should use RowSetProvider to get a factory.

RowSetFactory aFactory = RowSetProvider.newFactory();
CachedRowSet crs = aFactory.createCachedRowSet();

From the Javadoc:

A factory API that enables applications to obtain a RowSetFactory implementation that can be used to create different types of RowSet implementations.

like image 79
HariUserX Avatar answered Sep 10 '26 16:09

HariUserX



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!