Showing 6 results.
Items per Page 50
of 1

CVP Forum

« Back to General Discussion - All Versions

Instructions to connect to MySQL from a CVP 4.x or 7.x Database element

Combination View Flat View Tree View
Threads [ Previous | Next ]
This has also been posted to the wiki.
I have found that there is a gap in the CVP documentation in describing how to connect to a backend MySQL database with the Studio Database element. Links such as the following are outdated:

Outdated because the Tomcat admin utility has been removed from the release, it is now necessary to manually edit tomcat config files.


Here is how I got it to work.

On MySQL
1) Create a database (YOUR-DBNAME) and user name (YOUR-USER) of your with a password for the user.
2) Grant permission to the user.
mysql> grant select,insert,update,execute,delete,create,drop on YOUR-DBNAME.* to YOUR-USER identified by 'YOUR-USERS-PASSWORD';

On VXML server
1) Download the com.mysql.jdbc.Driver class which is contained in jar file mysql-connector-java-3.1-x.bin.jar.
You can download it from the dev.mysql.com site http://dev.mysql.com/downloads/connector/j/3.1.html.
We recommend using version 3.1.11 (or higher), as version 3.1.10 has compatability problems.
Place the jar file in C:\Cisco\CVP\VXMLServer\Tomcat\common\lib.

2) Edit C:\Cisco\CVP\VXMLServer\Tomcat\conf\context.xml
Add the following ResourceLink line under Context:
<Context>
<ResourceLink global="jdbc/YOUR-LABEL-HERE" name="jdbc/YOUR-LABEL-HERE" type="javax.sql.DataSource"/>

3) Edit C:\Cisco\CVP\VXMLServer\Tomcat\conf\server.xml
Add the following Resource line under GlobalNamingResources:
<GlobalNamingResources>
<Resource name="jdbc/YOUR-LABEL-HERE"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://IP-of-MySQL:3306/YOUR-DBNAME?autoReconnect=true"
username="YOUR-USER"
password="YOUR-USERS-PASSWORD"
maxActive="20"
maxIdle="10"
poolPreparedStatements="true" />

4) Restart Tomcat (CVP VXML Server)


In your VXML Studio application
1) In the Database element, use YOUR-LABEL-HERE as the JNDI Name.


If things don't work, here are some debugging tips:
1) On VXML server, look in C:\Cisco\CVP\VXMLServer\applications\YOUR-APPLICATION\logs\ErrorLog

The following error indicated to me that I had totally missed the mark on configuring the tomcat config files.
192.168.150.173.1216410441104.0. 07/18/2008 15:47:21.323,A built-in element encountered an exception
of type com.audium.server.AudiumException. The error was: Cannot create JDBC driver of class '' for connect URL 'null'
The root cause was: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL
'null'

The following error indicated to me that I had not yet created a user in MySQL and given them access.
    • BEGIN NESTED EXCEPTION **
java.sql.SQLException
MESSAGE: null message from server: "Host '192.168.150.173' is not allowed to connect to this MySQL server"

2) If your MySQL server is on a separate machine from theVXML Server, run a sniffer trace on either machine and
see if any MySQL traffic is passing back and forth. The contents of the messages should give a clue as to what
is happening.

Edited by: Janet Byron on Jul 19, 2008 8:25 PM

Edited by: Janet Byron on Jul 20, 2008 7:44 AM

Can you also post the configuration required for MS SqlServer? This is very often requested in class.

Thanks, Janine

I'll post up an answer to this in a new thread based on some info I just got.

I'll post up an answer to this in a new thread based on some info I just got.


 
Did you ever post the instructions for setting up JNDI for use with SQL Server?

I've answered my own question!
 
I downloaded the SQL JDBC driver and put sqljdbc.jar in
C:\Cisco\CVP\VXMLServer\Tomcat\common\lib
 
 
Note: For this test my JNDI datsource is called AWDB and points to the aw_db
database on my Admin Worksation
 
I then changed to the directory
 
C:\Cisco\CVP\VXMLServer\Tomcat\conf
 
 
In context.xml I put
 
 <ResourceLink global="jdbc/AWDB" name="jdbc/AWDB" type="javax.sql.DataSource"/>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
   
    <Manager pathname="" />
 
In server.xml I put
 
<Resource name="jdbc/AWDB"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://AW_Server:1433;databaseName=ucce1_awdb" 
username="sa"
password="password"
maxActive="20"
maxIdle="10"
poolPreparedStatements="true" />
 
This seems to work fine

poolPreparedStatements="true" known to cause Java memory leak issues on systems with high volume of SQL requrests, because pooled statements remain orphaned and can't be removed by Java garbage collector. If there are no strict requirement of having this setting in SQL connection you should avoid using it.