lidavidm commented on code in PR #607:
URL: https://github.com/apache/arrow-adbc/pull/607#discussion_r1177199397


##########
java/driver/jdbc/src/main/java/org/apache/arrow/adbc/driver/jdbc/JdbcDataSourceDatabase.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.adbc.driver.jdbc;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Objects;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.sql.DataSource;
+import org.apache.arrow.adbc.core.AdbcConnection;
+import org.apache.arrow.adbc.core.AdbcDatabase;
+import org.apache.arrow.adbc.core.AdbcException;
+import org.apache.arrow.adbc.sql.SqlQuirks;
+import org.apache.arrow.memory.BufferAllocator;
+
+/** An instance of a database based on a {@link DataSource}. */
+public final class JdbcDataSourceDatabase implements AdbcDatabase {
+  private final BufferAllocator allocator;
+  private final DataSource dataSource;
+  private final String username;
+  private final String password;
+  private final SqlQuirks quirks;
+  private final Connection connection;
+  private final AtomicInteger counter;
+
+  JdbcDataSourceDatabase(
+      BufferAllocator allocator,
+      DataSource dataSource,
+      String username,
+      String password,
+      SqlQuirks quirks)
+      throws AdbcException {
+    this.allocator = Objects.requireNonNull(allocator);
+    this.dataSource = Objects.requireNonNull(dataSource);
+    this.username = username;
+    this.password = password;
+    this.quirks = Objects.requireNonNull(quirks);
+    try {
+      this.connection = dataSource.getConnection();
+    } catch (SQLException e) {

Review Comment:
   JDBC provides multiple paths; you can also embed that info in the URIs 
themselves. Previously that was the only way exposed. But while I was here I 
decided to just hook up this path too.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to