【问题标题】:Connecting Squirrel Client to Embedded Teiid Server将 Squirrel 客户端连接到嵌入式 Teiid 服务器
【发布时间】:2019-07-09 13:35:36
【问题描述】:

我有一个 Spring Boot 项目,其中有一些 csv 文件,并将它们转换为实体并根据我的要求查询它们。对于这种方法,我使用的是 Teiid Spring Boot Starter,它正在启动一个嵌入式服务器 -

这是控制台启动日志 -

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

我安装了 Squirrel SQL 客户端,也添加了 Teiid 的驱动程序。 teiid-12.2.1-jdbc.jar

使用 Squirrel SQL 连接设置 -

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

但在连接时,出现以下错误 -

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

【问题讨论】:

    标签: java spring-boot squirrel-sql teiid


    【解决方案1】:

    有多个问题需要解决。

    1. 您不需要 pom.xml 中的 teiid-12.1.1-jdbc 依赖项
    2. teiid.jdbc-enable=true 添加到您的application.properties,这将为您构建的应用程序打开一个jdbc 端口31000
    3. 运行您的应用程序
    4. 然后将 Teiid JDBC 驱动程序添加到 SquirreL(您似乎已经完成了)
    5. 将 URL 用作 jdbc:teiid:spring@mm://localhost:31000,其中 localhost 是您运行 teiid-spring 应用程序的主机。

    【讨论】:

    • 尝试了上面的方法,还添加了teiid-jdbc的日志级别。 teiid.jdbc-enable=true logging.level.org.teiid.jdbc=DEBUG。但现在我从 Squirrel Client 收到了这条错误消息 - Unexpected Error occurred attempting to open an SQL connection. class java.net.ConnectException: Connection refused: connect
    • 这种类型的连接有用户名/密码吗? @RameshReddy
    • 知道了。将 localhost 更改为我的 IP,我还必须提供 ApplicationName=JDBC。谢谢大家
    • ApplicationName=JDBC 不是必需的,默认没有用户名/密码,因为它是您构建的嵌入式引擎,当然您可以根据需要添加安全层。如果你想要一个成熟的服务器模型,还可以看看基于 WildFly 的 Teiid,它不需要 Java 代码,它是 VDB 的所有配置和 DDL。
    • 有什么方法可以改变 Teiid 自动创建的 bean 名称“数据源”。我有一个应用程序,它已经有一个“数据源”bean。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-17
    • 1970-01-01
    相关资源
    最近更新 更多