Execute the following command from PowerShell or DOS to check the Java execution environment.
PS C:\> java -version
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
If it is not installed, please download and install the JDK from the link below.
Download the evaluation build from the following site.
Launch the "setup.jar" file in the downloaded ZIP file. (Note) Since online activation will be executed on the way, please do so in an environment where you can access the Internet.
The following installer will start, so check the license agreement and proceed with the installation with the default settings to complete.
When the installation is complete, the default browser will launch and the product help file will launch.
Register the bin folder of the installed JDK in the system environment variables.
(Reference) Setting system environment variables "Control Panel> System and Security> System> Advanced System Settings> System Properties> Environment Variables"
Variable name | value |
---|---|
Path | C:\Program Files\Java\jdk1.8.0_152\bin |
(Note) Change the folder name of the JDK to any installed version. (Note) After registering the environment variables, restart PowerShell or DOS. In that case, please start with "Run as administrator".
If you execute the following command from PowerShell or DOS, javac command help will be displayed. You have successfully registered in the system environment variables.
PS C:\> javac
how to use: javac <options> <source files>
The available options are:
-g Generate all debug information
-g:none Do not generate debug information
〜 (abridgement) 〜
-Quit compilation if Werror warning occurs
@<filename>Read from file options and filename
PS C:\>
The Java console program "DataBrowser.java" is stored in "" C: \ Program Files \ CData \ CData JDBC Driver for Twitter 2017J \ demos \ console \ databrowser "" under the default installation path of CData products. If you check the contents with an editor etc., a little less than 400 lines of Java sample code is stored. This time, I will run this program that can execute SQL from the console.
Change to the directory where "DataBrowser.java" is stored and compile with the javac command. Since this sample program uses the CData kintone JDBC Driver library, specify "cdata.jdbc.kintone.jar" with the classpath (-cp).
PS C:\> cd "C:\Program Files\CData\CData JDBC Driver for Twitter 2017J\demos\console\databrowser"
PS C:\Program Files\CData\CData JDBC Driver for Twitter 2017J\demos\console\databrowser> javac -cp ".\;../../../lib/cdata.jdbc.twitter.jar" DataBrowser.java
If the compilation is successful, multiple ".class" files will be created in the same directory.
PS C:\Program Files\CData\CData JDBC Driver for Twitter 2017J\demos\console\databrowser> dir
directory: C:\Program Files\CData\CData JDBC Driver for Twitter 2017J\demos\console\databrowser
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2017/11/07 1:55 256 .classpath
-a---- 2017/11/07 1:55 335 .project
-a---- 2018/01/14 16:30 2257 ConsoleDemo.class
-a---- 2018/01/14 16:30 894 DataBrowser$1.class
-a---- 2018/01/14 16:30 686 DataBrowser$2.class
-a---- 2018/01/14 16:30 750 DataBrowser$3.class
-a---- 2018/01/14 16:30 902 DataBrowser$ERRORS.class
-a---- 2018/01/14 16:30 1040 DataBrowser$QUERY_TYPES.class
-a---- 2018/01/14 16:30 1333 DataBrowser$TERMS.class
-a---- 2018/01/14 16:30 10856 DataBrowser.class
-a---- 2017/11/07 1:55 13814 DataBrowser.java
-a---- 2017/11/07 2:09 2907 databrowser.properties
Now let's run the sample program. Don't forget to specify the classpath (-cp) as a parameter.
PS C:\Program Files\CData\CData JDBC Driver for Twitter 2017J\demos\console\databrowser> java -cp ".\;../../../lib/cdata.jdbc.twitter.jar" DataBrowser
When started, the following console application will start.
PS C:\Program Files\CData\CData JDBC Driver for Twitter 2017J\demos\console\databrowser> java -cp ".\;../../../lib/cdata
.jdbc.twitter.jar" DataBrowser
******************************************************************
Twitter 2017J demo
This demo uses the CData JDBC Driver For Twitter 2017J.
******************************************************************
Please enter the connection properties below.
OAuthAccessToken:
Please set the following items.
Twitter OAuth Credentials | Setting items |
---|---|
Consumer Key (API Key) | OAuth Client Id |
Consumer Secret (API Secret) | OAuth Client Secret |
Access Token | OAuth Access Token |
Access Token Secret | OAuth AccessToken Secret |
A list of commands that can be used with this console application is displayed.
Executable command:
(SELECT|INSERT|UPDATE|DELETE) <formula>
DESCRIBE <tablename>
SHOW TABLES
QUIT
HELP
>
The "SHOW TABLES" command displays the dataset in Twitter as a table list.
>SHOW TABLES
+------------------------+
| Tables |
+------------------------+
| AccountSettings |
| AdAccounts |
| AdAvailableAudiences |
| AdCampaigns |
| AdFundingInstruments |
| AdInsights |
| AdLineItems |
| AdPromotedTweets |
| AdStats |
| DirectMessagesReceived |
| DirectMessagesSent |
| Favorites |
| Followers |
| Following |
| ListMembers |
| Lists |
| ListSubscribers |
| Mentions |
| Retweets |
| Trends |
| Tweets |
| TweetStream |
| Users |
+------------------------+
>
The data tweeted by the user with the "SELECT * FROM Tweets WHERE From_User_Id = '709991506229248001' LIMIT 3;" command is displayed. (Note) Twitter's API has a strict Rate Limit (restriction on the number of API requests within a certain period of time), so please narrow down the number of acquired records with LIM NIT. The upper limit may be reached if the SQL limit is removed and executed more than a certain number of times. In that case, please execute after 15 minutes have passed.
>SELECT * FROM Tweets WHERE From_User_Id = '709991506229248001' LIMIT 3;
+--------------------+--------------------+-------------+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+------+--------------------------------------------------------------------+-----------+----------------+-----------+---------------+---------------------+-----------+--------------+--------------------+--------------------+----------------+-----------------------+-------------------------------+-------------------------+------------------+-----------------+---------------+-------------------------+--------+-----------------------+--------------------+-----------------------+----------------------+--------------------+-------------------------+----------------------------------------------------------------------------+------------+---------------------+---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------+
| ID | IDLong | SearchTerms | Created_At | Text | Lang | Source | Favorited | Favorite_Count | Retweeted | Retweet_Count | Retweeted_Status_Id | Truncated | Filter_Level | Possibly_Sensitive | Withheld_Copyright | Withheld_Scope | Withheld_In_Countries | Contributors | Coordinates_Coordinates | Coordinates_Type | Place_Full_Name | Place_Country | Current_User_Retweet_Id | Scopes | In_Reply_To_Status_Id | From_User_Id | From_User_Screen_Name | From_User_Name | From_User_Location | From_User_Profile_URL | From_User_Profile_Image_Url | To_User_Id | To_User_Screen_Name | User_Mentions | URLs | Hashtags | NextPageToken |
+--------------------+--------------------+-------------+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+------+--------------------------------------------------------------------+-----------+----------------+-----------+---------------+---------------------+-----------+--------------+--------------------+--------------------+----------------+-----------------------+-------------------------------+-------------------------+------------------+-----------------+---------------+-------------------------+--------+-----------------------+--------------------+-----------------------+----------------------+--------------------+-------------------------+----------------------------------------------------------------------------+------------+---------------------+---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------+
| 951595436283895808 | 951595436283895808 | NULL | 2018-01-12T08:23:26.000+09:00 |Why is a post-REST API required? Two factors that REST API cannot cover and their countermeasures- Morning Girl
#REST #webapi #api #odata #openapi #graphql
https://t.co/8WkA0kKsje | ja | <a href="http://twitter.com" rel="nofollow">Twitter Web Client</a> | false | 1 | false | 1 | NULL | false | NULL | false | NULL | NULL | NULL | <contributors></contributors> | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 709991506229248001 | CDataJapan | CData Software Japan |Miyagi Sendai City| https://t.co/fA16p3ueQG | http://pbs.twimg.com/profile_images/709992802378190848/SRqZpTot_normal.jpg | NULL | NULL | <user_mentions></user_mentions> | <urls>
<Row>
<url>https://t.co/8WkA0kKsje</url>
<expanded_url>http://kageura.hatenadiary.jp/entry/2018/01/11/%E3%81%AA%E3%81%9C%E3%83%9D%E3%82%B9%E3%83%88REST_API%E3%81%8C%E6%B1%82%E3%82%81%E3%82%89%E3%82%8C%E3%82%8B%E3%81%AE%E3%81%8B%EF%BC%9F_REST_API%E3%81%8C%E3%82%AB%E3%83%90%E3%83%BC%E3%81%A7%E3%81%8D</expanded_url>
<display_url>kageura.hatenadiary.jp/entry/2018/01/…</display_url>
<indices>110</indices>
<indices>133</indices>
</Row>
</urls> | <hashtags>
<Row>
<text>REST</text>
<indices>66</indices>
<indices>71</indices>
</Row>
<Row>
<text>webapi</text>
<indices>72</indices>
<indices>79</indices>
</Row>
<Row>
<text>api</text>
<indices>80</indices>
<indices>84</indices>
</Row>
<Row>
<text>odata</text>
<indices>85</indices>
<indices>91</indices>
</Row>
<Row>
<text>openapi</text>
<indices>92</indices>
<indices>100</indices>
</Row>
<Row>
<text>graphql</text>
<indices>101</indices>
<indices>109</indices>
</Row>
</hashtags> | 951595436283895807 |
| 950940273659424769 | 950940273659424769 | NULL | 2018-01-10T13:00:03.000+09:00 |Last year's PV No.1 Knowledge article, "Visualize DynamoDB Data in Tableau."
https://t.co/nSQBElKHye | ja | <a href="http://twitter.com" rel="nofollow">Twitter Web Client</a> | false | 0 | false | 0 | NULL | false | NULL | false | NULL | NULL | NULL | <contributors></contributors> | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 709991506229248001 | CDataJapan | CData Software Japan |Miyagi Sendai City| https://t.co/fA16p3ueQG | http://pbs.twimg.com/profile_images/709992802378190848/SRqZpTot_normal.jpg | NULL | NULL | <user_mentions></user_mentions> | <urls>
<Row>
<url>https://t.co/nSQBElKHye</url>
<expanded_url>http://www.cdata.com/jp/kb/tech/dynamodb-odbc-tableau.rst</expanded_url>
<display_url>cdata.com/jp/kb/tech/dyn…</display_url>
<indices>54</indices>
<indices>77</indices>
</Row>
</urls> | <hashtags></hashtags> | 950940273659424768 |
| 950938702959661056 | 950938702959661056 | NULL | 2018-01-10T12:53:49.000+09:00 |Last year's PV No.1 Knowledge article, "Visualize DynamoDB Data in Tableau."
#dynamodb #tableau #odbc #NoSQL
https://t.co/nSQBElKHye | ja | <a href="http://twitter.com" rel="nofollow">Twitter Web Client</a> | false | 0 | false | 1 | NULL | false | NULL | false | NULL | NULL | NULL | <contributors></contributors> | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 709991506229248001 | CDataJapan | CData Software Japan |Miyagi Sendai City| https://t.co/fA16p3ueQG | http://pbs.twimg.com/profile_images/709992802378190848/SRqZpTot_normal.jpg | NULL | NULL | <user_mentions></user_mentions> | <urls>
<Row>
<url>https://t.co/nSQBElKHye</url>
<expanded_url>http://www.cdata.com/jp/kb/tech/dynamodb-odbc-tableau.rst</expanded_url>
<display_url>cdata.com/jp/kb/tech/dyn…</display_url>
<indices>87</indices>
<indices>110</indices>
</Row>
</urls> | <hashtags>
<Row>
<text>dynamodb</text>
<indices>54</indices>
<indices>63</indices>
</Row>
<Row>
<text>tableau</text>
<indices>64</indices>
<indices>72</indices>
</Row>
<Row>
<text>odbc</text>
<indices>73</indices>
<indices>78</indices>
</Row>
<Row>
<text>NoSQL</text>
<indices>79</indices>
<indices>85</indices>
</Row>
</hashtags> | 950938702959661055 |
+--------------------+--------------------+-------------+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+------+--------------------------------------------------------------------+-----------+----------------+-----------+---------------+---------------------+-----------+--------------+--------------------+--------------------+----------------+-----------------------+-------------------------------+-------------------------+------------------+-----------------+---------------+-------------------------+--------+-----------------------+--------------------+-----------------------+----------------------+--------------------+-------------------------+----------------------------------------------------------------------------+------------+---------------------+---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------+
>
>
If you want to close this console application, enter the "QUIT" command. I was able to get Twitter data from a Java console application.
Recommended Posts