You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "aldettinger (via GitHub)" <gi...@apache.org> on 2023/04/06 14:24:07 UTC

[GitHub] [camel-quarkus] aldettinger commented on a diff in pull request #4751: Ref#4596 Cover different db types for jdbc

aldettinger commented on code in PR #4751:
URL: https://github.com/apache/camel-quarkus/pull/4751#discussion_r1159871774


##########
integration-tests/jdbc/src/main/java/org/apache/camel/quarkus/component/jdbc/CamelResource.java:
##########
@@ -53,33 +62,23 @@ public class CamelResource {
     @Inject
     CamelContext context;
 
+    @ConfigProperty(name = "quarkus.datasource.cameldb.db-kind")
+    String dbKind;
+
     @PostConstruct
     void postConstruct() throws Exception {
-        try (Connection con = dataSource.getConnection()) {
-            try (Statement statement = con.createStatement()) {
-                try {
-                    statement.execute("drop table camels");
-                    statement.execute("drop table camelsGenerated");
-                } catch (Exception ignored) {
-                }
-                statement.execute("create table camels (id int primary key, species varchar(255))");
-                statement.execute("create table camelsGenerated (id int primary key auto_increment, species varchar(255))");
-                statement.execute("create table camelsProcessed (id int primary key auto_increment, species varchar(255))");
-                statement.execute("insert into camelsGenerated (species) values ('Camelus status'), ('Camelus linus')");
-                statement.execute("insert into camels (id, species) values (1, 'Camelus dromedarius')");
-                statement.execute("insert into camels (id, species) values (2, 'Camelus bactrianus')");
-                statement.execute("insert into camels (id, species) values (3, 'Camelus ferus')");
-
-                context.getRouteController().startRoute("jdbc-poll");
-            }
-        }
+        runScripts("droptables.sql");

Review Comment:
   Is it useful to open a connection on each runScripts call ? Maybe we could pass the connection as argument to runScript ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org