日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

postgresql_PostgreSQL开放自由

發(fā)布時間:2023/12/3 数据库 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 postgresql_PostgreSQL开放自由 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

postgresql

Open Liberty是源自WebSphere Liberty的有趣的新型OSS Java EE應用服務器。 您可以將Open Liberty配置為使用PostgreSQL作為其默認數(shù)據(jù)源,如下所示:

將<datasource> , <jdbcDriver>和<library>指令添加到server.xml配置中:

<?xml version="1.0" encoding="UTF-8"?> <server description="OpenLiberty Java EE 8 Server"><featureManager><feature>javaee-7.0</feature></featureManager><httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="9080" httpsPort="9443"/><keyStore id="defaultKeyStore" password="Liberty"/><!-- Postgres coffee-shop-db definition --><dataSource id="DefaultDataSource"jndiName="jdbc/sample"jdbcDriverRef="postgresql-driver"type="javax.sql.ConnectionPoolDataSource"transactional="true"><properties serverName="coffee-shop-db"portNumber="5432"databaseName="postgres"user="postgres"password="postgres"/></dataSource><jdbcDriver id="postgresql-driver"javax.sql.XADataSource="org.postgresql.xa.PGXADataSource"javax.sql.ConnectionPoolDataSource="org.postgresql.ds.PGConnectionPoolDataSource"libraryRef="postgresql-library"/><library id="postgresql-library"><fileset id="PostgreSQLFileset" dir="/opt/ol/wlp/lib"includes="postgresql-9.4-1201.jar"/></library></server>

通過主機coffee-shop-db可用coffee-shop-db將通過默認的Postgres端口5432使用postgres作為數(shù)據(jù)庫名稱,用戶名和密碼)訪問。

驅動程序庫,這里是postgresql-9.4-1201.jar ,需要駐留在服務器安裝的lib/目錄中。

可以從Java EE應用程序透明地使用默認數(shù)據(jù)源。 在persistence.xml文件中只需指定一個持久性單元,類似于以下代碼片段:

<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistencehttp://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"><persistence-unit name="prod" transaction-type="JTA"/></persistence>

如果應用程序包含多個數(shù)據(jù)庫,則要求持久性單元指定其相應數(shù)據(jù)源的JNDI名稱。

經(jīng)過官方Docker鏡像open-liberty:javaee7 。

翻譯自: https://www.javacodegeeks.com/2018/01/postgresql-open-liberty.html

postgresql

總結

以上是生活随笔為你收集整理的postgresql_PostgreSQL开放自由的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內容還不錯,歡迎將生活随笔推薦給好友。