davisusanibar commented on code in PR #229: URL: https://github.com/apache/arrow-cookbook/pull/229#discussion_r923957685
########## java/source/io.rst: ########## @@ -444,6 +444,176 @@ Reading Parquet File Please check :doc:`Dataset <./dataset>` +Reading JDBC ResultSets +*********************** + +The `Arrow Java JDBC module <https://arrow.apache.org/docs/java/jdbc.html>`_ +help us to convert JDBC ResultSets objects into columnar arrow format objects +through Arrow VectorSchemaRoots. + +ResultSet to VectorSchemaRoot Conversion +---------------------------------------- + +The main class to help us to convert ResultSet to VectorSchemaRoot is +`JdbcToArrow <https://arrow.apache.org/docs/java/reference/org/apache/arrow/adapter/jdbc/JdbcToArrow.html>`_ + +.. testcode:: + + import org.apache.arrow.adapter.jdbc.ArrowVectorIterator; + import org.apache.arrow.adapter.jdbc.JdbcToArrow; + import org.apache.arrow.memory.BufferAllocator; + import org.apache.arrow.memory.RootAllocator; + import org.apache.arrow.vector.VectorSchemaRoot; + import org.h2.jdbcx.JdbcConnectionPool; + + import java.io.IOException; + import java.sql.ResultSet; + import java.sql.SQLException; + + try (BufferAllocator allocator = new RootAllocator()) { + JdbcConnectionPool pool = JdbcConnectionPool.create( + "jdbc:h2:zip:./thirdpartydeps/database/jdbc-cookbook.zip!/test", + "sa", ""); + ResultSet resultSet = pool.getConnection().createStatement().executeQuery( Review Comment: Added -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org