This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 831130 - Can't create right datasource for scalable application
Can't create right datasource for scalable application
Product: OpenShift Origin
Classification: Red Hat
Component: Containers (Show other bugs)
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Bill DeCoste
libra bugs
: Triaged
Depends On:
  Show dependency treegraph
Reported: 2012-06-12 05:32 EDT by Rony Gong
Modified: 2015-05-14 18:55 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-06-25 14:27:13 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Rony Gong 2012-06-12 05:32:36 EDT
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">
                <datasource jndi-name="java:jboss/datasources/PostgreSQLDS" enabled="${postgresql.enabled}" use-java-context="true" pool-name="PostgreSQLDS" use-ccm="true">

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):

How reproducible:

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( {
    out.print(", ");

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:
Comment 1 Rony Gong 2012-06-12 21:25:09 EDT
Version-Release number of selected component (if applicable):
Comment 2 Rony Gong 2012-06-13 03:46:51 EDT
Retest on devenv1838, didn't found any change for that part.
Comment 3 Bill DeCoste 2012-06-13 16:08:55 EDT
OPENSHIFT_GEAR_NAME was replaced with OPENSHIFT_APP_NAME in the datasource configurations - confirmed in ami 58d77431. Is there another issue?
Comment 4 Rony Gong 2012-06-14 01:28:23 EDT
verified on devenv_1843

all ${env.OPENSHIFT_GEAR_NAME} changed to ${env.OPENSHIFT_APP_NAME}
and could connect datasource success.

Note You need to log in before you can comment on or make changes to this bug.