0

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
Debashis
  • 81
  • 1
  • 9

1 Answers1

0

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.
Ramesh Reddy
  • 554
  • 1
  • 3
  • 8
  • Tried the above approach, also added the logging level for teiid-jdbc. teiid.jdbc-enable=true logging.level.org.teiid.jdbc=DEBUG. But now I'm getting this error message from Squirrel Client - `Unexpected Error occurred attempting to open an SQL connection. class java.net.ConnectException: Connection refused: connect` – Debashis Jul 11 '19 at 16:56
  • is there any username/password for this type of connection? @RameshReddy – Debashis Jul 11 '19 at 17:09
  • Got it. Changed localhost to my IP and also I had to provide ApplicationName=JDBC. Thank you all – Debashis Jul 11 '19 at 17:19
  • ApplicationName=JDBC is not required, no user/password by default as it is embedded engine you built, of course you can add security layer if you want. If you want a full-blown server model also take look at WildFly based Teiid, where there is no need for Java code, it is all configuration and DDL for your VDB. – Ramesh Reddy Jul 11 '19 at 17:52
  • Is there any way we can change the bean name 'datasource' created automatically by Teiid. I have an application which already has a 'datasource' bean. – Debashis Jul 16 '19 at 10:30
  • using the 'datasource' as the name for the bean is the only way to tie it back into the whole spring-data framework, so no. When Teiid is being used it is a primary assumption that all communications to other sources is happening through Teiid API not directly to the data source. If you have a choice to reconfigure existing data source, define its configuration with `spring.datasource.xxx.url` where xxx is the new name.Like here https://github.com/teiid/teiid-spring-boot/blob/master/samples/rdbms/src/main/java/org/teiid/spring/example/DataSources.java – Ramesh Reddy Jul 16 '19 at 14:15
  • After adding two beans now Teiid server is trying to connect to my MariaDB database, whereas it should pick its own datasource configuration. Please help Ramesh Reddy. ```Caused by: org.teiid.deployers.VirtualDatabaseException: TEIID40095 TEIID31070 Empty model;There are no tables, procedures or functions defined in this model bdsDatasource``` – Debashis Aug 16 '19 at 11:36
  • The error is saying that, there were no tables or procedures found in your added database to integrate with name `bdsDatasource`, there needs at least a single table. If you think there are tables, then sometimes setting the "schema" name for datasource helps. add `spring.datasource.bdsDatasource.importer.schemaName=foo" to your application.properties. See all the import proeprties to customize here http://teiid.github.io/teiid-documents/master/content/reference/JDBC_Translators.html – Ramesh Reddy Aug 16 '19 at 15:44
  • Didn't work! I don't want Teiid to connect to my bdsDatasource. I want Teiid datasource to be separate from my bdsDatasource. Is there any way of doing this? – Debashis Aug 17 '19 at 14:28