If you're using JDBC with applets, define methods with the keyword synchronized. That prevents other synchronized methods from getting in while an object is being accessed.
You can put Java/JDBC routines in JAR files that the DBMS can read. The SQL procedure declaration would look something like this:
CREATE PROCEDURE Sp_proc READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME <jar:name> LANGUAGE JAVA PARAMETER STYLE JAVA
The assumption here is that the DBMS supports SQL Java (SQLJ) routines, can load JARs, and can invoke a Java Virtual Machine (JVM). Some DBMSs (Informix and Sybase are examples) supply copies of Apache Web Server with their installation CD-ROMS. Oracle takes a different approach and loads its own JVM. With a standard Web server installed, it should be easy for the DBMS to access Java routines as servlets.