Skip to content

Commit 63839b7

Browse files
authored
Merge pull request #1029 from phongphan/glassfish-jndi
Detect changed for JNDI datasource which using jndi: prefix and its documentation
2 parents 6061c12 + ebb87c1 commit 63839b7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

documentation/manual/configuration.textile

+5-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,11 @@ To reuse an existing Datasource from your application server:
266266

267267
bc. db=java:/comp/env/jdbc/myDatasource@
268268

269-
If you specify a @Datasource@, the database plugin detects the pattern @db=java:@ and will de-activate the default JDBC system.
269+
And for application server where Datasource doesn't have @java:@ prefix (Glassfish and its derivative), you could use @jndi:@ instead. The @jndi:@ prefix will be omitted:
270+
271+
bc. db=jndi:jdbc/myDataSource
272+
273+
If you specify a @Datasource@, the database plugin detects the pattern @db=java:@ and @db=jndi:@ and will de-activate the default JDBC system.
270274

271275
Default: none.
272276

framework/src/play/db/DBConfig.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,8 @@ private boolean changed(String propsPrefix) {
438438
p.put(propsPrefix + ".pass", "");
439439
}
440440

441-
if (p.getProperty(propsPrefix, "").startsWith("java:") && p.getProperty(propsPrefix + ".url") == null) {
441+
String datasourceName = p.getProperty(propsPrefix, "");
442+
if ((datasourceName.startsWith("java:") || datasourceName.startsWith("jndi:")) && p.getProperty(propsPrefix + ".url") == null) {
442443
if (datasource == null) {
443444
return true;
444445
}

0 commit comments

Comments
 (0)