简体   繁体   English

使用 UserDefined JDBC 提供程序通过 wsadmin 创建数据源槽时,不会出现数据源的自定义属性 (J2EEResourcePropertySet)

[英]Custom properties (J2EEResourcePropertySet) of datasource do not appear when using UserDefined JDBC provider to create datasource trough wsadmin

So basically i have created user-defined JDBC provider through wsadmin:所以基本上我已经通过 wsadmin 创建了用户定义的 JDBC 提供程序:

AdminTask.createJDBCProvider('[-scope Cluster=MyCluster -databaseType User-defined -providerType "User-defined JDBC Provider" -implementationType User-defined -name "MSSQL JDBC Provider" -description "Microsoft SQL Server JDBC Driver" -classpath [${SQL_PATH}/sql.jar ] -nativePath "" -implementationClassName com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource ]')

After that i want to create datasource.之后我想创建数据源。 So basically when i use UI to create datasource - it fills 3 pages with custom properties (J2EEResourcePropertySet) of that datasource (55 J2EEResourceProperties).所以基本上当我使用 UI 创建数据源时 - 它用该数据源(55 个 J2EEResourceProperties)的自定义属性(J2EEResourcePropertySet)填充 3 个页面。

If i use wsadmin it does not fills those 3 pages for some reason only i see ~8 custom properties (J2EEResourceProperties).如果我使用 wsadmin,由于某种原因它不会填满这 3 个页面,只有我看到 ~8 个自定义属性(J2EEResourceProperties)。

If i look at log command assistance commands when creating trough UI and script - those are the same.如果我在创建槽 UI 和脚本时查看日志命令辅助命令 - 它们是相同的。

Can someone explain me what is wrong?有人可以解释我有什么问题吗? I need to have 55 custom properties when running a script also.运行脚本时我还需要 55 个自定义属性。 Thanks.谢谢。

Here is my datasource script:这是我的数据源脚本:

jdbcprovider = AdminConfig.getid('/JDBCProvider:MSSQL JDBC Provider/')
AdminTask.createDatasource(jdbcprovider, '[-name DataSource1 -jndiName DataSource1 -dataStoreHelperClassName com.ibm.websphere.rsadapter.MicrosoftSQLServerDataStoreHelper -containerManagedPersistence true -componentManagedAuthenticationAlias SAmgr/DataSource1 ]')

Adding images to understand:添加图像以了解:

55 custom properties appeared: Creating datasource trough UI Custom Properties:出现 55 个自定义属性:通过 UI 自定义属性创建数据源:

8 custom properties appeared: Creating datasource trough wsadmin script custom properties出现 8 个自定义属性:通过 wsadmin 脚本自定义属性创建数据源

EDIT: When you create a DataSource using a JDBC provider created using one of the pre-defined types, like MS SQL Server JDBC Driver, WAS uses the contents of a template to populate (among other things) the properties of the datasource. EDIT: When you create a DataSource using a JDBC provider created using one of the pre-defined types, like MS SQL Server JDBC Driver, WAS uses the contents of a template to populate (among other things) the properties of the datasource. There is a template for both the 8 WebSphere properties (like webSphereDefaultQueryTimeout), and the other vendor-specific properties (like applicationName for MSSQL Server). 8 个 WebSphere 属性(如 webSphereDefaultQueryTimeout)和其他供应商特定的属性(如 MSSQL Server 的 applicationName)都有一个模板。 The 8 WebSphere specific properties are common to all datasources and are maintained by WAS and are not properties of the JDBC driver. 8 个 WebSphere 特定属性对所有数据源都是通用的,由 WAS 维护,不是 JDBC 驱动程序的属性。 The properties in the vendor-specific template are a subset of all the vendor properties based on our assessment of whether it is “safe” to set/unset the property in a managed (JEE app server) environment.供应商特定模板中的属性是所有供应商属性的子集,基于我们对在托管(JEE 应用程序服务器)环境中设置/取消设置属性是否“安全”的评估。

Whether you create the datasource from the admin console or wsadmin, when the JDBC provider is based on one of the predefined vendors, the property set is the same since it's coming from standard templates.无论您是从管理控制台还是 wsadmin 创建数据源,当 JDBC 提供程序基于预定义供应商之一时,属性集都是相同的,因为它来自标准模板。 The behavior difference you're seeing is because you're creating a user-defined JDBC provider and not using one of the predefined ones.您看到的行为差异是因为您正在创建用户定义的 JDBC 提供程序,而不是使用预定义的提供程序之一。 Typically, user-defined JDBC providers are only needed when the JDBC driver you want to use is not one of the pre-defined ones.通常,仅当您要使用的 JDBC 驱动程序不是预定义的驱动程序之一时,才需要用户定义的 JDBC 提供程序。 When you create a datasource from a user-defined JDBC provider using the admin console, behind the scenes it is calling a method to introspect the driver and discover any public javabeans that the JDBC driver exposes as properties.当您使用管理控制台从用户定义的 JDBC 提供程序创建数据源时,它在后台调用一种方法来内省驱动程序并发现 JDBC 驱动程序作为属性公开的任何公共 javabean。 The admin console then adds these properties to the datasource in addition to the 8 WebSphere properties from the template discussed above.除了上述模板中的 8 个 WebSphere 属性之外,管理控制台随后将这些属性添加到数据源。 The admin console performs the introspection because there is no template available for the vendor properties.管理控制台执行自省,因为没有可用于供应商属性的模板。 However, when you create a datasource from a user-defined JDBC provider using wsadmin, it doesn't perform that introspection, thus the only properties you see on the datasource will be the 8 WebSphere properties from the template discussed above.但是,当您使用 wsadmin 从用户定义的 JDBC 提供程序创建数据源时,它不会执行该自省,因此您在数据源上看到的唯一属性将是上述模板中的 8 个 WebSphere 属性。 There are instances where the console executes some steps programmatically vs. via scripting and differences in behavior like this can arise.在某些情况下,控制台以编程方式与通过脚本执行某些步骤,并且可能会出现此类行为差异。 So, that's the answer to "why the difference”. After investigation, there no option to have the wsadmin command introspect the driver adding the additional properties. I see two ways you can address the issue and get the properties added.所以,这就是“为什么不同”的答案。经过调查,没有选项可以让 wsadmin 命令内省添加附加属性的驱动程序。我看到有两种方法可以解决问题并添加属性。

If the set of driver properties you need is part of those included in the standard template for that driver, change from creating a user-defined JDBC provider to using one created with that driver vendor.如果您需要的驱动程序属性集是该驱动程序标准模板中包含的属性的一部分,请从创建用户定义的 JDBC 提供程序更改为使用由该驱动程序供应商创建的提供程序。 Using wsadmin, you'll get all the same properties you would get if you created it from the admin console.使用 wsadmin,您将获得与从管理控制台创建时相同的所有属性。 If some, but not all of the property(s) you need are in the template, you can add those properties via scripting using the AdminConfig.create(…) method as you suggested.如果您需要的一些(但不是全部)属性在模板中,您可以按照您的建议使用 AdminConfig.create(...) 方法通过脚本添加这些属性。 After your config is saved, all objects created via scripting will be available to see in the admin console, including the custom properties.保存配置后,通过脚本创建的所有对象都可以在管理控制台中查看,包括自定义属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM