Anyway, I've given up using the applet to add data to database. It occurred to me that since applet runs on client side while the database is supposed to be on the server side, this approach is flawed.
I'm gonna try using a servlet to do the JDBC work while the applet (invoked from a JSP) will just collect the data and pass it to the servlet. Is this approach better?
Wouldn't say that approach is flawed per se - you still have to transfer the data so it probably wouldn't be faster. That being said placing the code on the server might make your application more maintainable. Should you make a servlet you should take care to code carefully to avoid things such as SQL injection. Further, you may still have security issues with an applet depending upon the server configuration.