Some users have the comments for images stored in an external database and want JAlbum to use this info. Here's how to connect JAlbum to an external database. The example assumes that you are able to create an "ODBC datasource" for the database. In Windows you do this using the Control Panel. The datasource in this example is called "commentdb" and it happens to point to an MS Access database (could be any database) that contains a table called "comments". The table has two columns, one "filename" and one "comment" column. Here's how to read the data from this table into JAlbum and add the right comment to each image:
Step 1 Create a comments table in a database with the two columns "filename" and "comment".
Step 2. Fill the table with some data.
Step 3, create an ODBC datasource called "commentdb" pointing to your database (With MS Access you point the name to the .mdb file itself).
Step 4, start JAlbum, select a skin you wish to modify and add the following to the top of the index.htt file of the skin:
<%!
import java.sql.*;
Map comments = new HashMap();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:commentdb");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from comments");
while (rs.next()) {
String fileName = rs.getString(1);
String comment = rs.getString(2);
comments.put(fileName, comment);
}
rs.close();
stmt.close();
con.close();
%>
The whole contents of the "comments" table is now stored in the Map type object called "comments". Now edit the slide.htt file and add the comment for each image where you want it to show. Write like this:
<%= comments.get(fileName) %>
For more on using Java with databases, see this tutorial:
http://java.sun.com/docs/books/tutorial/jdbc/basics/connecting.html