Search code examples
javaspring-bootsquirrel-sqlteiid

Connecting Squirrel Client to Embedded Teiid Server


I have a Spring Boot project, on which I have some csv files and have converted them into entities and querying them based on my requirement. For this approach, I am using Teiid Spring Boot Starter, which is starting a embedded server -

This is the console startup log -

Starting embedded database: url='jdbc:teiid:spring;PassthroughAuthentication=true;useCallingThread=true;autoFailover=true;waitForLoad=5000;autoCommitTxn=OFF;disableLocalTxn=true', username='null' ````

pom.xml


    <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-jpa</artifactId>
            </dependency>
            <dependency>
                <groupId>org.teiid</groupId>
                <artifactId>teiid-spring-boot-starter</artifactId>
                <version>1.1.0</version>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>com.teiid</groupId>
                <artifactId>teiid-12.1.1-jdbc</artifactId>
                <version>12.2.1</version>
                <scope>system</scope>
                <systemPath>${project.basedir}/src/main/resources/teiid-12.2.1-jdbc.jar</systemPath>
            </dependency>

        </dependencies>

application.properties


    spring.application.name=Teiid-spring-boot

    spring.teiid.model.package=com.example.demo.model
    spring.teiid.file.parent-directory=src/main/resources/csv

    #######
    logging.level.org.teiid.spring=TRACE


    spring.main.allow-bean-definition-overriding=true
    spring.jpa.show-sql=true
    spring.jpa.properties.hibernate.format_sql=true

I have Squirrel SQL client setup, have added the driver for Teiid as well. teiid-12.2.1-jdbc.jar

Squirrel SQL connection settings used -

name - Teiid
example url - jdbc:teiid:spring
website url - http://teiid.org

But while connecting, getting this following error -

teiid: JDBC Driver class not found
class java.lang.ClassNotFoundException: org.jboss.modules.ModuleLoadException

Solution

  • There are multiple issues that need to be fixed.

    1. You do not need the teiid-12.1.1-jdbc dependency in pom.xml
    2. Add teiid.jdbc-enable=true to your application.properties that will open a jdbc port 31000 for the application you built.
    3. Run your application
    4. Then add the Teiid JDBC driver to SquirreL (which you seemed to be already done)
    5. Use the URL as jdbc:teiid:spring@mm://localhost:31000 where localhost is host where you are running your teiid-spring application.