Only Java? Do you mean no database manager like MySQL, Oracle, SQL Server, etc?
If so, then you can use Apache Derby, an embedded database manager built in Java.
Take a look at this site.
Note the steps to connect with the embedded driver in the section Changing the application to use the Derby Embedded Driver.
This way, all your code will be written in java.