penk: (Default)
[personal profile] penk

I didn't get as far as I had hoped to tonight, due to a variety of distractions - it was an impressive list of "things that get in the way of previous plans" (Work actually had work for me to do, then a stop by the Mosaic work site to check on some supplies, then dinner, then home to find the freezer has stopped freezing (due to a broken icemaker), then helping out Cat with some finance stuff so we can get our Mortgage application in. Ung!



Finally I sat down, and with The Time Machine on as background entertainment (not so good a movie - great for background noise - and what the heck is with Jeremy Irons? Is there no movie so bad he won't act in it? Sheesh) - I got down to work.



There were some great comments from yesterday on how to handle historical triggers on database updates. There's some challenges to using triggers (such as "who made this update?" - though using a 'last updated by' column on every record could fix this, I'm still not sure if it's a good idea). Jonah pointed out also that using database triggers limits the portability of the database layer. Given that MySQL isn't going anywhere, and that it's getting more and more attention as an enterprise-level database system, I'm not that worried about it, but I am taking that into consideration.



Tonight though I needed to find something short term to work through, so I focused on how 'notes' are applied to registrants. In the past, I would make a "NOTE" entry in the history table. These NOTEs could be anything from just an informational note by the operator ("This person was nice") to something important ("Paid by check"). Having NOTEs in history was "okay" but without filtering, it was hard to see operator comments in a meaningful way.



I also had a concept of 'NOTICE' records. These are essentially NOTEs to be displayed to the operator whenever a registrant logged in. They would show up as red messages on the registrant detail screen, and the operator would have to acknowledge the NOTICE before proceeding (that's the theory - in fact there was no logic to enforce this). These NOTICEs were very, er, noticeable to the operator, and were great for things like "DO NOT ADMIT THIS PERSON UNDER ANY CIRCUMSTANCE" (yes, we had a few of them, and I know of one instance where the CONGO 'NOTICE' record actually did prevent them from entering the event. Yay!). Generally though they were used for innocuous things like "STILL OWES $25" or the like.



For v2, I'm seperating out the NOTICE / NOTES into a separate table simple called 'Notes'. The option to making any note entry a 'notice' will be on the note creation, and it'll just be a flag on the record. Also the record will keep track of when the note was created, and by whom, as well as when it was acknowledged, and who acknowledged it.



The basic DAO structure is there, as is the data object, and I've created the schema file for it as well. Nothing is wired in yet, but I'm also still noodling around how I want the record to look, so I'm sure there'll be more work moving forward.



The other bit I did tonight was trying to squash a problem I'm having with the JDBC connection pooling. I'm using the C3PO connection pooling tool, and if CONGO has been idle for a while, I'll get a connection communications failure. Googling around hasn't showed me anything immediately obvious, though others have said they're having the same problem. What I'm trying now is adding some auto reconnection options to the JDBC connection string, so my c3po setup now looks like this:



private void configurePool() {
	logger.debug("Empty connection pool, recreating...");
	ComboPooledDataSource cpds = new ComboPooledDataSource(); 
	try {
		cpds.setDriverClass( "com.mysql.jdbc.Driver" );
	} catch (PropertyVetoException e) {
		e.printStackTrace();
	} 
	cpds.setJdbcUrl("jdbc:mysql://localhost/congo?autoReconnect=true&autoReconnectForPools=true");
	cpds.setUser("root"); 
	logger.debug("Initted.");
	applicationMap.put("cpds",cpds);
}


I won't know if it's working yet until I idle long enough to force a timeout. I'll let ya'll know.





Cloned from: Planet Geek!

Category: Programming-fu

Full article & comments: Link (Comment ticker: )

October 2022

S M T W T F S
      1
2345678
9101112131415
16171819202122
2324 2526272829
3031     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Apr. 7th, 2026 08:12 pm
Powered by Dreamwidth Studios