Well, I don't know if the answer is in jrun:sql tags. I was going to say that in addition to Mark and Drew's excellent commentaries on setting up connection pooling, another problem may be just that your code is doing too much database access. It's an easy mistake to make, getting lulled into thinking that, "hey, this page should have a list of x items that are in the database: I'll query the DB and show them". Works great, until
a: lots of people hit that page getting the same data b: you do this on lots of pages getting the same kind of data If it's possible that this information isn't changing from user to user (like a list of departments in an intranet app or a list of states in an ecommerce app), you really ought to investigate caching the resultset and using THAT for your subsequent displays of the data. Of course, this opens a bit of a can of worms (how to you keep the cached list in synch with changes reflected in the DB), and indeed some may argue this is where EJBs can help, but don't let fear of EJBs keep you from considering possibilities with simple beans or collections stored in application variables. I'll leave it to others to expound on this with examples (or comments for or against). It just seems that since you admit to being new to J2EE, it's easy for us to forget that the problems may be more straightforward (and more pernicious) than just connection pooling. /charlie -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 11:42 AM To: JRun-Talk Subject: RE: Caching connection Thanks for replying Drew, I already have a datasource for my app. I guess the step that I as missing was using the jsp and <jrun:sql> tag! I just went to the doc of taglib and all the answers were there! Thanks again! "Drew Falkman" To: Jrun-Talk <[EMAIL PROTECTED]> <drew@drewfal cc: kman.com> Subject: RE: Caching connection 02/20/2002 11:01 AM Please respond to jrun-talk Hey- JRun offers the ability to pool your database connections using JDBC. You can setup datasources in the JRun Management Console, then access them using their datasource name. To setup a datasource: 1. Login to the JMC, click the plus sign next to the appropriate server instance in the left menu. This opens the sub-menu for that server. 2. Click the JDBC Data Sources link. This will bring up the data source menu screen on the right frame. 3. Click the "add" button - this will start the add datasource wizard. 4. On the first screen, select your driver type (MS SQL Server - a native db driver is included if you are using Advanced or Enterprise), Enter the datasource name - this is what you will refer to in your application - and a brief description (optional). 5. On the next screen, you are asked for the database address/port number, the database name (in SQL Server) and security information. Enter the appropriate responses. 6. The next screen will as you for connection information - do you wish to pool connections (yes, you should, most likely), when should the connection timeout and at what interval should the connection retry a query if the database is unavailable or busy. You can also enter any vendor arguments you like for instantiating the connection. 7. Click next and you are finished. Now you can refer directly to this datasource in your applications (this is extremely easy if you are using JSP and the <jrun:sql> tag...) Drew Falkman Author, JRun Web Application Construction Kit http://www.drewfalkman.com -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 7:56 AM To: JRun-Talk Subject: Caching connection Our office is new in implementing J2E technology. We are set up with JRun and ms sql server. The db admin was horrifed when he opened the sql server log and saw all the connections by one of my applications. Basically, the site queries the db almost at every page, to collect, display the different info. So everytime the user browses a page, data is being pulled from sql. Am I doing anything wrong? I thought that everytime I connect, I should close the connection. I posted this q to javaranch, and one person replied that i should store in app level, and another one that JDBC2 Datasource would do that for me. I'm embarrassed to admit but am clueless of what they mean. Can someone please explain? Thanks! ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
