Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I can see a way to do this, but it isn't pretty.</p> <p>Your instance configuration file can include <a href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-container_commands" rel="nofollow">container commands</a>. These run after the container and application are installed, but before the application is started. At this point, it is possible to edit the Tomcat <code>context.xml</code> file to add a datasource. The text you need to add is <a href="http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#JDBC_Data_Sources" rel="nofollow">the usual datasource configuration</a>. Your problem is that you have to do it from a script. The easiest thing might be to write the configuration and deliver it with your application, then use a container command to apply the mighty <a href="http://www.grymoire.com/Unix/Sed.html" rel="nofollow">sed</a> to splice it into the <code>context.xml</code>.</p> <p>You have another problem in that the actual configuration you need to write must include things like the hostname, username, and password for RDS, which you won't have during development. AWS does expose these to Java through <a href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Java.rds.html#create_deploy_Java.rds.newDB" rel="nofollow">system properties</a>, so the information must be on the machine somewhere. If you could find it, you could mix it into the configuration when you splice it into the <code>context.xml</code>.</p> <p>Whilst this may be possible, as i said, it isn't pretty. It feels like a hack. There must be a better way of doing this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload