Retrieve iASP RDB name to specify it in jdbc url

怎甘沉沦 提交于 2020-08-10 01:13:32

问题


I have a java application which runs on IBM i. It creates connection to AS400 database using jdbc. It does not specify the database name in JDBC connection URL, means it creates connection to default system database associated with *SYSBAS.

Now I want my application to run on iASP. When running on iASP it fails to connect to database.

IBM i documentation says that we must specify RDB name in "database name" property of jdbc connection URL to connect.

problem here is that,

IBM i documentation says by default RDB name of iASP group is same as primary iASP device name in iASP group. But it can be assigned different name.

I am able to retrieve iASP group name and iASP device name programmatically using JTOPEN(by calling API QUSROBJD). Which means my application will work in default scenario. But when RDB name is assigned different name then my application may fail. I want to retrieve RDB name associated with iASP.

How can I retrieve correct RDB name for an iASP?

I tried using API QUSRJOBI, but it is returning database name as blank.


回答1:


There are two types of Auxiliary Storage Pool (ASP) on IBM i: System ASPs and independent ASPs (iASP). On DB2 for i, all libraries in the system ASP are treated as a single database and you can qualify tables with a schema name to access a tables in a specific library. According to the documentation that I found, each new iASP creates a new database, and these can be queried in QSYS2.SYSCATALOGS. So you will need a connection to the system database and, from that, you can find the database name and connect to each iASP that you need a connection to. Unfortunately I cannot test this as I do not have an iASP available to me.



来源:https://stackoverflow.com/questions/55530238/retrieve-iasp-rdb-name-to-specify-it-in-jdbc-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!