In this article, you will learn how to use a standalone JDBC application to test connection and performance test to your JDBC Data Source.
Overall Steps:
1. Edit attached config.properties to your JDBC String, username, password and test query
2. Upload both config.properties and java source file to Paxata server (any path is fine)
3. Copy the JDBC Jar file(s), such as jtds-1.3.1.jar, to the same path as JDBCTest.java on Paxata Server
4. Compile and run the following JDBC class on Paxata Server
# javac -source 1.7 -target 1.7 JDBCTest.java
# java -classpath .:jtds-1.3.1.jar JDBCTest config.properties
Sample result:
You entered JDBC String: jdbc:jtds:sqlserver://cs-mssql1-db1.paxatadev.com:1433
You entered USER: xxxx
You entered ClassName: net.sourceforge.jtds.jdbc.Driver
You also entered DB PASSWORD.
-------- JDBC Connection Testing ------
JDBC Driver Registered!
Connected to Database Query:select * from paxata.dbo.OneMillion
Column count: 22 ID (numeric),Case Number (varchar),Date (varchar),Block (varchar),IUCR (varchar),Primary Type (varchar),Description (varchar),Location Description (varchar),Arrest (varchar),Domestic (varchar),Beat (numeric),District (varchar),Ward (numeric),Community Area (numeric),FBI Code (numeric),X Coordinate (numeric),Y Coordinate (numeric),Year (numeric),Updated On (varchar),Latitude (numeric),Longitude (numeric)
==============JDBC GET METADATA FINISHED========================
==============COUNTING RESULTSET ROWS========================
First 1,000 rows read. It took 0.076 seconds;
First 10,000 rows read. It took 0.123 seconds;
First 100,000 rows read. It took 0.398 seconds;
First 1,000,000 rows read. It took 2.625 seconds;
All 1072368 rows read. It took 2.797 seconds.
Done.
Completed.
Connection is closed.