Export the data from PROD to a file using the export features of your database. Import the data from that file to TEST using the database's import features. Normally
JDBC shouldn't be involved at all, unless you're using a database which doesn't have import and export capabilities.