| Level | Technologies | Target Product | Product Versions | Source |
|---|---|---|---|---|
Beginners |
Teiid, JDBC, Spark SQL |
DV |
DV 6.1 |
Spark SQL can read data from other databases using JDBC. The Spark SQL Client demonstrates how to use Spark SQL to read data from VDB.
The program expects four arguments . The pom.xml defines these arguments in the pom.xml:
<mainClass>SparkSQLClient</mainClass>
<arguments>
<argument>localhost</argument> <!-- host -->
<argument>31000</argument> <!-- port -->
<argument>${vdb}</argument>
<argument>${table}</argument> <!-- table or view defined in VDB -->
</arguments>|
Note
|
Notice that the and are preset. To point to a different server and/or port, change "localhost" and/or "31000" arguments, respectively, in the pom.xml. |
To execute a sql query using the simpleclient, use the following format:
mvn exec:java -Dvdb="<vdb>" -Dtable="<table>" -Dusername="<username>" -Dpassword="<password>"A Example Executions
mvn exec:java -Dvdb="twitter" -Dtable="tweet"
mvn exec:java -Dvdb="Portfolio" -Dtable="product"
mvn exec:java -Dvdb="ExcelVDB" -Dtable="PersonalHoldings"