« Back to CVP - All Versions

How to detect if a database connection is active to a cvp app

Combination View Flat View Tree View
Threads [ Previous | Next ]
Hi,
All of my apps access a databse to populate variables needed within each app.  I created my jdbc connections in the Tomcat server (some using java drivers other using ODBC).
How or what can I use to check if a database connection is active before using it and choosing another?
What error meesage canI look for in CVP when an app can't connect to a database?
 
 
thanks

Hi,
All of my apps access a databse to populate variables needed within each app.  I created my jdbc connections in the Tomcat server (some using java drivers other using ODBC).
How or what can I use to check if a database connection is active before using it and choosing another?
What error meesage canI look for in CVP when an app can't connect to a database?
 
 
thanks


Well you have a choice of using single or pooled connections.  It sounds like you are just hitting run time variables so the easiest way would be to use single, just open the connection with the Jco commands and close it when you are done.  If you have a real high call volume like hundreds of calls per hour, you can use pooled connections which will open a pool of threads to the database and you grab one and do you stuff and release it.  That's what we use here to access SAP with the SAPJCO packages.  Just google "Using Pooled jdbc connections" for examples...I've got some JCO examples if you get stuck.
 
Bill Westby
Medtronic - Diabetes
UCCE, CVP, etc.

Bill,
 
Some questions about JCo. Are you using JCo 3.0?
 
 the easiest way would be to use single, just open the connection with the Jco commands and close it when you are done.  

 
I assume you are doing this through JCoDestinationManager.getDestination(). This seems slow to do it each time, so creating it once and storing it for later access looks more attractive.
 
If you have a real high call volume like hundreds of calls per hour, you can use pooled connections which will open a pool of threads to the database and you grab one and do you stuff and release it.  That's what we use here to access SAP with the SAPJCO packages.

 
That looks more interesting. Are you creating the JCoDestination in your first custom element - perhaps a StartClass - and storing it on the Session structure? With JCo 3.0 it will make them pooled if you set JCO_POOL_CAPACITY. 
 
I've got some JCO examples if you get stuck.

 
I would not say I am stuck yet, but I would like to exchange some information. Those examples sound attractive.
 
(a) Which version of JCo?
(b) Did you use the file-based (default) DestinationDataProvider or did you implement your own? If you used the default, where did the file go? 
(c) Did you have any issues with the location of the JCo JAR or DLL
(d) Did you have to make any stateful calls?
 
Regards,
Geoff
 
 

Thanks, I'll look into the JConnector as I've never used it before.
But I think what I want to do is different:

Our inbound app query a database table to look for the incoming telephone number and if there's a match it assigns extra values to the FromExtVXML() so that ICM can route it properly.
The CVP app connects to the database using a JNDI (which is hosted in the Tomcat server running in our CVP servers).

What I want is to check whether the database is accessible before trying to query it.
So I'm thinking of crating a CVP action element using java so that it checks (run a connection active process) using the tomcat jndi and if not then skip the query.

what do you think.