Skip to content

Commit

Permalink
TEIID-3412: add steup ucanaccess datasource docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kylinsoong authored and shawkins committed Apr 21, 2015
1 parent ead8f25 commit 31403a6
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 309 deletions.
@@ -0,0 +1,9 @@
# The value of 'driver-module-name' match to the ucanaccess driver module added in JBoss server
/subsystem=datasources/jdbc-driver=ucanaccess:add(driver-name=ucanaccess,driver-module-name=net.ucanaccess,driver-class-name=net.ucanaccess.jdbc.UcanaccessDriver)

/subsystem=datasources/data-source=ucanaccessDS:add(jndi-name=java:/ucanaccessDS, driver-name=ucanaccess, enabled=true,use-java-context=true, connection-url=jdbc:ucanaccess://{<mdb or accdb file path>},user-name={user}, password={password})

/subsystem=datasources/data-source=ucanaccessDS:test-connection-in-pool()

## If you are working in a clustered environment, prepend "/profile=ha" to all the above commands that start with "/subsystem=.."

@@ -0,0 +1,17 @@
<?xml version="1.0" ?>

<module xmlns="urn:jboss:module:1.1" name="net.ucanaccess">

<resources>
<resource-root path="ucanaccess-[version].jar"/>
<resource-root path="hsqldb.jar"/>
<resource-root path="jackcess-[version].jar"/>
<resource-root path="commons-lang-[version].jar"/>
<resource-root path="commons-logging-[version].jar"/>
</resources>

<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
28 changes: 28 additions & 0 deletions build/kits/jboss-as7/docs/teiid/datasources/ucanaccess/readme.txt
@@ -0,0 +1,28 @@
There are two parts to creating a datasource, depending upon whether this is the first time you are doing this,
you can skip the deploying JDBC driver for the database, if you have previously already done this.

Note that all instances of [version] should be replaced by the appropriate ucanaccess and it's dependency version.

Step 1: Installing the Driver Module

1) Download ucanaccess 2.0.9.4 or later(https://sourceforge.net/projects/ucanaccess/files/)

2) Overlay the "modules" directory on the "<jboss-as>/modules" directory

3) Unzip 1) will get 5 jars(ucanaccess-[version].jar,hsqldb.jar,jackcess-[version].jar,commons-lang-[version].jar,commons-logging-[version].jar), copy all these jars into the "<jboss-as>/modules/org/apache/phoenix/main" directory.

4) Start server

Step 2: Creating the datasource

Option 1: Edit the standalone-teiid.xml or domain-teiid.xml file and add contents of the "ucanaccess.xml"
file under the "datasources" subsystem. You may have to edit contents according to where your Access File
is located and credentials you need to use to access it.

Option 2: Take a look at create-ucanaccess-ds.cli script, and modify and execute using JBoss CLI tool as below

./bin/jboss-cli.sh --connect --file=create-ucanaccess-ds.cli

Option 3: Deploy ucanaccess-ds.xml file. You may have to edit contents according to where your Access File
is located and credentials you need to use to access it.

@@ -0,0 +1,16 @@
<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
<datasources>
<datasource jndi-name="java:jboss/datasources/ucanaccessDS" enabled="true" use-java-context="true" pool-name="ucanaccessDS">
<connection-url>jdbc:ucanaccess://{<mdb or accdb file path>}</connection-url>
<driver>ucanaccess</driver>
<security>
<user-name>{user}</user-name>
<password>{password}</password>
</security>
</datasource>
<drivers>
<driver name="ucanaccess" module="net.ucanaccess">
<driver-class>net.ucanaccess.jdbc.UcanaccessDriver</driver-class>
</driver>
</drivers>
</datasources>
@@ -0,0 +1,21 @@
<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
<subsystem xmlns="urn:jboss:domain:datasources:1.2">
<datasources>
<datasources>
<datasource jndi-name="java:jboss/datasources/ucanaccessDS" enabled="true" use-java-context="true" pool-name="ucanaccessDS">
<connection-url>jdbc:ucanaccess://{<mdb or accdb file path>}</connection-url>
<driver>ucanaccess</driver>
<security>
<user-name>{user}</user-name>
<password>{password}</password>
</security>
</datasource>
<drivers>
<driver name="ucanaccess" module="net.ucanaccess">
<driver-class>net.ucanaccess.jdbc.UcanaccessDriver</driver-class>
</driver>
</drivers>
</datasources>
</subsystem>


17 changes: 1 addition & 16 deletions connectors/translator-jdbc/pom.xml
Expand Up @@ -36,22 +36,7 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-runtime</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.btm</groupId>
<artifactId>btm</artifactId>
<scope>test</scope>
</dependency>
</dependency>
</dependencies>

<build>
Expand Down
@@ -1,3 +1,24 @@
/*
* JBoss, Home of Professional Open Source.
* See the COPYRIGHT.txt file distributed with this work for information
* regarding copyright ownership. Some portions may be licensed
* to Red Hat, Inc. under one or more contributor license agreements.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
package org.teiid.translator.jdbc.ucanaccess;


Expand All @@ -21,6 +42,8 @@
@Translator(name="ucanaccess", description="A translator for read/write Microsoft Access Database")
public class UCanAccessExecutionFactory extends HsqlExecutionFactory {

public static final String UCANACCESS = "ucanaccess"; //$NON-NLS-1$

public UCanAccessExecutionFactory() {
setSupportsOrderBy(true);
setMaxInCriteriaSize(JDBCExecutionFactory.DEFAULT_MAX_IN_CRITERIA);
Expand All @@ -31,7 +54,13 @@ public UCanAccessExecutionFactory() {
public void start() throws TranslatorException {
super.start();

addPushDownFunction("ucanaccess", "DCount", TypeFacility.RUNTIME_NAMES.BIG_INTEGER, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING);
addPushDownFunction(UCANACCESS, "DCount", TypeFacility.RUNTIME_NAMES.BIG_INTEGER, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING);
addPushDownFunction(UCANACCESS, "DSum", TypeFacility.RUNTIME_NAMES.BIG_INTEGER, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING);
addPushDownFunction(UCANACCESS, "DMax", TypeFacility.RUNTIME_NAMES.INTEGER, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING);
addPushDownFunction(UCANACCESS, "DMin", TypeFacility.RUNTIME_NAMES.BIG_INTEGER, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING);
addPushDownFunction(UCANACCESS, "DAvg", TypeFacility.RUNTIME_NAMES.BIG_INTEGER, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING);
addPushDownFunction(UCANACCESS, "DFirst", TypeFacility.RUNTIME_NAMES.OBJECT, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING);
addPushDownFunction(UCANACCESS, "DLast", TypeFacility.RUNTIME_NAMES.OBJECT, TypeFacility.RUNTIME_NAMES.STRING, TypeFacility.RUNTIME_NAMES.STRING);
}

@Override
Expand Down Expand Up @@ -83,11 +112,6 @@ public InputStream getInputStream() throws IOException {

return super.retrieveValue(results, columnIndex, expectedType);
}

@Override
public String getHibernateDialectClassName() {
throw new IllegalStateException("UCanAccess Dialect not set"); //$NON-NLS-1$
}

@Override
public boolean supportsDependentJoins() {
Expand Down

0 comments on commit 31403a6

Please sign in to comment.