0 Replies Latest reply on Mar 25, 2010 6:51 PM by Yulién Paz Morales

    How to Change Database connection at Runtime?

    Yulién Paz Morales Newbie

      Hi there:

      First of all: I am so sorry about my English. I am from Latin America.

      I am a rookie in Seam.

      At this moment, I am making a web site using Seam 1.2. My site uses a database (in MySQL Server) named ALregclients. That DB has only one table: trazasfallos. I am developing my site in Eclipse. I can change the connection to the database from the context.xml file, and it works fine... The problem comes when I deploy the site. In this case, the site will be hosted in a PC, and the MySQL server will be running in another PC. So, to make the site can run, I have to change the connection string in the context.xml and compile the project. It generates a compiled class named trazasfallos.class, and that is the file I have to overwrite in the folder I put the deployment of the site. Changing only the context.xml and overwriting it in the deployment folder, doesn't work!! Always I have to recompiling the entire site.
      The point is: how to change the connection string without recompiling the whole project (site)? How to connect to any MySQL server with just a change of a .xml file (or something like that)?

      Is it possible to change the connection at runtime? If it is possible, how to do it???