table of contentsteiid.github.io/teiid-documents/9.3.x/teiid-documents.pdf · jdbc support...

792
1.1 1.2 1.3 1.3.1 1.3.2 1.3.2.1 1.3.2.1.1 1.3.2.1.2 1.3.2.1.3 1.3.2.1.4 1.3.2.1.5 1.3.2.1.6 1.3.2.1.7 1.3.2.1.8 1.3.2.1.9 1.3.2.1.10 1.3.2.1.11 1.3.2.1.12 1.3.2.1.13 1.3.2.1.14 1.3.2.1.15 1.3.2.1.15.1 1.3.2.1.15.2 1.3.2.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.6.1 1.3.6.2 1.3.6.3 1.3.6.4 1.3.6.5 1.3.6.6 1.3.7 1.3.8 1.3.8.1 Table of Contents Introduction Legal Notice Administrator’s Guide Installation Guide Deploying VDBs Deploying VDB Dependencies Accumulo Data Sources Amazon SimpleDB Data Sources Cassandra Data Sources Couchbase Data Sources File Data Sources Ftp/Ftps Data Sources Google Spreadsheet Data Sources Infinispan HotRod Data Sources JDBC Data Sources LDAP Data Sources MongoDB Data Sources Phoenix Data Sources Salesforce Data Sources Solr Data Sources Web Service Data Sources Kerberos with REST based Services OAuth Authentication With REST Based Services VDB Versioning Logging Clustering in Teiid Monitoring Performance Tuning Memory Management Threading Cache Tuning Socket Transports LOBs Other Considerations Teiid Console AdminShell Getting Started 1

Upload: others

Post on 21-Apr-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

  • 1.1

    1.2

    1.3

    1.3.1

    1.3.2

    1.3.2.1

    1.3.2.1.1

    1.3.2.1.2

    1.3.2.1.3

    1.3.2.1.4

    1.3.2.1.5

    1.3.2.1.6

    1.3.2.1.7

    1.3.2.1.8

    1.3.2.1.9

    1.3.2.1.10

    1.3.2.1.11

    1.3.2.1.12

    1.3.2.1.13

    1.3.2.1.14

    1.3.2.1.15

    1.3.2.1.15.1

    1.3.2.1.15.2

    1.3.2.2

    1.3.3

    1.3.4

    1.3.5

    1.3.6

    1.3.6.1

    1.3.6.2

    1.3.6.3

    1.3.6.4

    1.3.6.5

    1.3.6.6

    1.3.7

    1.3.8

    1.3.8.1

    TableofContentsIntroduction

    LegalNotice

    Administrator’sGuide

    InstallationGuide

    DeployingVDBs

    DeployingVDBDependencies

    AccumuloDataSources

    AmazonSimpleDBDataSources

    CassandraDataSources

    CouchbaseDataSources

    FileDataSources

    Ftp/FtpsDataSources

    GoogleSpreadsheetDataSources

    InfinispanHotRodDataSources

    JDBCDataSources

    LDAPDataSources

    MongoDBDataSources

    PhoenixDataSources

    SalesforceDataSources

    SolrDataSources

    WebServiceDataSources

    KerberoswithRESTbasedServices

    OAuthAuthenticationWithRESTBasedServices

    VDBVersioning

    Logging

    ClusteringinTeiid

    Monitoring

    PerformanceTuning

    MemoryManagement

    Threading

    CacheTuning

    SocketTransports

    LOBs

    OtherConsiderations

    TeiidConsole

    AdminShell

    GettingStarted

    1

  • 1.3.8.2

    1.3.8.3

    1.3.8.4

    1.3.8.5

    1.3.8.6

    1.3.9

    1.3.10

    1.3.11

    1.3.12

    1.3.13

    1.4

    1.4.1

    1.4.2

    1.4.2.1

    1.4.2.2

    1.4.3

    1.4.4

    1.4.5

    1.4.6

    1.5

    1.5.1

    1.5.1.1

    1.5.1.1.1

    1.5.1.1.2

    1.5.1.1.3

    1.5.1.1.4

    1.5.1.1.5

    1.5.1.1.6

    1.5.1.1.7

    1.5.1.2

    1.5.1.3

    1.5.1.4

    1.5.1.4.1

    1.5.1.4.2

    1.5.1.4.3

    1.5.1.4.4

    1.5.1.4.5

    1.5.1.5

    1.5.1.5.1

    1.5.1.5.2

    Executingascriptfile

    LogFileandRecordedScriptfile

    DefaultConnectionProperties

    HandlingMultipleConnections

    InteractiveShellNuances

    OtherScriptingEnvironments

    SystemProperties

    TeiidManagementCLI

    DiagnosingIssues

    MigrationGuideFromTeiid8.x

    CachingGuide

    ResultsCaching

    MaterializedViews

    ExternalMaterialization

    InternalMaterialization

    CodeTableCaching

    TranslatorResultsCaching

    HintsandOptions

    ProgrammaticControl

    ClientDeveloper’sGuide

    JDBCSupport

    ConnectingtoaTeiidServer

    DriverConnection

    DataSourceConnection

    StandaloneApplication

    WildFlyDataSource

    UsingMultipleHosts

    SSLClientConnections

    AdditionalSocketClientSettings

    PreparedStatements

    ResultSetLimitations

    JDBCExtensions

    StatementExtensions

    PartialResultsMode

    Non-blockingStatementExecution

    ResultSetExtensions

    ConnectionExtensions

    UnsupportedJDBCMethods

    UnsupportedClassesandMethodsin"java.sql"

    UnsupportedClassesandMethodsin"javax.sql"

    2

  • 1.5.2

    1.5.2.1

    1.5.2.2

    1.5.2.3

    1.5.2.4

    1.5.3

    1.5.3.1

    1.5.4

    1.5.5

    1.5.6

    1.5.7

    1.5.8

    1.5.9

    1.5.10

    1.5.10.1

    1.5.11

    1.5.12

    1.5.13

    1.5.13.1

    1.5.13.2

    1.5.13.3

    1.5.13.4

    1.6

    1.6.1

    1.6.1.1

    1.6.1.1.1

    1.6.1.1.2

    1.6.1.2

    1.6.1.2.1

    1.6.1.3

    1.6.1.3.1

    1.6.1.4

    1.6.2

    1.6.2.1

    1.6.2.1.1

    1.6.2.1.2

    1.6.2.2

    1.6.2.2.1

    1.6.2.2.2

    1.6.2.2.3

    ODBCSupport

    InstallingtheODBCDriverClient

    ConfiguringtheDataSourceName(DSN)

    DSNLessConnection

    ODBCConnectionProperties

    ODataSupport

    ODataVersion4.0Support

    UsingTeiidwithHibernate

    UsingTeiidwithEclipseLink

    GeoServerIntegration

    QGISIntegration

    SQLAlchemyIntegration

    Reauthentication

    ExecutionProperties

    XMLextensions

    SETStatement

    SHOWStatement

    Transactions

    LocalTransactions

    RequestLevelTransactions

    UsingGlobalTransactions

    Restrictions

    Developer’sGuide

    DevelopingJEEConnectors

    ConnectorEnvironmentSetup

    BuildEnvironment

    ArchetypeTemplateConnectorProject

    ImplementingtheTeiidFramework

    ra.xmlfileTemplate

    PackagingtheAdapter

    AddingDependentLibraries

    DeployingtheAdapter

    TranslatorDevelopment

    EnvironmentSetup

    Settingupthebuildenvironment

    ArchetypeTemplateTranslatorProject

    ImplementingtheFramework

    CachingAPI

    CommandLanguage

    ConnectionstoSource

    3

  • 1.6.2.2.4

    1.6.2.2.5

    1.6.2.2.6

    1.6.2.2.7

    1.6.2.2.8

    1.6.2.2.9

    1.6.2.3

    1.6.2.4

    1.6.2.5

    1.6.2.5.1

    1.6.2.6

    1.6.3

    1.6.3.1

    1.6.3.2

    1.6.3.2.1

    1.6.4

    1.6.5

    1.6.6

    1.6.7

    1.6.8

    1.6.8.1

    1.7

    1.7.1

    1.7.2

    1.8

    1.8.1

    1.8.2

    1.8.2.1

    1.8.2.2

    1.8.2.3

    1.8.2.4

    1.8.2.5

    1.8.2.6

    1.8.2.7

    1.8.2.8

    1.8.2.9

    1.8.3

    1.8.3.1

    1.8.3.2

    1.8.3.3

    DependentJoinPushdown

    ExecutingCommands

    ExtendingtheExecutionFactoryClass

    LargeObjects

    TranslatorCapabilities

    TranslatorProperties

    ExtendingTheJDBCTranslator

    DelegatingTranslator

    Packaging

    AddingDependentModules

    Deployment

    UserDefinedFunctions

    SourceSupportedFunctions

    SupportforUser-DefinedFunctions(Non-Pushdown)

    ArchethypeTemplateUDFProject

    AdminAPI

    CustomLogging

    RuntimeUpdates

    CustomMetadataRepository

    PreParser

    ArchethypeTemplatePreParserProject

    EmbeddedGuide

    LogginginTeiidEmbedded

    SecureEmbeddedwithPicketBox

    ReferenceGuide

    DataSources

    VirtualDatabases

    DevelopingaVirtualDatabase

    DDLVDB

    UsingXML&DDL

    VDBProperties

    SchemaObjectDDL

    DomainDDL

    MultiSourceModels

    MetadataRepositories

    RESTServiceThroughVDB

    SQLSupport

    Identifiers

    Expressions

    Criteria

    4

  • 1.8.3.4

    1.8.3.4.1

    1.8.3.4.2

    1.8.3.4.3

    1.8.3.4.4

    1.8.3.4.5

    1.8.3.4.6

    1.8.3.4.7

    1.8.3.4.8

    1.8.3.4.9

    1.8.3.4.10

    1.8.3.4.11

    1.8.3.4.12

    1.8.3.4.13

    1.8.3.4.14

    1.8.3.5

    1.8.3.5.1

    1.8.3.5.2

    1.8.3.5.3

    1.8.3.5.4

    1.8.3.5.5

    1.8.3.5.5.1

    1.8.3.5.5.2

    1.8.3.5.5.3

    1.8.3.5.5.4

    1.8.3.5.6

    1.8.3.5.7

    1.8.3.5.8

    1.8.3.5.9

    1.8.3.5.10

    1.8.3.5.11

    1.8.3.5.12

    1.8.3.6

    1.8.3.6.1

    1.8.3.6.2

    1.8.3.6.3

    1.8.3.6.4

    1.8.3.7

    1.8.3.7.1

    1.8.3.7.2

    ScalarFunctions

    NumericFunctions

    StringFunctions

    Date_TimeFunctions

    TypeConversionFunctions

    ChoiceFunctions

    DecodeFunctions

    LookupFunction

    SystemFunctions

    XMLFunctions

    JSONFunctions

    SecurityFunctions

    SpatialFunctions

    MiscellaneousFunctions

    NondeterministicFunctionHandling

    DMLCommands

    SetOperations

    Subqueries

    WITHClause

    SELECTClause

    FROMClause

    XMLTABLE

    ARRAYTABLE

    OBJECTTABLE

    TEXTTABLE

    WHEREClause

    GROUPBYClause

    HAVINGClause

    ORDERBYClause

    LIMITClause

    INTOClause

    OPTIONClause

    DDLCommands

    TempTables

    AlterView

    AlterProcedure

    AlterTrigger

    XMLSELECTCommand

    QueryStructure

    DocumentGeneration

    5

  • 1.8.3.8

    1.8.3.8.1

    1.8.3.8.2

    1.8.3.8.3

    1.8.3.9

    1.8.4

    1.8.4.1

    1.8.4.2

    1.8.4.3

    1.8.4.4

    1.8.5

    1.8.5.1

    1.8.6

    1.8.6.1

    1.8.6.2

    1.8.6.3

    1.8.6.4

    1.8.6.5

    1.8.7

    1.8.7.1

    1.8.7.2

    1.8.7.3

    1.8.7.4

    1.8.8

    1.8.8.1

    1.8.8.2

    1.8.9

    1.8.9.1

    1.8.9.2

    1.8.9.3

    1.8.9.4

    1.8.9.5

    1.8.9.6

    1.8.9.7

    1.8.9.8

    1.8.9.9

    1.8.9.10

    1.8.9.10.1

    1.8.9.10.2

    1.8.9.10.3

    Procedures

    ProcedureLanguage

    VirtualProcedures

    UpdateProcedures

    Comments

    Datatypes

    SupportedTypes

    TypeConversions

    SpecialConversionCases

    EscapedLiteralSyntax

    UpdatableViews

    preservedTable

    TransactionSupport

    AutoCommitTxnExecutionProperty

    UpdatingModelCount

    JDBCandTransactions

    TransactionalBehaviorwithJBossDataSourceTypes

    LimitationsandWorkarounds

    DataRoles

    Permissions

    RoleMapping

    XMLDefinition

    Customizing

    SystemSchema

    SYS

    SYSADMIN

    Translators

    AmazonSimpleDBTranslator

    ApacheAccumuloTranslator

    ApacheSOLRTranslator

    CassandraTranslator

    CouchbaseTranslator

    DelegatingTranslators

    FileTranslator

    GoogleSpreadsheetTranslator

    InfinispanTranslator

    JDBCTranslators

    ActianVectorTranslator

    ApachePhoenixTranslator

    ClouderaImpalaTranslator

    6

  • 1.8.9.10.4

    1.8.9.10.5

    1.8.9.10.6

    1.8.9.10.7

    1.8.9.10.8

    1.8.9.10.9

    1.8.9.10.10

    1.8.9.10.11

    1.8.9.10.12

    1.8.9.10.13

    1.8.9.10.14

    1.8.9.10.15

    1.8.9.10.16

    1.8.9.10.17

    1.8.9.10.18

    1.8.9.10.19

    1.8.9.10.20

    1.8.9.10.21

    1.8.9.10.22

    1.8.9.10.23

    1.8.9.10.24

    1.8.9.10.25

    1.8.9.10.26

    1.8.9.10.27

    1.8.9.10.28

    1.8.9.10.29

    1.8.9.10.30

    1.8.9.10.31

    1.8.9.11

    1.8.9.12

    1.8.9.13

    1.8.9.14

    1.8.9.15

    1.8.9.16

    1.8.9.17

    1.8.9.18

    1.8.9.19

    1.8.9.20

    1.8.9.21

    1.8.9.22

    DB2Translator

    DerbyTranslator

    GreenplumTranslator

    H2Translator

    HiveTranslator

    HSQLTranslator

    InformixTranslator

    IngresTranslators

    IntersystemsCacheTranslator

    JDBCANSITranslator

    JDBCSimpleTranslator

    MetaMatrixTranslator

    MicrosoftAccessTranslators

    MicrosoftSQLServerTranslator

    ModeShapeTranslator

    MySQLTranslators

    NetezzaTranslator

    OracleTranslator

    OSISoftPITranslator

    PostgreSQLTranslator

    PrestoDBTranslator

    RedshiftTranslator

    SAPHanaTranslator

    SybaseIQTranslator

    SybaseTranslator

    TeiidTranslator

    TeradataTranslator

    VerticaTranslator

    JPATranslator

    LDAPTranslator

    LoopbackTranslator

    MicrosoftExcelTranslator

    MongoDBTranslator

    ObjectTranslator

    ODataTranslator

    ODataV4Translator

    SwaggerTranslator

    OLAPTranslator

    SalesforceTranslators

    SAPGatewayTranslator

    7

  • 1.8.9.23

    1.8.10

    1.8.10.1

    1.8.10.2

    1.8.10.3

    1.8.10.4

    1.8.10.5

    1.8.10.6

    1.8.10.7

    1.8.10.8

    1.8.11

    1.8.11.1

    1.8.11.2

    1.8.11.3

    1.8.11.4

    1.8.12

    1.9

    1.9.1

    1.9.2

    1.9.3

    1.9.4

    1.9.5

    1.9.6

    1.9.7

    1.9.8

    1.9.9

    WebServicesTranslator

    FederatedPlanning

    PlanningOverview

    QueryPlanner

    QueryPlans

    FederatedOptimizations

    SubqueryOptimization

    XQueryOptimization

    FederatedFailureModes

    ConformedTables

    Architecture

    Terminology

    DataManagement

    QueryTermination

    Processing

    BNFforSQLGrammar

    SecurityGuide

    LoginModules

    TeiidServerTransportSecurity

    JDBC/ODBCSSLconnectionusingself-signedSSLcertificates

    DataSourceSecurity

    KerberossupportthroughGSSAPI

    CustomAuthorizationValidator

    SAMLBasedSecurityForOData

    OAuth2BasedSecurityForODataUsingKeyCloak

    SAMLBasedSecurityForODataUsingKeyCloak

    8

  • LegalNotice

    ContributetoTeiidDocumentation

    Thepagesthemselveshavecommentingenabled.Youshouldbeabletoclickonanytextareatoaddacomment.

    ThedocumentationprojectishostedonGitHubat(teiid/teiid-documents).

    ForsimplechangesyoucanjustusetheonlineeditingcapabilitiesofGitHubbynavigatingtotheappropriatesourcefileandselectingfork/edit.

    Forlargerchangesfollowthese3steps:

    Step.1clonethesources

    [email protected]:teiid/teiid-documents.git

    Step.2doedit

    Useanytexteditortoedittheadocfiles,AsciiDocSyntaxQuickReferencecanhelpyouinAsciiDocSyntax.

    Step.3submityourchange

    Onceyoufinishedthissteps,thecontentofdocumentswillupdatedautomatically.

    Testlocally

    Youmayneedtestlocally,tomakesurethechangesarecorrect,todothisinstallgitbook,thenexecutethefollowingcommandsfromthecheckoutlocation:

    $gitbookinstall$gitbookserve-w

    Onceabovecommandsexecutessuccessfully,thehttpformatdocumentcanbetestlocallyviahttp://localhost:4000/.

    Introduction

    9

    https://github.com/teiid/teiid-documentshttp://asciidoctor.org/docs/asciidoc-syntax-quick-reference/https://teiid.gitbooks.io/documents/content/https://github.com/GitbookIO/gitbook

  • Generatehtml/pdf/epub/mobi

    Youmaylocallycreaterenderedformsofthedocumentation.Todothisinstallgitbookandebook-convert,thenexecutethefollowingcommandsfromthecheckoutlocation:

    $gitbookbuild./teiid-documents$gitbookpdf./teiid-documents.pdf$gitbookepub./teiid-documents.epub$gitbookmobi./teiid-documents.mobi

    Onceabovecommandsexecutessuccessfully,theteiid-documentsfolder,teiid-documents.pdf,teiid-documents.epub,andteiid-documents.mobiwillbegenerated.

    Introduction

    10

    https://github.com/GitbookIO/gitbookhttps://help.gitbook.com/build/ebookconvert.html

  • LegalNotice

    1801VarsityDriveRaleigh,NC27606-2072USAPhone:+19197543700Phone:8887334281Fax:+19197543701POBox13588ResearchTrianglePark,NC27709USA

    Copyright©2017byRedHat,Inc.Thiscopyrightedmaterialismadeavailabletoanyonewishingtouse,modify,copy,orredistributeitsubjecttothetermsandconditionsoftheGNULesserGeneralPublicLicense,aspublishedbytheFreeSoftwareFoundation.

    RedHatandtheRedHat"ShadowMan"logoareregisteredtrademarksofRedHat,Inc.intheUnitedStatesandothercountries.

    Allothertrademarksreferencedhereinarethepropertyoftheirrespectiveowners.

    [email protected]:

    CA2086862BD69DFC65F6ECC4219180CDDB42A60E

    LegalNotice

    11

    mailto:[email protected]

  • Administrator’sGuideThisguideisintendedforanyuserwhoassumesroleofadeveloper/administratorofTeiidinstance.ThisguideguidesuserthroughinstallationofTeiidServer,configurationofdifferentservicesanddeploymentofTeiidartifactssuchasVDBs.BeforeonecandelveintoTeiiditisveryimportanttolearnfewbasicconstructsofTeiid,likewhatisVDB?whatisModel?etc.Forthatpleasereadtheshortintroductionherehttp://teiid.jboss.org/basics/

    Administrator’sGuide

    12

    http://teiid.jboss.org/basics/

  • InstallationGuideTeiidneedstobeinstalledintoanexistingWildFly10.0.0installation.

    Note Teiidprovidesanembeddedkit,howeveritshouldbeconsideredatechpreviewasitsAPIswilllikelyevolveandthereissparsedocumentation.

    StepstoinstallTeiid

    DownloadtheWildFlyapplicationserver.Installtheserverbyunzippingintoaknownlocation.Ex:/apps/jboss-install

    Note YoumayalsochoosetouseanexistingASinstallation.HoweverifapreviousversionofTeiidwasalreadyinstalled,youmustremovetheoldTeiiddistributionartifactsbeforeinstallingthenewversion.

    DownloadTeiid.UnzipthedownloadedartifactinsidetheWildFlyinstallation.Teiid9.3directorystructurematchesWildFlydirectly-itisjustanoverlay.ThiswilladdnecessarymodulesandconfigurationfilestoinstallTeiidinWildFly10.0.0inbothStandaloneandDomainmodes.Teiidprovidesseparateconfigurationfilesforbothstandalonemodeanddomainmode.BasedonmodetypeyouselectedtorunWildFly10.0.0,youmayhavetorunaCLIscripttocompletetheTeiidinstallation.

    The"Domain"moderecommendedinaclusteredenvironmenttotakeadvantageofclusteredcachingandclustersafedistributionofevents.Teiid’sdefaultconfigurationforDomainmodethroughCLIscriptconfiguredforhighavailabilityandclusteredcaching.

    StandaloneMode

    ifyouwanttostartthe"standalone"profile,executethefollowingcommand

    /bin/standalone.sh-c=standalone-teiid.xml

    InstallingTeiidusingCLIscript

    TheaboveisstartingWildFlyinaseparateTeiidspecificconfigurationthatisbasedstandalone.xml.However,ifyoualreadyworkingwithapredefinedconfigurationforexampledefaultstandalone.xmlandwouldliketoinstallTeiidintothatconfiguration,thenyoucanexecutethefollowingJBossCLIscript.First,starttheserver

    /bin/standalone.sh

    theninaseparateconsolewindowexecute

    /bin/jboss-cli.sh--file=bin/scripts/teiid-standalone-mode-install.cli

    thiswillinstallTeiidsubsystemintotherunningconfigurationoftheWildFly10.0.0instandalonemode.

    Note:Ifyouareusingstandalonehaorstandalonefull-ha,youshouldusetheteiid-standalone-ha-mode-install.cliscriptinstead.

    DomainMode

    InstallationGuide

    13

    http://wildfly.org/downloads/http://teiid.jboss.org/downloads/

  • Tostarttheserverin"Domain"mode,installWildFly10.0.0andTeiid9.3onalltheserversthataregoingtobepartofthecluster.Selectoneoftheserversasthe"master"domaincontroller,therestoftheserverswillbeslavesthatconnecttothe"master"domaincontrollerforalltheadministrativeoperations.PleaserefertoWildFly10.0.0provideddocumentationforfulldetails.

    Onceyouconfiguredalltheservers,startthe"master"nodewithfollowingcommand

    /bin/domain.sh

    andon"slave"nodes

    /bin/domain.sh

    Theslavenodesfetchtheirdomainconfigurationfromthe"master"node.

    Oncealltheserversareup,completetheinstallationtorunindomainmodebyexecutingthefollowingcommandagainstthe"master"node.Notethatthisonlyneedstoberunonceperdomain(i.e.cluster)install.ThisscriptwillinstallTeiidinthehaandfull-haprofiles.Itwillalsore-configuremain-server-grouptostartthehaprofile.Onceindomainmode,youcannotstaticallydeployresourcesbydroppingtheminthedomain/deploymentsfolder,sothisscriptwilldeploythedefaultresources(file,ldap,salesforceandwsconnectors)usingtheCLIinterface.

    /bin/jboss-cli.sh--file=scripts/teiid-domain-mode-install.cli

    Thatsit!.WildFlyandTeiidarenowinstalledandrunning.Seebelowinstructionstocustomizevariousothersettings.

    OnceVDBshavebeendeployed,userscannowconnecttheirJDBCapplicationstoTeiid.IfyouneedhelponconnectingyourapplicationtoTeiidusingJDBCcheckouttheClientDeveloper’sGuide.

    DirectoryStructureExplained

    ThisshowsthecontentsoftheTeiid9.3deployment.ThedirectorystructureisexactlythesameunderanyJBossprofile.

    DirectoryStructure

    /bin/scripts/docs/teiid/datsources/schema/examples/domain/configuration/modules/system/layers/base/org/jboss/teiid/*/standalone/configurationstandalone-teiid.xml

    InstallationGuide

    14

    https://docs.jboss.org/author/display/WFLY9/WildFly+9+Cluster+Howto

  • Name Description

    bin/scripts ContainsinstallationandutilityCLIscriptsforsettingupTeiidindifferentconfigurations.

    docs/teiid Containsdocuments,examples,sampledatasourceXMLfragmentsandschemafiles.

    /standalone/configurationstandalone-teiid.xml-MasterconfigurationfilefortheTeiidsystem.ThisfilecontainstheTeiidsubsystem,inadditiontothestandardWildFlywebprofilesubsystems

    /domain/configuration/ -

    /modules/system/layers/base/org/jboss/teiid/* ThisdirectorycontainstheTeiidmodulesforWildFly10.0.0system

    /modules/system/layers/base/org/jboss/teiid/client

    ThisdirectorycontainsTeiidclientlibraries.IthastheTeiidJDBCdriverjar,"teiid-9.3.0.Final-jdbc.jar",andalsocontains"teiid-hibernate-dialect-9.3.0.Final.jar"thatcontainsTeiid’sHibernatedialect.

    \{standaloneordomain}/tmp/teiid

    Thisdirectoryunderstandaloneordomain,containstemporaryfilescreatedbyTeiid.Thesearemostlycreatedbythebuffermanager.ThesefilesarenotneededacrossaVMrestart.CreationofTeiidlobvalues(forexamplethroughSQL/XML)willtypicallycreateonefileperlobonceitexceedstheallowableinmemorysizeof8KB.Inheavyusagescenarios,considerpointingthebufferdirectoryatapartitionthatisroutinelydefragmented.

    \{standaloneordomain}/data/teiid-data Thisdirectoryunderstandaloneordomain,containscachedvdbmetadatafiles.Donoteditthemmanually.

    InstallationGuide

    15

  • DeployingVDBsAVDBistheprimarymeanstodefineaVirtualDatabaseinTeiid.AusercancreateaVDBusingTeiidDesigner-http://www.jboss.org/teiiddesigner/-orfollowtheinstructionsintheReferenceGuidetocreateaVDBwithoutTeiidDesigner.

    Onceyouhavea"VDB"builtitcanbedeployed/undeployedinTeiidruntimeindifferentways.

    WarningIfVDBversioningisnotusedtogivedistinctversionnumbers,overwritingaVDBofthesamenamewillterminateallconnectionstotheoldVDB.ItisrecommendedthatVDBversioningbeusedforproductionsystems.

    Caution RemovinganexistingVDBwillimmediatelycleanupVDBfileresources,andwillautomaticallyterminateexistingsessions.

    CautionTheruntimenamesofdeployedVDBartifactsmusteitherbe*.vdbforazipfileor*-vdb.xmlforanxmlfileor-vdb.ddlforDDLfile.FailuretonamethedeploymentproperlywillresultinadeploymentfailureastheTeiidsubsystemwillnotknowhowtoproperlyhandletheartifact.

    Tip ifyouhaveexistingVDBincombinationof*.vdbor-vdb.xmlformat,youcanmigratetoallDDLversionusingthe"teiid-convert-vdb.bat"or"teiid-convert-vdb.sh"utilityinthe"bin"directoryoftheinstallation.

    DirectFileDeployment

    CopytheVDBfileintothe

    /standalone/deployments

    directory.ThencreateanemptymarkerfilewithsamenameastheVDBwithextension".dodeploy"inthesamedirectory.Forexample,ifyourvdbnameis"enterprise.vdb",thenmarkerfilenamemustbe"enterprise.vdb.dodeploy".MakesurethattherearenootherVDBfileswiththesamename.IfaVDBalreadyexistswiththesamename,thenthisVDBwillbereplacedwiththenewVDB.ThisisthesimplestwaytodeployaVDB.Thisismostlydesignedforquickdeploymentduringdevelopment,whentheTeiidserverisavailablelocallyonthedeveloper’smachine.

    Note ThisonlyworksintheStandalonemode.ForDomainmode,youmustuseoneoftheotheravailablemethods.

    AdminConsoleDeployment(Web)

    Usetheadminwebconsoleat:

    http://:/console

    MoredetailsforthiscanbefoundintheAdminConsoleVDBdeploymentsection.ThisistheeasiestwaytodeployaVDBtoaremoteserver.

    CLIbasedDeploymentWildFly10.0.0providescommandlineinterface(CLI)fordoinganykindofadministrativetask.Execute

    DeployingVDBs

    16

    http://www.jboss.org/teiid/basics/virtualdatabases.htmlhttp://www.jboss.org/teiiddesigner/

  • bin/jboss-cli.sh--connect

    commandandrun

    #instandalonemodedeploy/path/to/my.vdb

    #indomainmodedeploy/path/to/my.vdb--server-groups=main-server-group

    todeploytheVDB.Notethatindomainmode,youneedtoeitherselectaparticular"server-group"orallavailableservergroupsaredeploymentoptions.CheckoutCLIdocumentationformoregeneralusageoftheCLI.

    AdminShellDeploymentTeiidprovidesagroovybasedAdminShellscriptingtool,whichcanbeusedtodeployaVDB.Seethe"deploy"method.ConsulttheAdminShelldocumentationformoreinformation.NotethatusingtheAdminShellscripting,youcanautomatedeploymentofartifactsinyourenvironment.WhenusingAdminShell,indomainmode,theVDBisdeployedtoalltheavailableservers.

    AdminAPIDeploymentTheAdminAPI(lookinorg.teiid.adminpi.*)providesJavaAPImethodsthatletsauserconnecttoaTeiidruntimeanddeployaVDB.IfyouneedtoprogramaticallydeployaVDBusethismethod.ThismethodispreferableforOEMusers,whoaretryingtoextendtheTeiid’scapabilitiesthroughtheirapplications.WhenusingAdminAPI,indomainmode,theVDBisdeployedtoalltheservers.

    DeployingVDBs

    17

    https://docs.jboss.org/author/display/WFLY10/Admin+Guide

  • DeployingVDBDependenciesApartfromdeployingtheVDB,theuserisalsoresponsibleforprovidingallthenecessarydependentlibraries,configurationforcreatingthedatasourcesthatareneededbythemodels(schemas)definedin"META-INF/vdb.xml"fileinsideyourVDB.Forexample,ifyouaretryingtointegratedatafromOracleRDBMSandFilesourcesinyourVDB,thenyouareresponsibleforprovidingtheJDBCdriverfortheOraclesourceandanynecessarydocumentsandconfigurationthatareneededbytheFileTranslator.

    DatasourceinstancesmaybeusedbysingleVDB,ormaybesharedwithasotherVDBsorotherapplications.Considersharingconnectionstodatasourcesthathaveheavy-weightandresourceconstrained.

    WiththeexceptionofJDBCsources,othersupporteddatasourceshaveacorrespondingJCAconnectorintheTeiidkit.Eitherdirectlyeditthestandalone-teiid.xmloruseCLItocreatetherequireddatasourcesbytheVDB.Exampleconfigurationsareprovidedforallthesourcesin"/docs/teiid/datasources"directory.NotethatintheDomainmode,youmustuseCLIoradmin-consoleorAdminShelltoconfigurethedatasources.

    Somedatasourcesmaycontainpasswordsorothersensitiveinformation.SeetheWIKIarticleEncryptingDataSourcePasswordstonotstorepasswordsinplaintext.

    OncetheVDBanditsdependenciesaredeployed,thenclientapplicationscanconnectusingtheJDBCAPI.Ifthereareanyerrorsinthedeployment,aconnectionattemptwillnotbesuccessfulandamessagewillbelogged.Youcanusetheadmin-consoletoolorcheckthelogfilesforerrorsandcorrectthembeforeproceeding.CheckClientDeveloper’sGuideonhowtouseJDBCtoconnecttoyourVDB.

    DeployingVDBDependencies

    18

    https://community.jboss.org/wiki/JBossAS7SecuringPasswords

  • ApacheAccumuloDataSourcesAccumulodatasourcesuseaTeiidspecificJCAconnectorthatisdeployedintoWildFly10.0.0duringinstallation.TherearemanywaystocreateaAccumulodatasource,usingCLI,AdminShell,admin-console,etc.TheexampleshownbelowusestheCLItool,asthisworksinbothStandaloneandDomainmodes.

    ExecutethefollowingcommandusingtheCLIonceyouconnectedtotheServer.MakesureyouprovidethecorrectURLandusercredentials.Addanyadditionalpropertiesrequiredbytheconnectorbyduplicatingthe"connection-definitions"commandbelow.EdittheJNDInametomatchtheJNDInameyouusedinVDB.

    batch/subsystem=resource-adapters/resource-adapter=accumulo/connection-definitions=teiid:add(jndi-name=java:/accumulo-ds,class-name=org.teiid.resource.adapter.accumulo.AccumuloManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=accumulo/connection-definitions=teiid/config-properties=ZooKeeperServerList:add(value=localhost:2181)/subsystem=resource-adapters/resource-adapter=accumulo/connection-definitions=teiid/config-properties=Username:add(value=user)/subsystem=resource-adapters/resource-adapter=accumulo/connection-definitions=teiid/config-properties=Password:add(value=password)/subsystem=resource-adapters/resource-adapter=accumulo/connection-definitions=teiid/config-properties=InstanceName:add(value=instancename)/subsystem=resource-adapters/resource-adapter=accumulo/connection-definitions=teiid/config-properties=Roles:add(value=public)/subsystem=resource-adapters/resource-adapter=accumulo:activaterunbatch

    AllthepropertiesthataredefinedontheRARfileare

    PropertyName Description Required Default

    ZooKeeperServerList

    Acommaseparatedlistofzookeeperserverlocations.Eachlocationcancontainanoptionalport,oftheformathost:port

    true none

    Username ConnectionUser’sName true none

    Password ConnectionUser’spassword true none

    InstanceName Accumuloinstancename true none

    Rolesoptionalvisibilityforuser,supplymultiplewithcommaseparated

    false none

    TofindoutallthepropertiesthataresupportedbythisAccumuloConnectorexecutethefollowingcommandintheCLI.

    /subsystem=teiid:read-rar-description(rar-name=accumulo)

    Tip

    Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallyeditthe"/standalone/configuration/standalone-teiid.xml"fileandaddtheXMLconfigurationdefinedin"/docs/teiid/datasources/accumulo"directoryunder"resource-adapters"subsystem.Shutdowntheserver

    DeployingVDBDependencies

    19

    https://docs.jboss.org/author/display/WFLY10/Admin+Guide#AdminGuide-RunningtheCLI

  • beforeyoueditthisfile,andrestartafterthemodificationsaredone.

    DeployingVDBDependencies

    20

  • AmazonSimpleDBDataSourcesSimpleDBdatasourcesuseaTeiidspecificJCAconnectorthatisdeployedintoWildFly10.0.0duringinstallation.TherearemanywaystocreateaSimpleDBdatasource,usingCLI,AdminShell,admin-console,etc.TheexampleshownbelowusestheCLItool,asthisworksinbothStandaloneandDomainmodes.

    ExecutethefollowingcommandusingtheCLIonceyouconnectedtotheServer.Makesureyouprovidethecorrectaccesskeys.Addanyadditionalpropertiesrequiredbytheconnectorbyduplicatingthe"connection-definitions"commandbelow.EdittheJNDInametomatchtheJNDInameyouusedinVDB.

    batch/subsystem=resource-adapters/resource-adapter=simpledb/connection-definitions=simpledbDS:add(jndi-name=java:/simpledbDS,class-name=org.teiid.resource.adapter.simpledb.SimpleDBManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=simpledb/connection-definitions=simpledbDS/config-properties=AccessKey:add(value=xxx)/subsystem=resource-adapters/resource-adapter=simpledb/connection-definitions=simpledbDS/config-properties=SecretAccessKey:add(value=xxx)/subsystem=resource-adapters/resource-adapter=simpledb:activaterunbatch

    TofindoutallthepropertiesthataresupportedbythisSimpleDBConnectorexecutethefollowingcommandintheCLI.

    /subsystem=teiid:read-rar-description(rar-name=simpledb)

    Tip

    Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallyeditthe"/standalone/configuration/standalone-teiid.xml"fileandaddtheXMLconfigurationdefinedin"/docs/teiid/datasources/simpledb"directoryunder"resource-adapters"subsystem.Shutdowntheserverbeforeyoueditthisfile,andrestartafterthemodificationsaredone.

    DeployingVDBDependencies

    21

    https://docs.jboss.org/author/display/WFLY10/Admin+Guide#AdminGuide-RunningtheCLI

  • CassandraDataSourcesCassandradatasourcesuseaTeiidspecificJCAconnectorthatisdeployedintoWildFly10.0.0duringinstallation.TherearemanywaystocreateaCassandradatasource,usingCLI,AdminShell,admin-console,etc.TheexampleshownbelowusestheCLItool,asthisworksinbothStandaloneandDomainmodes.

    ExecutethefollowingcommandusingtheCLIonceyouconnectedtotheServer.MakesureyouprovidethecorrectURLandusercredentials.Addanyadditionalpropertiesrequiredbytheconnectorbyduplicatingthe"connection-definitions"commandbelow.EdittheJNDInametomatchtheJNDInameyouusedinVDB.

    batch/subsystem=resource-adapters/resource-adapter=cassandra/connection-definitions=cassandraDS:add(jndi-name=java:/cassandraDS,class-name=org.teiid.resource.adapter.cassandra.CassandraManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=cassandra/connection-definitions=cassandraDS/config-properties=Address:add(value=127.0.0.1)/subsystem=resource-adapters/resource-adapter=cassandra/connection-definitions=cassandraDS/config-properties=Keyspace:add(value=my-keyspace)/subsystem=resource-adapters/resource-adapter=cassandra:activaterunbatch

    TofindoutallthepropertiesthataresupportedbythisCassandraConnectorexecutethefollowingcommandintheCLI.

    /subsystem=teiid:read-rar-description(rar-name=cassandra)

    Tip

    Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallyeditthe"/standalone/configuration/standalone-teiid.xml"fileandaddtheXMLconfigurationdefinedin"/docs/teiid/datasources/cassandra"directoryunder"resource-adapters"subsystem.Shutdowntheserverbeforeyoueditthisfile,andrestartafterthemodificationsaredone.

    DeployingVDBDependencies

    22

    https://docs.jboss.org/author/display/WFLY10/Admin+Guide#AdminGuide-RunningtheCLI

  • CouchbaseDataSourcesCouchbasedatasourcesuseaTeiidspecificJCAconnectorthatisdeployedintoWildFly10.0.0duringinstallation.TherearemanywaystocreateaCouchbasedatasource,usingCLI,AdminShell,admin-console,etc.TheexampleshownbelowusestheCLItool,asthisworksinbothStandaloneandDomainmodes.

    ExecutethefollowingcommandusingtheCLIonceyouconnectedtotheServer.MakesureyouprovidethecorrectURLandusercredentials.Addanyadditionalpropertiesrequiredbytheconnectorbyduplicatingthe"connection-definitions"commandbelow.EdittheJNDInametomatchtheJNDInameyouusedinVDB.

    batch/subsystem=resource-adapters/resource-adapter=couchbaseQS:add(module=org.jboss.teiid.resource-adapter.couchbase)/subsystem=resource-adapters/resource-adapter=couchbaseQS/connection-definitions=couchbaseDS:add(jndi-name="java:/couchbaseDS",class-name=org.teiid.resource.adapter.couchbase.CouchbaseManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=couchbaseQS/connection-definitions=couchbaseDS/config-properties=ConnectionString:add(value="localhost")/subsystem=resource-adapters/resource-adapter=couchbaseQS/connection-definitions=couchbaseDS/config-properties=Keyspace:add(value="default")/subsystem=resource-adapters/resource-adapter=couchbaseQS/connection-definitions=couchbaseDS/config-properties=Namespace:add(value="default")runbatch

    TofindoutallthepropertiesthataresupportedbythisCouchbaseConnectorexecutethefollowingcommandintheCLI.

    /subsystem=teiid:read-rar-description(rar-name=couchbase)

    Tip

    Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallyeditthe"/standalone/configuration/standalone-teiid.xml"fileandaddtheXMLconfigurationdefinedin"/docs/teiid/datasources/couchbase"directoryunder"resource-adapters"subsystem.Shutdowntheserverbeforeyoueditthisfile,andrestartafterthemodificationsaredone.

    DeployingVDBDependencies

    23

    https://docs.jboss.org/author/display/WFLY10/Admin+Guide#AdminGuide-RunningtheCLI

  • FileDataSourcesFiledatasourcesuseaTeiidspecificJCAconnectorthatisdeployedintoWildFly10.0.0duringinstallation.Therearemanywaystocreatethefiledatasource,usingCLI,AdminShell,admin-console,etc.TheexampleshownbelowusestheCLItool,asthisworksinbothStandaloneandDomainmodes.

    ExecutefollowingcommandusingtheCLIonceyouconnectedtotheServer.Makesureyouprovidethecorrectdirectorynameandotherpropertiesbelow.Addanyadditionalpropertiesrequiredbytheconnectorbyduplicatingthe"connection-definitions"commandbelow.EdittheJNDInametomatchtheJNDInameyouusedinVDB.

    batch/subsystem=resource-adapters/resource-adapter=file/connection-definitions=fileDS:add(jndi-name=java:/fileDS,class-name=org.teiid.resource.adapter.file.FileManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=file/connection-definitions=fileDS/config-properties=Parentdirectory:add(value=/home/rareddy/testing/)/subsystem=resource-adapters/resource-adapter=file/connection-definitions=fileDS/config-properties=AllowParentPaths:add(value=true)/subsystem=resource-adapters/resource-adapter=file:activaterunbatch

    TofindoutallthepropertiesthataresupportedbythisFileConnectorexecutethefollowingcommandintheCLI.

    /subsystem=teiid:read-rar-description(rar-name=file)

    Tip

    Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallyeditthe"/standalone/configuration/standalone-teiid.xml"fileandaddtheXMLconfigurationdefinedin"/docs/teiid/datasources/file"directoryunder"resource-adapters"subsystem.Shutdowntheserverbeforeyoueditthisfile,andrestartafterthemodificationsaredone.

    DeployingVDBDependencies

    24

    https://docs.jboss.org/author/display/WFLY10/Admin+Guide#AdminGuide-RunningtheCLI

  • Ftp/FtpsDataSourcesFtp/FtpsdatasourcesuseaTeiidspecificJCAconnectorthatisdeployedintoWildFly10.0.0duringinstallation.TherearemanywaystocreatetheFtp/Ftpsdatasource,usingCLI,AdminShell,admin-console,etc.TheexampleshownbelowusestheCLItool,asthisworksinbothStandaloneandDomainmodes.

    ExecutefollowingcommandusingtheCLIonceyouconnectedtotheServer.Makesureyouprovidethecorrectdirectorynameandotherpropertiesbelow.Addanyadditionalpropertiesrequiredbytheconnectorbyduplicatingthe"connection-definitions"commandbelow.EdittheJNDInametomatchtheJNDInameyouusedinVDB.

    /subsystem=resource-adapters/resource-adapter=ftp:add(module=org.jboss.teiid.resource-adapter.ftp)/subsystem=resource-adapters/resource-adapter=ftp/connection-definitions=ftpDS:add(jndi-name=${jndi.name}",class-name=org.teiid.resource.adapter.ftp.FtpManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=ftp/connection-definitions=ftpDS/config-properties=ParentDirectory:add(value="${ftp.parent.dir}")/subsystem=resource-adapters/resource-adapter=ftp/connection-definitions=ftpDS/config-properties=Host:add(value="${ftp.parent.host}")/subsystem=resource-adapters/resource-adapter=ftp/connection-definitions=ftpDS/config-properties=Port:add(value=${ftp.parent.port}")/subsystem=resource-adapters/resource-adapter=ftp/connection-definitions=ftpDS/config-properties=Username:add(value=${ftp.parent.username}")/subsystem=resource-adapters/resource-adapter=ftp/connection-definitions=ftpDS/config-properties=Password:add(value=${ftp.parent.password}")/subsystem=resource-adapters/resource-adapter=ftp:activate()

    TofindoutallthepropertiesthataresupportedbythisFtp/FtpsConnectorexecutethefollowingcommandintheCLI.

    /subsystem=teiid:read-rar-description(rar-name=ftp)

    Tip

    Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallyeditthe"/standalone/configuration/standalone-teiid.xml"fileandaddtheXMLconfigurationdefinedin"/docs/teiid/datasources/ftp"directoryunder"resource-adapters"subsystem.Shutdowntheserverbeforeyoueditthisfile,andrestartafterthemodificationsaredone.

    DeployingVDBDependencies

    25

    https://docs.jboss.org/author/display/WFLY10/Admin+Guide#AdminGuide-RunningtheCLI

  • GoogleSpreadsheetDataSources

    TheGoogleJCAconnectorisnamedteiid-connector-google.rar.Theexamplesincludeasamplegoogle.xmlfile.TheJCAconnectorhasnumberofconfig-propertiestodriveauthentication.TheJCAconnectorconnectstoexactlyonespreadsheetwitheachsheetexposedasatable.

    AuthenticationtoyourgoogleaccountmaybedoneusingOAuth,whichrequiresarefreshtoken(outlinedbelow).

    Configproperty Description

    ClientId clientIDforaccess.Ifnotspecified,theTeiiddefaultwillbeused.

    ClientSecret clientsecretforaccess.Ifnotspecified,theTeiiddefaultwillbeused.

    RefreshToken UseguidebelowtoretrieveRefreshToken.RequestaccesstoGoogleDriveandSpreadsheetAPI.

    SpreadsheetNameRequiredpropertywithnameoftheSpreadsheetthatisdatasourceforthisconnector.Bydefaultitisassumedtobeatitle.

    Key Optionalbooleanpropertytodesignatethespreadsheetnameisakeyratherthanatitle.

    BatchSize Maximumnumberofrowsthatcanbefetchedatatime.Defaultsto4096.

    CreateAuthorizationCredentialsItisrecommendedthatyoucreateyourownauthorizationcredentialsratherthanrelyingonthedefaultTeiidclientidandclientsecret.CreatingyourownprojectwillgiveyougreatercontrolovermonitoringandcontrollingAPIaccess.

    YoushouldfollowtheOAuth2ForDevicesGuideprerequisites.YoushouldallowtheprojectaccesstoGoogleDriveAPIandtheSheetsAPI.

    Acondensedformoftherestoftheguide"ObtainingOAuth2.0accesstokens"iscoverednextas"GettinganOAuthRefreshToken".

    GettinganOAuthRefreshTokenWithabrowserorotherclientissuetherequestwiththeappropriateclientID:

    https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fspreadsheets.google.com%2Ffeeds&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=;

    ThencopytheauthorizationcodeintofollowingPOSTrequestandrunitincommandline:

    curl\--data-urlencodecode=\--data-urlencodeclient_id=\--data-urlencodeclient_secret=\

    DeployingVDBDependencies

    26

    https://developers.google.com/accounts/docs/OAuth2ForDeviceshttps://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fspreadsheets.google.com%2Ffeeds&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id="

  • --data-urlencoderedirect_uri=urn:ietf:wg:oauth:2.0:oob\--data-urlencodegrant_type=authorization_codehttps://accounts.google.com/o/oauth2/token

    Therefreshtokenwillbeintheresponse.

    TousetheTeiiddefaults:

    Clickonhttps://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fspreadsheets.google.com%2Ffeeds&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=217138521084.apps.googleusercontent.com

    ThencopytheauthorizationcodeintofollowingPOSTrequestandrunitincommandline:

    curl\--data-urlencodecode=\--data-urlencodeclient_id=217138521084.apps.googleusercontent.com\--data-urlencodeclient_secret=gXQ6-lOkEjE1lVcz7giB4Poy\--data-urlencoderedirect_uri=urn:ietf:wg:oauth:2.0:oob\--data-urlencodegrant_type=authorization_codehttps://accounts.google.com/o/oauth2/token

    ImplementationDetailsGoogleTranslatorisimplementedusingGDataAPI[1](javalibraryfor[4])andGoogleVisualizationProtocol[2].AuthenticationisimplementedusingOAuth2fordevices[3].1.https://developers.google.com/google-apps/spreadsheets/2.https://developers.google.com/chart/interactive/docs/querylanguage3.https://developers.google.com/accounts/docs/OAuth2ForDevices4.https://developers.google.com/google-apps/spreadsheets

    DeployingVDBDependencies

    27

    https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fspreadsheets.google.com%2Ffeeds&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=217138521084.apps.googleusercontent.comhttps://developers.google.com/google-apps/spreadsheets/https://developers.google.com/chart/interactive/docs/querylanguagehttps://developers.google.com/accounts/docs/OAuth2ForDeviceshttps://developers.google.com/google-apps/spreadsheets

  • InfinispanDataSourcesInfinispandatasourcesuseaTeiidspecificJCAconnectorthatisdeployedintoWildFly10.0.0duringinstallation.TherearemanywaystocreateaInfinispanhotrodbaseddatasource,usingCLI,AdminShell,admin-console,etc.TheexampleshownbelowusestheCLItool,asthisworksinbothStandaloneandDomainmodes.

    ExecutethefollowingcommandsusingtheCLIonceyouconnectedtotheServer.MakesureyouprovidethecorrectURLandusercredentials.Addanyadditionalpropertiesrequiredbytheconnectorbyduplicatingthe"connection-definitions"commandbelow.EdittheJNDInametomatchtheJNDInameyouusedinVDB.

    batch/subsystem=resource-adapters/resource-adapter=infinispanDS:add(module=org.jboss.teiid.resource-adapter.infinispan.hotrod)/subsystem=resource-adapters/resource-adapter=infinispanDS/connection-definitions=ispnDS:add(jndi-name="java:/ispnDS",class-name=org.teiid.resource.adapter.infinispan.hotrod.InfinispanManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=infinispanDS/connection-definitions=ispnDS/config-properties=RemoteServerList:add(value="{host}:11222")/subsystem=resource-adapters/resource-adapter=infinispanDS:activaterunbatch

    AllthepropertiesthataredefinedontheRARfileare

    PropertyName Description Required Default

    RemoteServerList

    Acommaseparatedlistofserverlocations.Eachlocationcancontainanoptionalport,oftheformathost:port

    Yes

    TofindoutallthepropertiesthataresupportedbythisInfinispanConnector,executethefollowingcommandintheCLI.

    /subsystem=teiid:read-rar-description(rar-name=infinispan)

    Tip

    Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallyeditthe"/standalone/configuration/standalone-teiid.xml"fileandaddtheXMLconfigurationdefinedin"/docs/teiid/datasources/infinispan"directoryunder"resource-adapters"subsystem.Shutdowntheserverbeforeyoueditthisfile,andrestartafterthemodificationsaredone.

    DeployingVDBDependencies

    28

    https://docs.jboss.org/author/display/WFLY10/Admin+Guide#AdminGuide-RunningtheCLI

  • JDBCDataSourcesThefollowingisanexamplehighlightingconfiguringanOracledatasource.Theprocessisnearlyidenticalregardlessofthedatabasevendor.TypicallytheJDBCjarandtheconfigurationlikeconnectionURLandusercredentialschange.

    Thereareconfigurationtemplatesforallthedatasourcesinthe"/docs/teiid/datasources"directory.AcompletedescriptionhowadatasourcecanbeaddedintoWildFlyisalsodescribedhere.Thebelowwepresenttwodifferentwaystocreateadatasource.

    DeployingasingleJDBCJarFile

    FirststepinconfiguringthedatasourceisdeployingtherequiredJDBCjarfile.Forexample,ifyouaretryingtocreateaOracledatasource,firstyouneedtodeploythe"ojdbc6.jar"filefirst.ExecutefollowingcommandusingtheCLIonceyouconnectedtotheServer.

    deploy/path/to/ojdbc6.jar

    Tip Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallycopythis’ojdbc6.jar"tothe"/standalone/deployments"directory,toautomaticallydeploywithoutusingtheCLItool.

    CreatingamodulefortheDriver

    Youmayalsocreateamoduletohavemorecontroloverthehandlingofthedriver.Incaseswherethedriverisnotcontainedinasinglefile,thismaybepreferabletocreatinga"uber"jarasthedependenciescanbemanagedseparately.

    Creatingamoduleforadriverisnodifferentthananyothercontainermodule.Youjustincludethenecessaryjarsasresourcesinthemoduleandreferenceothermodulesasdependencies.

    ...

    CreateDataSourceNowthatyouhavetheJDBCdriverdeployedorthemodulecreated,itistimetocreateadatasourceusingthisdriver.TherearemanywaystocreatethedatasourceusingCLI,AdminShell,admin-consoleetc.TheexampleshownbelowusestheCLItool,asthisworksinbothStandaloneandDomainmodes.

    ExecutefollowingcommandusingCLIonceyouconnectedtotheServer.MakesureyouprovidethecorrectURLandusercredentialsandedittheJNDInametomatchtheJNDInameyouusedinVDB.

    /subsystem=datasources/data-source=oracel-ds:add(jndi-name=java:/OracleDS,driver-name=ojdbc6.jar,connection-url=jdbc:oracle:thin:{host}:1521:orcl,user-name={user},password={password})/subsystem=datasources/data-source=oracel-ds:enable

    DeployingVDBDependencies

    29

    https://docs.jboss.org/author/display/WFLY10/DataSource+configurationhttps://docs.jboss.org/author/display/WFLY10/Admin+Guide#AdminGuide-RunningtheCLIhttps://docs.jboss.org/author/display/WFLY10/Admin+Guide#AdminGuide-RunningtheCLI

  • Thedriver-namewillmatchthenameofjarormodulethatyoudeployedforthedriver.

    Tip

    Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallyeditthe"/standalone/configuration/standalone-teiid.xml"fileandaddtheXMLconfigurationdefinedin*"/docs/teiid/datasources/oracle"directoryunder"datasources"subsystem.Shutdowntheserverbeforeyoueditthisfile,andrestartafterthemodificationsaredone.

    DeployingVDBDependencies

    30

  • LDAPDataSourcesLDAPdatasourcesuseaTeiidspecificJCAconnectorwhichisdeployedintoWildFly10.0.0duringinstallation.Therearemanywaystocreatetheldapdatasource,usingCLI,AdminShell,admin-consoleetc.TheexampleshownbelowusestheCLItool,asthisworksinbothStandaloneandDomainmodes.

    ExecutefollowingcommandusingCLIonceyouconnectedtotheServer.MakesureyouprovidethecorrectURLandusercredentials.Addanyadditionalpropertiesrequiredbytheconnectorbyduplicatingthe"connection-definitions"commandbelow.EdittheJNDInametomatchtheJNDInameyouusedinVDB.

    batch/subsystem=resource-adapters/resource-adapter=ldap/connection-definitions=ldapDS:add(jndi-name=java:/ldapDS,class-name=org.teiid.resource.adapter.ldap.LDAPManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=ldap/connection-definitions=ldapDS/config-properties=LdapUrl:add(value=ldap://ldapServer:389)/subsystem=resource-adapters/resource-adapter=ldap/connection-definitions=ldapDS/config-properties=LdapAdminUserDN:add(value={cn=???,ou=???,dc=???})/subsystem=resource-adapters/resource-adapter=ldap/connection-definitions=ldapDS/config-properties=LdapAdminUserPassword:add(value={pass})/subsystem=resource-adapters/resource-adapter=ldap/connection-definitions=ldapDS/config-properties=LdapTxnTimeoutInMillis:add(value=-1)/subsystem=resource-adapters/resource-adapter=ldap:activaterunbatch

    TofindoutallthepropertiesthataresupportedbythisLDAPConnectorexecutethefollowingcommandintheCLI.

    /subsystem=teiid:read-rar-description(rar-name=ldap)

    Tip

    Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallyeditthe"/standalone/configuration/standalone-teiid.xml"fileandaddtheXMLconfigurationdefinedin*"/docs/teiid/datasources/ldap"directoryunder"resource-adapters"subsystem.Shutdowntheserverbeforeyoueditthisfile,andrestartafterthemodificationsaredone.

    Note Touseananonymousbind,settheLdapAdminUserDNandLdapAdminUserPasswordtoemptyvalues.

    Tip Ifyouexperiencestaleconnectionsinthepool,youshouldenableeitherthevalidate-on-matchorthebackground-validationpoolsettings.

    DeployingVDBDependencies

    31

    https://docs.jboss.org/author/display/WFLY10/Admin+Guide#AdminGuide-RunningtheCLI

  • MongoDBDataSourcesMongoDBdatasourcesuseaTeiidspecificJCAconnectorthatisdeployedintoWildFly10.0.0duringinstallation.TherearemanywaystocreateaMongoDBdatasource,usingCLI,AdminShell,admin-console,etc.TheexampleshownbelowusestheCLItool,asthisworksinbothStandaloneandDomainmodes.

    ExecutethefollowingcommandusingtheCLIonceyouconnectedtotheServer.MakesureyouprovidethecorrectURLandusercredentials.Addanyadditionalpropertiesrequiredbytheconnectorbyduplicatingthe"connection-definitions"commandbelow.EdittheJNDInametomatchtheJNDInameyouusedinVDB.

    batch/subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS:add(jndi-name="java:/mongoDS",class-name=org.teiid.resource.adapter.mongodb.MongoDBManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS/config-properties=RemoteServerList:add(value="{host}:27017")/subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS/config-properties=Database:add(value="{db-name}")/subsystem=resource-adapters/resource-adapter=mongodb:activaterunbatch

    AllthepropertiesthataredefinedontheRARfileare

    PropertyName Description Required Default

    RemoteServerListAcommaseparatedlistofserverlocations.Eachlocationcancontainanoptionalport,oftheformathost:port

    Username ConnectionUser’sName false none

    Password ConnectionUser’spassword false none

    Database MongoDBdatabasename true none

    SecurityType

    MongoDBTypeofAuthenticationtobeused.Allowedvaluesare"None","SCRAM_SHA_1","MONGODB_CR","Kerberos","X509".IfyouareusingMongoDBversionlessthan3.0,MongoDBbydefaultuses"MONGODB_CR",thusthisvalueneedtobesetaccordinglyorsettoNone.

    false SCRAM_SHA_1

    AuthDatabase

    MongoDBDatabaseNameforuserauthenticationincasewhenSecurityType'MONGODB-CR'isused.Thisisanoptionalvalue.

    false none

    Ssl UseSSLConnections false none

    TofindoutallthepropertiesthataresupportedbythisMongoDBConnectorexecutethefollowingcommandintheCLI.

    /subsystem=teiid:read-rar-description(rar-name=mongodb)

    Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallyeditthe"

  • Tip install>/standalone/configuration/standalone-teiid.xml"fileandaddtheXMLconfigurationdefinedin"/docs/teiid/datasources/mongodb"directoryunder"resource-adapters"subsystem.Shutdowntheserverbeforeyoueditthisfile,andrestartafterthemodificationsaredone.

    DeployingVDBDependencies

    33

  • PhoenixDataSourcesThefollowingisaexampleforsettingupPhoenixDataSources,whichispreconditionforApachePhoenixTranslator.InadditiontotheDataSourcessetup,thisarticlealsocovermappingPhoenixtabletoanexistingHBasetableandcreatinganewPhoenixtable.

    ThereareconfigurationtemplatesforPhoenixdatasourcesinthe"/docs/teiid/datasources"directory.AcompletedescriptionhowadatasourcecanbeaddedintoWildFlyisalsodescribedhere.

    ConfiguringaPhoenixdatasourceinWildFly

    ConfiguringaPhoenixdatasourceisnearlyidenticaltoconfiguringJDBCDataSources.ThefirststepisdeployingthePhoenixdriverjar.UsingbelowCLIcommandtodeployPhoenixdriver:

    moduleadd--name=org.apache.phoenix--resources=/path/to/phoenix-[version]-client.jar--dependencies=javax.api,sun.jdk,org.apache.log4j,javax.transaction.api/subsystem=datasources/jdbc-driver=phoenix:add(driver-name=phoenix,driver-module-name=org.apache.phoenix,driver-class-name=org.apache.phoenix.jdbc.PhoenixDriver)

    TheDriverjarcanbedownloadfromphoenixdocument.

    ThesecondstepsiscreatingtheDataSourcebaseonabovedeployeddriver,whichisalsolikecreatingJDBCDataSource.UsingbelowCLIcommandtocreateDataSource:

    /subsystem=datasources/data-source=phoenixDS:add(jndi-name=java:/phoenixDS,driver-name=phoenix,connection-url=jdbc:phoenix:{zookeeperquorumserver},enabled=true,use-java-context=true,user-name={user},password={password})/subsystem=datasources/data-source=phoenixDS/connection-properties=phoenix.connection.autoCommit:add(value=true)

    PleasemakesuretheURL,Driver,andotherpropertiesareconfiguredcorrectly:

    jndi-name-TheJNDInameneedtomatchtheJNDInameyouusedinVDB

    driver-name-TheDrivernameneedtomatchthedriveryoudeployedinabovesteps

    connection-url-TheURLneedtomatchtheHBasezookeeperquorumserver,theformatlikejdbc:phoenix[:[:][:]],’jdbc:phoenix:127.0.0.1:2181’isaexample

    user-name/password-TheusercredentialsforPhoenixConnection

    ThePhoenixConnectionAutoCommitdefaultisfalse.Setphoenix.connection.autoCommittotrueifyouwillbeexecutingINSERT/UPDATE/DELETEstatementsagainstPhoenix.

    MappingPhoenixtabletoanexistingHBasetable

    MappingPhoenixtabletoanexistingHBasetablehas2steps.Thefirststepisinstallingphoenix-[version]-server.jartotheclasspathofeveryHBaseregionserver.AneasywaytodothisistocopyitintotheHBaselib-formoredetailspleaserefertothephoenixdocumentation.

    ThesecondstepisexecutingtheDDLtomapaPhoenixtabletoanexistingHBasetable.TheDDLcaneitherbeexecutedviaPhoenixCommandLine,orexecutedbyJDBC.

    DeployingVDBDependencies

    34

    https://docs.jboss.org/author/display/WFLY10/DataSource+configurationhttp://phoenix.apache.org/http://phoenix.apache.org/download.htmlhttp://phoenix.apache.org/download.html

  • TheFollowingisaexampleformappinganexistingHBaseCustomerwiththefollowingstructure:

    Asdepictedabove,theHBaseCustomertablehave2columnfamilies,customerandsales,andeachhas2columnqualifiers,name,city,productandamountrespectively.WecanmapthisTabletoPhoenixviaDDL:

    CREATETABLEIFNOTEXISTS"Customer"("ROW_ID"VARCHARPRIMARYKEY,"customer"."city"VARCHAR,"customer"."name"VARCHAR,"sales"."amount"VARCHAR,"sales"."product"VARCHAR)

    FormoreaboutmappingPhoenixtabletoanexistingHBasetablepleaserefertothephoenixdocumentation.

    CreatinganewPhoenixtable

    CreatinganewPhoenixtableisjustlikemappingtoanexistingHBasetable.Phoenixwillcreateanymetadata(table,columnfamilies)thatdonotexist.SimilartotheaboveexampletheDDLtocreatethePhoenix/HBaseCustomertablewouldbe:

    CREATETABLEIFNOTEXISTS"Customer"("ROW_ID"VARCHARPRIMARYKEY,"customer"."city"VARCHAR,"customer"."name"VARCHAR,"sales"."amount"VARCHAR,"sales"."product"VARCHAR)

    DefiningForeignTableinVDBFinally,weneeddefineaForeignTableinVDBthatmaptoPhoenixtable,thefollowingprinciplesshouldbeconsideredindefiningForeignTable:

    nameinsourceoptioninTableusedtomatchPhoenixtablename

    nameinsourceoptioninColumnusedtomatchHBaseTable’sColumns

    createaprimarykeyisrecommended,theprimarykeycolumnshouldmatchPhoenixtable’sprimarykey/HBaserowid.

    With"MappingPhoenixtabletoanexistingHBasetable"section’s`Customer'table,belowisaexample:

    CREATEFOREIGNTABLECustomer(PKstringOPTIONS(nameinsource'ROW_ID'),citystringOPTIONS(nameinsource'"city"'),namestringOPTIONS(nameinsource'"name"'),amountstringOPTIONS(nameinsource'"amount"'),productstringOPTIONS(nameinsource'"product"'),CONSTRAINTPK0PRIMARYKEY(PK))OPTIONS(nameinsource'"Customer"',"UPDATABLE"'TRUE');

    Note "Constraintviolation.Xmaynotbenull"exceptionmaythrownifupdatingatablewithoutdefiningaprimarykey.

    DeployingVDBDependencies

    35

    http://phoenix.apache.org/faq.html#How_I_map_Phoenix_table_to_an_existing_HBase_table

  • DeployingVDBDependencies

    36

  • SalesforceDataSourcesSalesforcedatasourcesuseaTeiidspecificJCAconnectorthatisdeployedintoWildFly10.0.0duringinstallation.Therearetwoversionsofthesalesforceresourceadapter-salesforce,whichcurrentlyprovidesconnectivitytothe22.0SalesforceAPIandsalesforce-34,whichprovidesconnectivitytothe34.0SalesforceAPI.Theversion22.0supporthasbeendeprecated.

    IfyouneedconnectivitytoanAPIversionotherthanwhatisbuiltin,pleaseutilizetheprojecthttps://github.com/teiid/salesforcetogeneratenewresourceadapter/translatorpair.

    Therearemanywaystocreatethesalesforcedatasource,usingCLI,AdminShell,admin-consoleetc.TheexampleshownbelowusestheCLItool,asthisworksinbothStandaloneandDomainmodes.

    ExecutefollowingcommandusingtheCLIonceyouconnectedtotheServer.MakesureyouprovidethecorrectURLandusercredentials.Addanyadditionalpropertiesrequiredbytheconnectorbyduplicatingthe"connection-definitions"commandbelow.EdittheJNDInametomatchtheJNDInameyouusedinVDB.

    batch/subsystem=resource-adapters/resource-adapter=salesforce/connection-definitions=sfDS:add(jndi-name=java:/sfDS,class-name=org.teiid.resource.adapter.salesforce.SalesForceManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=salesforce/connection-definitions=sfDS/config-properties=URL:add(value=https://www.salesforce.com/services/Soap/u/22.0)/subsystem=resource-adapters/resource-adapter=salesforce/connection-definitions=sfDS/config-properties=username:add(value={user})/subsystem=resource-adapters/resource-adapter=salesforce/connection-definitions=sfDS/config-properties=password:add(value={password})/subsystem=resource-adapters/resource-adapter=salesforce:activaterunbatch

    Thesalesforce-34connectiondefinitionconfigurationissimilartotheabove.Theresourceadapternamewouldinsteadbesalesforce-34,andtheurlwouldpointto34.0instead.

    TofindoutallthepropertiesthataresupportedbythisSalesforceConnectorexecutethefollowingcommandintheCLI.

    /subsystem=teiid:read-rar-description(rar-name=salesforce)

    Tip

    Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallyeditthe"/standalone/configuration/standalone-teiid.xml"fileandaddtheXMLconfigurationdefinedin*"/docs/teiid/datasources/salesforce"directoryunder"resource-adapters"subsystem.Shutdowntheserverbeforeyoueditthisfile,andrestartafterthemodificationsaredone.

    MutualAuthentication

    IfyouneedtoconnecttoSalesforceusingMutualAuthentication,followthedirectionstosetupSalesforceathttps://help.salesforce.com/apex/HTViewHelpDoc?id=security_keys_uploading_mutual_auth_cert.htm&language=en_USthenconfigurethebelowCXFconfigurationfileontheresource-adapterbyaddingfollowingpropertytoabovecliscript

    /subsystem=resource-adapters/resource-adapter=salesforce/connection-definitions=sfDS/config-properties=ConfigFile:add(value=${jboss.server.config.dir}/cxf-https.xml)

    cxf-https.xml

  • xmlns:sec="http://cxf.apache.org/configuration/security"xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"xsi:schemaLocation="http://cxf.apache.org/transports/http/configurationhttp://cxf.apache.org/schemas/configuration/http-conf.xsdhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsdhttp://cxf.apache.org/configuration/securityhttp://cxf.apache.org/schemas/configuration/security.xsd">

    moreinformationaboutCXFconfigurationfilecanbefoundathttp://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport(includingSSLsupport)-ConfiguringSSLSupport

    h==OAuthSecuritywith"RefreshToken"

    ThebelowlayoutthedirectionstouseRefreshTokenbasedOAuthAuthenticationwithSalesforce.

    1)createconnectedapp(mayneedtosetupcustomdomain)2)addprofileand/orpermissionssettotheconnectedapp3)grabthe"callbackurl"(oneneedtosetashttps://localhost:443/_callback"4)Runthroughtheteiid-oauth-util.shin"/bin"directory,useclient_id,client_pass,andcallbackfromconnectedapp5)use"https://login.salesforce.com/services/oauth2/authorize"authorizelink6)use"https://login.salesforce.com/services/oauth2/token"foraccesstokenurl7)theyougetarefreshtokenfromit8)createasecurity-domainbyexecutingCLI

    /subsystem=security/security-domain=oauth2-security:add(cache-type=default)/subsystem=security/security-domain=oauth2-security/authentication=classic:add/subsystem=security/security-domain=oauth2-security/authentication=classic/login-module=Kerberos:add(code=org.teiid.jboss.oauth.OAuth20LoginModule,flag=required,module=org.jboss.teiid.security,module-options=[client-id=xxxx,client-secret=xxxx,refresh-token=xxxx,access-token-uri=https://login.salesforce.com/services/oauth2/token])reload

    thiswillgeneratefollowingXMLinthestandalone.xmlordomain.xml(thiscanalsobedirectlyaddedtothestandalone.xmlordomain.xmlfilesinsteadofexecutingtheCLI)

    standalone.xml

    9)Thentousetheabovesecuritydomaininthesalesforcedatasourceconfiguration,add"oauth2-security"

    DeployingVDBDependencies

    38

    http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport(includingSSLsupport)-ConfiguringSSLSupporthttps://localhost:443/_callback

  • OAuthSecuritywith"JWTToken"basedSteps

    ThebelowlayoutthedirectionstouseJWTtokenbasedOAuthAuthenticationwithSalesforce.

    1)CreateaSelf-SignedcertificatelocallyoronSalesForce.(user→setup→security-controls→CertificateandKeyManagement)2)Downloadthecertificateandalsoputinkeystoreanddownloadkeystore.KeystoreisneededforTeiid,certificateforthesalesforcesetup3)CreateconnectedappandselectOAuth,andselectallthescopes(somepostssayrefresh-tokenofflineismust)4)createaprofileand/orpermissionsetassigntotheconnectedapp.Ibelievebeforeyoucancreateaconnectedappyouneedtosetupcustomdomain5)Whenyoucreatingconnectedappmakesureyouaddthecertificatein"DigitalCertificate"6)NowinTeiidcreatesecurity-domainbyexecutingCLI

    /subsystem=security/security-domain=oauth2-jwt-security:add(cache-type=default)/subsystem=security/security-domain=oauth2-jwt-security/authentication=classic:add/subsystem=security/security-domain=oauth2-jwt-security/authentication=classic/login-module=oauth:add(code=org.teiid.jboss.oauth.OAuth20LoginModule,flag=required,module=org.jboss.teiid.security,module-options=[client-id=xxxx,client-secret=xxxx,access-token-uri=https://login.salesforce.com/services/oauth2/token,jwt-audience=https://login.salesforce.com,[email protected],keystore-type=JKS,keystore-password=changeme,keystore-url=${jboss.server.config.dir}/salesforce.jks,certificate-alias=teiidtest,signature-algorithm-name=SHA256withRSA])reload

    thiswillgeneratefollowingXMLinthestandalone.xmlordomain.xml(thiscanalsobedirectlyaddedtothestandalone.xmlordomain.xmlfilesinsteadofexecutingtheCLI)

    standalone.xml

    7)Thentousetheabovesecuritydomaininthesalesforcedatasourceconfiguration,add"oauth2-jwt-security"

    Morehelpfullinks

    https://developer.salesforce.com/blogs/developer-relations/2011/03/oauth-and-the-soap-api.htmlhttps://help.salesforce.com/apex/HTViewHelpDoc?id=remoteaccess_oauth_jwt_flow.htm&language=en_US#create_tokenhttp://salesforce.stackexchange.com/questions/31904/how-and-when-does-a-salesforce-saml-oauth2-user-give-permission-to-use-

    DeployingVDBDependencies

    39

    https://developer.salesforce.com/blogs/developer-relations/2011/03/oauth-and-the-soap-api.htmlhttps://help.salesforce.com/apex/HTViewHelpDoc?id=remoteaccess_oauth_jwt_flow.htm&language=en_US#create_tokenhttp://salesforce.stackexchange.com/questions/31904/how-and-when-does-a-salesforce-saml-oauth2-user-give-permission-to-use-a-conne

  • a-connehttp://salesforce.stackexchange.com/questions/30596/oauth-2-0-jwt-bearer-token-flowhttp://salesforce.stackexchange.com/questions/88396/invalid-assertion-error-in-jwt-bearer-token-flow

    DeployingVDBDependencies

    40

    http://salesforce.stackexchange.com/questions/30596/oauth-2-0-jwt-bearer-token-flowhttp://salesforce.stackexchange.com/questions/88396/invalid-assertion-error-in-jwt-bearer-token-flow

  • SolrDataSourcesSolrdatasourcesuseaTeiidspecificJCAconnectorthatisdeployedintoWildFly10.0.0duringinstallation.TherearemanywaystocreateaSolrdatasource,usingCLI,AdminShell,admin-console,etc.TheexampleshownbelowusestheCLItool,asthisworksinbothStandaloneandDomainmodes.

    ExecutethefollowingcommandusingtheCLIonceyouconnectedtotheServer.MakesureyouprovidethecorrectURLandusercredentials.Addanyadditionalpropertiesrequiredbytheconnectorbyduplicatingthe"connection-definitions"commandbelow.EdittheJNDInametomatchtheJNDInameyouusedinVDB.

    batch/subsystem=resource-adapters/resource-adapter=solr/connection-definitions=solrDS:add(jndi-name=java:/solrDS,class-name=org.teiid.resource.adapter.solr.SolrManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=solr/connection-definitions=solrDS/config-properties=url:add(value=http://localhost:8983/solr/)/subsystem=resource-adapters/resource-adapter=solr/connection-definitions=solrDS/config-properties=CoreName:add(value=collection1)/subsystem=resource-adapters/resource-adapter=solr:activaterunbatch

    TofindoutallthepropertiesthataresupportedbythisSolrConnectorexecutethefollowingcommandintheCLI.

    /subsystem=teiid:read-rar-description(rar-name=solr)

    Tip

    Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallyeditthe"/standalone/configuration/standalone-teiid.xml"fileandaddtheXMLconfigurationdefinedin"/docs/teiid/datasources/solr"directoryunder"resource-adapters"subsystem.Shutdowntheserverbeforeyoueditthisfile,andrestartafterthemodificationsaredone.

    DeployingVDBDependencies

    41

    https://docs.jboss.org/author/display/WFLY10/Admin+Guide#AdminGuide-RunningtheCLI

  • WebServiceDataSourcesWebservicedatasourcesuseaTeiidspecificJCAconnectorthatisdeployedintoWildFly10.0.0duringinstallation.Therearemanywaystocreatethefiledatasource,usingCLI,AdminShell,admin-consoleetc.TheexampleshownbelowusestheCLItool,asthisworksinbothStandaloneandDomainmodes.

    ExecutefollowingcommandusingtheCLIonceyouconnectedtotheServer.Makesureyouprovidethecorrectendpointandotherpropertiesbelow.Addanyadditionalpropertiesrequiredbytheconnectorbyduplicatingthe"connection-definitions"commandbelow.EdittheJNDInametomatchtheJNDInameyouusedinVDB.

    batch/subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS:add(jndi-name=java:/wsDS,class-name=org.teiid.resource.adapter.ws.WSManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS/config-properties=EndPoint:add(value={end_point})/subsystem=resource-adapters/resource-adapter=webservice:activaterunbatch

    TofindoutallthepropertiesthataresupportedbythisWebServiceConnectorexecutethefollowingcommandintheCLI.

    /subsystem=teiid:read-rar-description(rar-name=webservice)

    TheWebServiceDataSourcesupportsspecifyingaWSDLusingtheWsdlproperty.IftheWsdlpropertyisset,thentheServiceName,EndPointName,andNamespaceUripropertiesshouldalsobeset.TheWsdlpropertymaybeaURLorfilelocationortheWSDLtouse.

    Tip

    Developer’sTip-IfWildFly10.0.0isrunninginstandalonemode,youcanalsomanuallyeditthe"/standalone/configuration/standalone-teiid.xml"fileandaddtheXMLconfigurationdefinedin*"/docs/teiid/datasources/web-service"directoryunder"resource-adapters"subsystem.Shutdowntheserverbeforeyoueditthisfile,andrestartafterthemodificationsaredone.

    Allavailableconfigurationpropertiesofwebresource-adapter

    PropertyName appliesto Required DefaultValue Description

    EndPoint HTTP&SOAP true n/aURLforHTTP,ServiceEndpointforSOAP

    SecurityType HTTP&SOAP false none

    TypeofAuthenticationtousedwiththewebservice.Allowedvalues["None","HTTPBasic","WSSecurity","Kerberos","OAuth"]

    AuthUserName HTTP&SOAP false n/aNamevalueforauthentication,usedinHTTPBasicandWsSecurity

    AuthPassword HTTP&SOAP false n/aPasswordvalueforauthentication,usedinHTTPBasicandWsSecurity

    ConfigFile HTTP&SOAP false n/a CXFclientconfigurationFileorURL

    EndPointName HTTP&SOAP false teiidLocalpartoftheendpointQNametousewiththisconnection,needstomatchonedefinedincxffile

    DeployingVDBDependencies

    42

    https://docs.jboss.org/author/display/WFLY10/Admin+Guide#AdminGuide-RunningtheCLI

  • ServiceName SOAP false n/a LocalpartoftheserviceQNametousewiththisconnection

    NamespaceUri SOAP false http://teiid.org NamespaceURIoftheserviceQNametousewiththisconnection

    RequestTimeout HTTP&SOAP false n/a Timeoutforrequest

    ConnectTimeout HTTP&SOAP false n/a Timeoutforconnection

    Wsdl SOAP false n/a WSDLfileorURLforthewebservice

    CXFConfiguration

    EachwebservicedatasourcemaychooseaparticularCXFconfigfileandportconfiguration.TheConfigFileconfigpropertyspecifiestheSpringXMLconfigurationfilefortheCXFBusandportconfigurationtobeusedbyconnections.Ifnoconfigfileisspecifiedthenthesystemdefaultconfigurationwillbeused.

    Only1portconfigurationcanbeusedbythisdatasource.YoumayexplicitlysetthelocalnameoftheportQNametouseviatheConfigNameproperty.ThenamespaceURIfortheQNameinyourconfigfileshouldmatchyourWSDL/namespacesettingonthedatasourceorusethedefaultofhttp://teiid.org.SeetheCXFDocumentationandthesectionsbelowonWS-Security,Logging,etc.forexamplesofusingtheCXFconfigurationfile.

    SampleSpringXMLConfigurationToSetTimeouts

    Intheconduitname\{http://teiid.org[http://teiid.org]}configName.http-conduit,thenamespace,\{http://teiid.org[http://teiid.org]},maybesetviathenamespacedatasourceproperty.Typicallythatwillonlyneeddonewhenalsosupplyingthewsdlsetting.Thelocalnameisfollowedby.http-conduit.ItwillbebasedupontheconfigNamesetting,withadefaultvalueofteiid.

    SeetheCXFdocumentationforallpossibleconfigurationoptions.

    Note ItisnotrequiredtousetheSpringconfigurationtosetjusttimeouts.TheConnectionTimeoutandReceiveTimeoutcanbesetviatheresourceadapterconnectTimeoutandrequestTimeoutpropertiesrespectively.

    Security

    DeployingVDBDependencies

    43

    http://teiid.orghttp://teiid.orghttp://cxf.apache.org/docs/configuration.htmlhttp://teiid.orghttp://teiid.orghttp://cxf.apache.org/docs/

  • ToenabletheuseofWS-Security,theSecurityTypeshouldbesettoWSSecurity.AtthistimeTeiiddoesnotexpectaWSDLtodescribetheservicebeingused.ThusaSpringXMLconfigurationfileisnotonlyrequired,itmustinsteadcontainalloftherelevantpolicyconfiguration.Andjustaswiththegeneralconfiguration,eachdatasourceislimitedtospecifyingonlyasingleportconfigurationtouse.

    batch/subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS:add(jndi-name=java:/wsDS,class-name=org.teiid.resource.adapter.ws.WSManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS/config-properties=ConfigFile:add(value=${jboss.server.home.dir}/standalone/configuration/xxx-jbossws-cxf.xml)/subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS/config-properties=ConfigName:add(value=port_x)/subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS/config-properties=SecurityType:add(value=WSSecurity)/subsystem=resource-adapters/resource-adapter=webservice:activaterunbatch

    Thecorrespondingxxx-jbossws-cxf.xmlfilethataddsatimestamptotheSOAPheader

    ExampleWS-Securityenableddatasource

    NotethattheclientportconfigurationismatchedtothedatasourceinstancebytheQName\{http://teiid.org[http://teiid.org]}port_x,wherethenamespacewillmatchyournamespacesettingorthedefaultofhttp://teiid.org.Theconfigurationmaycontainotherportconfigurationswithdifferentlocalnames.

    FormoreinformationonconfiguringCXFinterceptors,pleaseconsulttheCXFdocumentation

    KerberosWS-SecurityKerberosisonlysupportedwhentheWSDLpropertyisdefinedinresource-adapterconnectionconfigurationandonlywhenWSDLBasedProceduresareused.WSDLfilemustcontainWS-Policysection,thenWS-Policysectioniscorrectlyinterpretedandenforcedontheendpoint.ThesampleCXFconfigurationwilllooklike

    DeployingVDBDependencies

    44

    http://teiid.orghttp://teiid.orghttp://cxf.apache.org/docs/security.html

  • andyouwouldneedtoconfigurethesecurity-domaininthestandalone-teiid.xmlfileunderthe'security'subsystemas

    forcompletelistofkerberospropertiespleaserefertothistestcase

    LoggingTheCXFconfigpropertymayalsobeusedtocontroltheloggingofrequestsandresponsesforspecificorallports.Logging,whenenabled,willbeperformedatanINFOleveltotheorg.apache.cxf.interceptorcontext.

    Exampleloggingdatasource

    batch/subsystem=resource-adapters/resource-adapter=webservice/connection-

    DeployingVDBDependencies

    45

    http://anonsvn.jboss.org/repos/jbossws/stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/kerberos/KerberosTestCase.java

  • definitions=wsDS:add(jndi-name=java:/wsDS,class-name=org.teiid.resource.adapter.ws.WSManagedConnectionFactory,enabled=true,use-java-context=true)/subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS/config-properties=ConfigFile:add(value=${jboss.server.home.dir}/standalone/configuration/xxx-jbossws-cxf.xml)/subsystem=resource-adapters/resource-adapter=webservice/connection-definitions=wsDS/config-properties=ConfigName:add(value=port_x)/subsystem=resource-adapters/resource-adapter=webservice:activaterunbatch

    Correspondingxxx-jbossws-cxf.xml

    Exampleloggingdatasource

    TransportSettings

    TheCXFconfigpropertymayalsobeusedtocontrollowlevelaspectsoftheHTTPtransport.SeetheCXFdocumentationforallpossibleoptions.

    ExampleDisablingHostnameVerification

    ConfiguringSSLSupport(Https)ForusingtheHTTPS,youcanconfigureCXFfileasbelow

    DeployingVDBDependencies

    46

    http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html

  • forallthehttp-conduitbasedconfigurationseehttp://cxf.apache.org/docs/client-http-transport-including-ssl-support.html.YoucanalsoconfigureforHTTPBasic,kerberos,etc.

    DeployingVDBDependencies

    47

    http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html

  • KerberoswithRESTbasedServices

    Note "Kerberosinws-securitywithSOAPservices"-

    CheckoutthecxfconfigurationtoallowKerberosinSOAPwebservicesathttp://cxf.apache.org/docs/security.html

    ThekerberossupportisbasedSPNEGOasdescribedinhttp://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-SpnegoAuthentication%28Kerberos%29.Theretwotypesofkerberossupport

    Negotiation

    Withthisconfiguration,RESTserviceisconfiguredwithKerberosJAASdomain,tonegotiateatoken,thenuseitaccessthewebservice.Forthisfirstcreateasecuritydomaininstandalone.xmlfileasbelow

    andthejboss-cxf-xxx.xmlfileneedstobesetas

    NegotiateMY_REALM

    Theresourceadaptercreationneedstodefinethefollowingproperties

    path/to/jboss-cxf-xxxx.xmltest

    NoteEventhoughaboveconfigurationconfiguresthevalueof"ConfigName",thecxfframeworkcurrentlyinthecaseofJAX-RSclientdoesnotgiveoptiontouseit.Forthatreasonuse"*.http-conduit"whichwillapplytoalltheHTTPcommunicationsunderthisresourceadapter.

    DeployingVDBDependencies

    48

    http://cxf.apache.org/docs/security.htmlhttp://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-SpnegoAuthentication%28Kerberos%29

  • Delegation

    IfincasetheuserisalreadyloggedintoTeiidusingKerberosusingJDBC/ODBCorusedSPNEGOinweb-tierandusedpass-throughauthenticationintoTeiid,thenthereisnoneedtonegotiateanewtokenfortheKerberos.Thesystemcandelegatetheexistingtoken.

    Toconfigurefordelegation,setupsecuritydomaindefinedexactlyasdefinedin"negotiation",andjboss-cxf-xxx.xmlfile,howeverremovethefollowinglinefromjboss-cxf-xxx.xmlfile,asitisnotgoingtonegotiatenewtoken.

    MY_REALM

    Addthefollowingpropertiesinwebserviceresourceadaptercreation.Oneconfiguresthat"kerberos"securitybeingused,theseconddefinesasecuritydomaintobeusedatthedatasource,inthiscasewewanttouseasecuritydomainthatpassesthroughaloggedinuser

    Kerberospassthrough-security

    Toconfigurein"passthrough-security"securitydomain,the"security"subsystemaddfollowingXMLfragment

    IfincasethereisnodelegationCredentialisavailableonthecontext,theaccesswillfail.

    DeployingVDBDependencies

    49

  • OAuthAuthenticationWithRESTBasedServices

    SingleuserOAuthauthentication

    WebServicesresource-adaptercanbeconfiguredtoparticipateinOAuth1.0aandOAuth2authenticationschemes.UsingTeiidalongwith"ws"translatorand"web-services"resourceadapteroncewriteapplicationscommunicatingwithwebsiteslikeGoogleandTwitter.

    InordertosupportOAuthauthentication,thereissomepreparationandconfigurationworkinvolved.IndividualwebsitestypicallyprovidedeveloperfacingRESTbasedAPIsforaccessingtheircontentonthewebsitesandalsoprovidewaystoregistercustomapplicationsonuser’sbehalf,wheretheycanmanagetheAuthorizationofservicesofferedbythewebsite.Thefirststepistoregisterthiscustomapplicationonthewebsiteandcollectconsumer/APIkeysandsecrets.Theweb-siteswillalsolisttheURLS,wheretorequestforvariousdifferenttypesoftokensforauthorizationusingthesecredentials.AtypicalOAuthauthenticationflowisdefinedasbelow

    Theaboveimagetakenfromhttps://developers.google.com/accounts/docs/OAuth2

    Toaccommodateabovedefinedflow,Teiidprovidesautilitycalled"teiid-oauth-util.sh"or"teiid-oauth-util.bat"forwindowsinthe"bin"directoryofyourserverinstallation.Byexecutingthisutility,itwillaskforvariouskeys/secretsandURLsforthegeneratingtheAccessTokenthatisusedintheOAuthauthenticationandintheendoutputaXMLfragmentlikebelow.

    $./teiid-oauth-util.shSelecttypeofOAuthauthentication1)OAuth1.0A2)OAuth2.0

    2===OAuth2.0Workflow===

    DeployingVDBDependencies

    50

    http://oauth.orghttp://google.comhttp://twitter.comhttps://developers.google.com/accounts/docs/OAuth2

  • EntertheClientID=10-xxxjb.apps.googleusercontent.com

    EntertheClientSecret=3L6-xxx-v9xxDlznWq-o

    EntertheUserAuthorizationURL=https://accounts.google.com/o/oauth2/auth

    Enterscope(hitenterfornone)=profile

    Cut&PastetheURLinawebbrowser,andAuthticateAuthorizeURL=https://accounts.google.com/o/oauth2/auth?client_id=10-xxxjb.apps.googleusercontent.com&scope=profile&response_type=code&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&state=Auth+URL

    EnterTokenSecret(AuthCode,Pin)frompreviousstep=4/z-RT632cr2hf_vYoXd06yIM-xxxxx

    EntertheAccessTokenURL=https://www.googleapis.com/oauth2/v3/token

    RefreshToken=1/xxxx_5qzAF52j-EmN2U

    AddthefollowingXMLintoyourstandalone-teiid.xmlfileinsecurity-domainssubsystem,andconfiguredatasourcesecurtytothisdomain

    TheXMLfragmentattheenddefinestheJAASLoginModuleconfiguration,editthestandalone-teiid.xmlandadditunder"security-domains"subsystem.Userneedstousethissecurity-domainintheirresourceadapterasthesecurityproviderforthisdatasource.Anexampleresource-adapterconfigurationtodefinethedatasourcetothewebsiteinstandalone-teiid.xmlfilelookslike

    NoTransactionOAuth

    DeployingVDBDependencies

    51

  • oauth2-security

    ---

    Then,anyquerywrittenusingthe"ws"translatorandaboveresource-adapterwillbeautomaticallyAuthorizedwiththetargetwebsiteusingOAuth,whenyouaccessaprotectedURL.

    ===OAuthwithDelegation

    Intheaboveconfigurationasingleuserisconfiguredtoaccessthewebsite,howeverifyouwanttodelegateloggedinuser’scredentialasOAuthauthentication,thenuserneedstoextendtheaboveLoginModule_(org.teiid.jboss.oauth.OAuth20LoginModuleororg.teiid.jboss.oauth.OAuth10LoginModule)_andautomatetheprocessdefinedinthe"teiid-oauth-util.sh"todefinetheAccessTokendetailsdynamically.Sincethisprocesswillbedifferentfordifferentwebsites(itinvolvesloginandauthentication),Teiidwillnotbeabletoprovidesinglesolution.However,usercanextendtheloginmoduletoprovidethisfeaturemuchmoreeasilysincetheywillbeworkingwithtargetedwebsites.

    DeployingVDBDependencies

    52

  • VDBVersioningVDBVersioningisafeaturethatallowsmultipleversionsofaVDBtobedeployedatthesametimewithadditionalsupporttodeterminewhichversionwillbeused.Ifaspecificversionisrequested,thenonlythatVDBmaybeconnectedto.Ifnoversionisset,thenthedeployedVDBsaresearchedfortheappropriateversion.Thisfeaturehelpssupportmorefluidmigrationscenarios.

    VersionProperty

    WhenauserconnectstoTeiidthedesiredVDBversioncanbesetasaconnectionproperty(SeetheClientDeveloper’sGuide)inJDBCorusedaspartoftheVDBnameforODataandODBCaccess.

    Thevdbversionissetineitherthevdb.xml,whichisusefulforanxmlfiledeployment,orthroughanamingconventionofthedeploymentname-vdbname.version.vdb,e.g.marketdata.2.vdb.Thedeployerisresponsibleforchoosinganappropriateversionnumber.IfthereisalreadyaVDBname/versionthatmatchesthecurrentdeployment,thenconnectionstothepreviousVDBwillbeterminatedanditscacheentrieswillbeflushed.AnynewconnectionswillthenbemadetothenewVDB.

    AsimpleintegerversionactuallytreatedasthesemanticversionX.0.0.Ifdesiredafullsemanticversioncanbeusedinstead.Asemanticversionisuptothreeintegersseparatedbyperiods.

    Trailingversioncomponentsthataremissingaretreatedaszeros-version1isthesameas1.0.0andversion1.1isthesameas1.1.0.

    JDBCandODBCclientsmayuseaversionrestriction--vdbname.X.orvdbname.X.X.-notethetrailing'.'whichmeansaVDBthatmustmatchthepartialversionspecified.Forexamplevdbname.1.2.couldmatchany1.2.Xversion,butwouldnotallow1.3+or1.1andearlier.

    ConnectionTypeOncedeployedaVDBhasanupdatablepropertycalledconnectiontype,whichisusedtodeterminewhatconnectionscanbemadetotheVDB.Theconnectiontypecanbeoneof:

    NONE-disallownewconnections.

    BY_VERSION-thedefaultsetting.AllowconnectionsonlyiftheversionisspecifiedorifthisistheearliestBY_VERSIONvdbandtherearenovdbsmarkedasANY.

    ANY-allowconnectionswithorwithoutaversionspecified.

    TheconnectiontypemaybechangedeitherthroughtheAdminConsoleortheAdminAPI.

    DeploymentScenarios

    IfonlyaselectfewapplicationsaretomigratetothenewVDBversion,thenafreshlydeployedVDBwouldbeleftasBY_VERSION.Thisensuresthatonlyapplicationsthatknowthenewversionmayuseit.

    IfonlyaselectfewapplicationsaretoremainonthecurrentVDBversion,thentheirconnectionsettingswouldneedtobeupdatedtoreferencethecurrentVDBbyitsversion.ThenthenewlydeployedvdbwouldhaveitsconnectiontypesettoANY,whichallowsallnewconnectionstobemadeagainstthenewerversion.Ifarollbackisneededinthisscenario,thenthenewlydeployedvdbwouldhaveitsconnectiontypesettoNONEorBY_VERSIONaccordingly.

    VDBVersioning

    53

  • VDBVersioning

    54

  • LoggingTheTeiidsystemprovidesawealthofinformationvialogging.Tocontrollogginglevel,contexts,andloglocations,youshouldbefamiliarwithlog4jandthecontainer’sstandalone-teiid.xmlordomain-teiid.xmlconfigurationfilesdependinguponthestartupmodeofWildFly.

    AllthelogsproducedbyTeiidareprefixedby"org.teiid".ThismakesitextremelyeasytocontrolofofTeiidloggingfromasinglecontext.Notehoweverthatchangestothelogconfigurationfilemanuallyrequirearestarttotakeaffect.CLIbasedlogcontextmodificationsarepossible,howeverdetailsarebeyondthescopeofthisdocument.

    Ifyouexpectahighvolumeoflogginginformationoruseexpensivecustomaudit/commandloggers,itisagoodideatouseanaynchappendertominimizetheperformanceimpact.Forexampleyoucanuseaconfigurationsnippetliketheonebelowtoinsertanasynchhandlerinfrontofthetargetappender.

    LoggingContextsWhileallofTeiid’slogsareprefixedwith"org.teiid",therearemorespecificcontextsdependingonthefunctionalareaofthesystem.Notethatlogsoriginatingfromthird-partycode,includingintegratedorg.jbosscomponents,willbeloggedthroughtheirrespectivecontextsandnotthrough"org.teiid".SeethetablebelowforinformationoncontextsrelevanttoTeiid.Seethecontainer’sstandalone-teiid.xmlforamorecompletelistingofloggingcontextsusedinthecontainer.

    Context Description

    com.arjuna Third-partytransactionmanager.Thiswillincludeinformationaboutalltransactions,notjustthoseforTeiid.

    org.teiidRootcontextforallTeiidlogs.Note:therearepotentiallyothercontextsusedunderorg.teiidthanareshowninthistable.

    org.teiid.PROCESSORQueryprocessinglogs.Seealsoorg.teiid.PLANNERforqueryplanninglogs.

    Logging

    55

    http://logging.apache.org/log4j/

  • org.teiid.PLANNER Queryplanninglogs.

    org.teiid.SECURITY Session/Authenticationevents-seealsoAUDITlogging

    org.teiid.TRANSPORT Eventsrelatedtothesockettransport.

    org.teiid.RUNTIME Eventsrelatedtoworkmanagementandsystemstart/stop.

    org.teiid.CONNECTOR Connectorlogs.

    org.teiid.BUFFER_MGR Bufferandstoragemanagementlogs.

    org.teiid.TXN_LOG Detaillogofalltransactionoperations.

    org.teiid.COMMAND_LOG Seecommandlogging

    org.teiid.AUDIT_LOG Seeauditlogging

    org.teiid.ADMIN_API AdminAPIlogs.

    org.teiid.ODBC ODBClogs.

    CommandLogging

    CommandloggingcapturesexecutingcommandsintheTeiidSystem.Thisincludesusercommands(thathavebeensubmittedtoTeiidatanINFOlevel),datasourcecommands(thatarebeingexecutedbytheconnectorsataDEBUGlevel),andqueryplans(ataTRACElevel)aretrackedthroughcommandlogging.

    Theusercommand,"STARTUSERCOMMAND",isloggedwhenTeiidstartsworkingonthequeryforthefirsttime.Thisdoesnotincludethetimethequerywaswaitinginthequeue.Andacorrespondingusercommand,"ENDUSERCOMMAND",isloggedwhentherequestiscomplete(i.e.whenstatementisclosedorallthebatchesareretrieved).Thereisonlyonepairoftheseforeveryuserquery.

    Thequeryplancommand,"PLANUSERCOMMAND",isloggedwhenTeiidfinishesthequeryplanningprocess.Thereisnocorrespondingendinglogentry,butwithtraceloggingenabledthequeryplanwillbeincludedwithsubsequentusercommandevents.

    Thedatasourcecommand,"STARTDATASRCCOMMAND",isloggedwhenaqueryissenttothedatasource.Andacorrespondingdatasourcecommand,"ENDSRCCOMMAND",isloggedwhentheexecutionisclosed(i.ealltherowshasbeenread).TherecanbeonepairforeachdatasourcequerythathasbeenexecutedbyTeiid,andtherecanbeanynumberofpairsdependinguponyouruserquery.

    TheSRCcommanditselfisthentranslatedinto1ormoresourcestatements,operations,etc.Forsourcesthathavetextualrepresentationsofthenativesourcequery,eachwillbereportedina"SOURCESRCCOMMAND"eventasattheDEBUGlevelwiththefieldsourceCommandrepresentingtheSQL,SOQL,LDAPqueryetc.thatisactuallyissued.

    Withthisinformationbeingcaptured,theoverallqueryexecutiontimeinTeiidcanbecalculated.Additionally,eachsourcequeryexecutiontimecanbecalculated.Iftheoverallqueryexecutiontimeisshowingaperformanceissue,thenlookateachdatasourceexecutiontimetoseewheretheissuemaybe.

    Toenablecommandloggingtothedefaultloglocation,simplyenabletheDETAILlevelofloggingfortheorg.teiid.COMMAND_LOGcontext.

    Logging

    56

  • Note "Wanttologtoadatabase?"-IfyouwouldliketologCommandlogmessagestoanydatabase,thenlookatthehttps://github.com/teiid/teiid-extensionsproject.TheinstallationzipfileisavailableinTeiiddownloadspage.

    Toenablecommandloggingtoanalternativefilelocation,configureaseparatefileappenderfortheDETAILloggingoftheorg.teiid.COMMAND_LOGcontext.Anexampleofthisisshownbelowandcanalsobefoundinthestandalone-teiid.xmldistributedwithTeiid.

    SeetheDeveloper’sGuidetodevelopacustomloggingsolutioniffilebasedlogging,oranyotherbuilt-inLog4jlogging,isnotsufficient.

    Thefollowingisanexampleofadatasourcecommandandwhatonewouldlooklikewhenprintedtothecommandlog:

    2012-02-2216:01:53,712DEBUG[org.teiid.COMMAND_LOG](Worker1_QueryProcessorQueue11STARTDATASRCCOMMAND:startTime=2012-02-2216:01:53.712requestID=Ku4/dgtZPYk0.5sourceCommandID=4txID=nullmodelName=DTHCPtranslatorName=jdbc-simplesessionID=Ku4/dgtZPYk0principal=user@teiid-securitysql=HCP_ADDR_XREF.HUB_ADDR_ID,CPN_PROMO_HIST.PROMO_STAT_DTFROMCPN_PROMO_HIST,HCP_ADDRESS,HCP_ADDR_XREFWHERE(HCP_ADDRESS.ADDR_ID=CPN_PROMO_HIST.SENT_ADDR_ID)AND(HCP_ADDRESS.ADDR_ID=HCP_ADDR_XREF.ADDR_ID)AND(CPN_PROMO_HIST.PROMO_STAT_CDNOTLIKE'EMAIL%')AND(CPN_PROMO_HIST.PROMO_STAT_CD'SENT_EM')AND(CPN_PROMO_HIST.PROMO_STAT_DT>{ts'2010-02-2216:01:52.928'})

    Notethefollowingpiecesofinformation:

    modelName:thisrepresentsthephysicalmodelforthedatasourcethatthequeryisbeingissued.

    translatorName:showstypeoftranslatorusedtocommunicatetothedatasource.

    principal:showstheuseraccountwhosubmittedthequery

    startTime/endTime:thetimeoftheaction,whichisbasedonthetypecommandbeingexecuted.

    sql:isthecommandsubmittedtotheengineortothetranslatorforexecution-whichisNOTnecessarilythefinalsqlcommandsubmittedtotheactualdatasource.Butitdoesshowwhatthequeryenginedecidedtopushdown.

    ENDeventswilladditionallycontain:

    finalRowCount:thenumberofrowsreturnedtotheenginebythesourcequery.

    cpuTime:thenumberofnanosecondsofcputimeusedbythesourcecommand.Canbecomparedt