Application only connects to a single database (because of the name)

12 views
Skip to first unread message

junior manzini

unread,
Sep 14, 2019, 12:00:20 PM9/14/19
to jOOQ User Group
Hello everyone! I really need your help.
I took on a project from another developer, your app seemed to work perfectly, but we noticed that jooq tables were generated
specifically for a database; In this case, the database called "bedel" seems to have a dependency that if it is not called bedel the connection is not made, when examining pom vi that there is no code generation, the database information that this accurate application comes from
 machine environment variables.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.speedsoft</groupId>
<artifactId>bedelServer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<!-- <packaging>jar</packaging>-->
<packaging>war</packaging>

<name>bedel</name>

<description>BWS</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>


<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<java.version>1.8</java.version>
<quartz.version>2.2.1</quartz.version>
<jooq.version>3.9.1</jooq.version>
<logback.version>1.2.3</logback.version>
<logbackaccess.version>1.3.0-alpha4</logbackaccess.version>
<mysql.version>6.0.3</mysql.version>
<exec-maven-plugin>1.7</exec-maven-plugin>

<start-class>com.speedsoft.bws.BwsApplication</start-class>
</properties>

<dependencies>

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


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


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

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

<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>${quartz.version}</version>
</dependency>

<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-jobs</artifactId>
<version>${quartz.version}</version>
</dependency>

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

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>

<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>${jooq.version}</version>
</dependency>

<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta</artifactId>
<version>${jooq.version}</version>
</dependency>

<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen</artifactId>
<version>${jooq.version}</version>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>2.0.6.RELEASE</version>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
<version>${logbackaccess.version}</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.3.1</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.9</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.0.1</version>
</dependency>

</dependencies>


<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>


</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<configuration>
<mainClass>com.speedsoft.bws.BwsApplication</mainClass>
</configuration>


</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>

<!--plugin exe-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>

</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>

<!-- inserida para teste -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
</includes>

</resource>
</resources>
</build>
</project>
Digite o código aqui...


How can I fix this and make my code work even if the database has a different name? Thank you very much

Simon Niederberger

unread,
Sep 15, 2019, 2:39:46 AM9/15/19
to jooq...@googlegroups.com
You are using a Spring Boot setup, so your database connection is most likely defined in a properties file names either application.properties or application.yml. If not, look for a @Configuration class defining a Datasource instance.


--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/7f9c3335-dc4a-4007-93f4-ea790fd6b679%40googlegroups.com.

junior manzini

unread,
Sep 15, 2019, 1:25:19 PM9/15/19
to jOOQ User Group

Simon, thanks for the answer, yes, in my application properties there are these settings
#ENVIRONMENT
bws.database.server=${BWS_DATABASE_SERVER}
bws.database.name=${BWS_DATABASE_NAME}
bws.database.user=${BWS_DATABASE_USER}
bws.database.password=${BWS_DATABASE_PASSWORD}
bws.database.port=${BWS_DATABASE_PORT}
bws.codigo.escola=${BWS_CODIGO_ESCOLA}
bws.driver.connection=${BWS_DATABASE_DRIVER}
bws.update.time=${BWS_UPDATE_TIME}
bws.log.level=${BWS_LOG_LEVEL}
bws.security.key=${BWS_SECRETKEY}
bws.safepayload.option=${BWS_SAFE_PAYLOADS}
bws.access.key=${BWS_ACCESSKEY}
bws.page.size=${BWS_PAGE_SIZE}
bws.export.periodo = ${BWS_EXPORT_PERIODO}
bws.export.fotos=${BWS_EXPORT_FOTOS}


jooq.jpg

As you can see, it is configured to receive information from environment variables, but it is no use changing the name of the database to another existing database, 
only connects to that one.

the other databases I need the application to connect to are exactly the same as this one, the only difference is the database name, what do I do / change to be able to adjust this?
Thanks
ee that inside my generated tables I have a class with the name of the bank I mentioned

junior manzini

unread,
Sep 15, 2019, 10:55:52 PM9/15/19
to jOOQ User Group
It's Ok Now
Thanks []

Em sábado, 14 de setembro de 2019 13:00:20 UTC-3, junior manzini escreveu:
Reply all
Reply to author
Forward
0 new messages