Skip to content

Commit a7aebf2

Browse files
authored
Fixes #4547 - Document how to register datasources (#4616)
1 parent cf23b86 commit a7aebf2

File tree

1 file changed

+21
-1
lines changed
  • extension/datasource/src/site/markdown

1 file changed

+21
-1
lines changed

extension/datasource/src/site/markdown/index.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ You override the default DataSource using the snippet below:
2828
</data-source>
2929
```
3030

31-
For runtimes that do not include the web.xml extension you will need to add it if you want
31+
For runtimes that do not include the Piranha web.xml extension you will need to add it if you want
3232
to override the default DataSource as described above. You can do this by adding the
3333
following dependency to your pom.xml:
3434

@@ -39,3 +39,23 @@ following dependency to your pom.xml:
3939
<version>${piranha.version}</version>
4040
</dependency>
4141
```
42+
43+
## Register Any Other DataSource
44+
45+
You can register any other DataSource by using a similar approach. Below is an example of configuring a PostgreSQL DataSource:
46+
47+
```xml
48+
<data-source>
49+
<name>java:comp/PostgreSQLDataSource</name>
50+
<class-name>org.postgresql.ds.PGSimpleDataSource</class-name>
51+
<url>jdbc:postgresql://localhost:5432/mydb</url>
52+
<user>myuser</user>
53+
<password>mypassword</password>
54+
<property>
55+
<name>ssl</name>
56+
<value>true</value>
57+
</property>
58+
</data-source>
59+
```
60+
61+
Make sure to replace the values with your actual PostgreSQL database details.

0 commit comments

Comments
 (0)