Help configuring MySQL JDBC2 connection

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

ben123
Ebase User
Posts: 4
Joined: Fri Sep 30, 2011 5:28 pm

Help configuring MySQL JDBC2 connection

#1

Postby ben123 » Fri Dec 02, 2011 9:00 am

I am trying to configure a JDBC2 connection to a MySQL database. I can get the connection to work using JDBC1 but not under JDBC2.

I see from the ebase documentation that I need to:
1. Add the database to the web application context. Add a definition like the one below to the web.xml file in the Web-Inf directory for the Ebase web application.

<resource>
<description>Your database</description>
<res>jdbc/YOURDBNAME</res>
<res>javax.sql.XADataSource</res>
<res>Container</res>
</resource>

Ensure that the prefix jdbc/ is used in the resource reference name.

2. Add the datasource connection definition to the application server. Details vary according to the application server.

Note: if creating a connection to a MySQL database, include the parameter 'autoReconnect=true' in the JDBC URL. Failure to do this can lead to lost connections reported as SocketException errors.

3. Map the web application resource reference to the datasource definition. Details vary according to the application server.

Note that some application servers do not give you access to the xml files to allow you to complete the third step. You may need to expand and modify the supplied UFS.war file to add the resource definition in step 1 above, and then re-deploy this into your application server.
I have added the definition to the web.xml file, but am not sure whether I also need to "add the database to the web application context". I also can't figure out what I need to do to complete steps 2 and 3 given that "details vary by application server".

I can't find any further documentation of this.

I am using a standard ebase 4.2 setup plus MySQL 5.0.7 running on a standard WAMP server.

Help please?!
0 x

ben123
Ebase User
Posts: 4
Joined: Fri Sep 30, 2011 5:28 pm

#2

Postby ben123 » Sun Dec 04, 2011 10:45 pm

I have figured out how to do this via the following steps:

1 - add the MySQL database as a new <resource> node in ufs.xml using the template provided within the file itself. In my install this file was located in: C:\Program Files (x86)\ebaseXi\UfsServer\tomcat\conf\Catalina\localhost\

2 - add a reference to that resource in web.xml by copying the syntax of one of the existing <resource> nodes. In my install this file was located in: C:\Program Files (x86)\ebaseXi\UfsServer\tomcat\webapps\ufs\WEB-INF\

3 - create the database in Ebase (File --> New --> Database)

Step 1 is apparently undocumented (at least I couldn't find it). Once you stumble across the ufs.xml file however it contains some very useful templates for connecting to various different database types.
0 x


Who is online

Users browsing this forum: Google [Bot] and 91 guests