The connection is created by the below method
import com.j256.ormlite.jdbc.JdbcConnectionSource;
import com.j256.ormlite.support.ConnectionSource;
ConnectionSource connectionSource =
new JdbcConnectionSource(url + databaseName + "?currentSchema=trial&useSSL=false",
userName, password);
Right now there is unfortunately no way to set a timeout on the connection. I would recommend using a database connection pool to give you this functionality. You can use Apache's DBCP, HikariCP, or others.
To quote from the docs on pooled connection sources: