Description of problem: can't create right datasource for scalable applcition after I look into the datasouce code in .openshift/confi/standalone.xml, I find: <datasource jndi-name="java:jboss/datasources/MysqlDS" enabled="${mysql.enabled}" use-java-context="true" pool-name="MysqlDS"> <connection-url>jdbc:mysql://${env.OPENSHIFT_DB_HOST}:${env.OPENSHIFT_DB_PORT}/${env.OPENSHIFT_GEAR_NAME}</connection-url> <driver>mysql</driver> <security> <user-name>${env.OPENSHIFT_DB_USERNAME}</user-name> <password>${env.OPENSHIFT_DB_PASSWORD}</password> </security> </datasource> <datasource jndi-name="java:jboss/datasources/PostgreSQLDS" enabled="${postgresql.enabled}" use-java-context="true" pool-name="PostgreSQLDS" use-ccm="true"> <connection-url>jdbc:postgresql://${env.OPENSHIFT_DB_HOST}:${env.OPENSHIFT_DB_PORT}/${env.OPENSHIFT_GEAR_NAME}</connection-url> <driver>postgresql</driver> <security> <user-name>${env.OPENSHIFT_DB_USERNAME}</user-name> <password>${env.OPENSHIFT_DB_PASSWORD}</password> </security> </datasource> all that ${env.OPENSHIFT_GEAR_NAME} should be replaced by ${env.OPENSHIFT_APP_NAME} or we can't get right datasource connection, except for nonscalable app. Version-Release number of selected component (if applicable): devenv_1807 How reproducible: always Steps to Reproduce: 1.create a scalable jboss app,embed my sql 2.then the mysql.jsp file to do a database connection: <%@ page contentType="text/html" language="java" import="java.sql.*" %> <%@ page import="javax.naming.*" %> <%@ page import="javax.sql.*" %> <% InitialContext ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup("java:jboss/datasources/MysqlDS"); Connection connection=ds.getConnection(); Statement statement = connection.createStatement(); statement.executeUpdate("DROP TABLE IF EXISTS ucctalk"); statement.executeUpdate("CREATE TABLE ucctalk (speaker CHAR(30), title CHAR(60))"); statement.executeUpdate("INSERT INTO ucctalk (speaker,title) VALUES ('Jeremy Zawodny', 'Optimizing MySQL'), ('Sanja Byelkin', 'Sub-Queries in MySQL'), ('Tim Bunce', 'Advanced Perl DBI')"); ResultSet rs = statement.executeQuery("SELECT * FROM ucctalk"); ResultSetMetaData rmeta = rs.getMetaData(); int numColumns=rmeta.getColumnCount(); while(rs.next()) { out.print(rs.getString(1)); out.print(", "); out.print(rs.getString(2)); out.print("<br>"); } rs.close(); statement.close(); connection.close(); %> 3.git push, the access the mysql.jsp Actual results: show exception couldn't connect to database "9d3c69bffb" Expected results: create datasource success and could connect it. Additional info:
sorry, Version-Release number of selected component (if applicable): devenv_1827
Retest on devenv1838, didn't found any change for that part.
OPENSHIFT_GEAR_NAME was replaced with OPENSHIFT_APP_NAME in the datasource configurations - confirmed in ami 58d77431. Is there another issue?
verified on devenv_1843 all ${env.OPENSHIFT_GEAR_NAME} changed to ${env.OPENSHIFT_APP_NAME} and could connect datasource success.