Go to the Virtuoso "Start Menu" program group and then follow the JDBC Samples-->JDBCDemo (JDK1.1&1.2) menu path, this will execute a DOS batch program that initializes the Java demo application.
![]() |
Figure: 4.3.1.1. JDBC Demo |
Set the JDBC Driver Name and URL settings for your connection to the Virtuoso demonstration database. The "Driver Name" field identifies the Virtuoso Driver. If it is left blank, then it defaults to "virtuoso.jdbc.Driver", which is the Virtuoso Driver for JDBC 1.0. The "Connection URL" field requires a valid Virtuoso JDBC URL.
![]() |
Figure: 4.3.1.1. JDBC Demo |
Enter a valid SQL statement and then click the "Query" button, the example below uses a fully qualified Virtuoso SQL statement requesting all records from the "Demo" database table "Customers" owned by the Virtuoso user "DBA".
![]() |
Figure: 4.3.1.1. JDBC Demo |
Go to the Virtuoso Lite "Start Menu" program group and then follow the JDBC Samples-->ScrollDemo2 (JDK1.2) menu path, this will execute a DOS batch program that initializes the Java demo application.
![]() |
Figure: 4.3.2.1. Scroll Demo 2 |
Set the JDBC Driver Name and URL settings for your connection to the Virtuoso demonstration database. The "Driver Name" field identifies the Virtuoso Driver. If it is left blank, then it defaults to "virtuoso.jdbc2.Driver", which is the Virtuoso Driver for JDBC 2.0. The "Connection URL" field requires a valid Virtuoso JDBC URL.
![]() |
Figure: 4.3.2.1. Scroll Demo 2 |
Enter a valid SQL statement and then click the "Query" button, the example below uses a fully qualified Virtuoso SQL statement requesting all records from the "Demo" database table "Customers" owned by the Virtuoso user "DBA".
![]() |
Figure: 4.3.2.1. Scroll Demo 2 |
You can now use the navigational buttons to Scroll backwards and forwards, each of these navigational buttons highlights Virtuoso's full implementation of the JDBC 2.0 Scrollable Cursors specifications.
Start the Virtuoso Admin Assistant and then follow the Sample Applications-->JDBC Applet Demos menu path.
![]() |
Figure: 4.3.3.1. Scroll Demo 2 |
Click on the "ScrollDemo2" hyperlink which initializes the ScrollDemo2 applet, if you do not have a Java 1.2 or Java 2.0 compliant browser you will not be able to run this Applet demo. The other way to experience this demo is to run the Application version which uses your operating systems Java Virtual Machine (JVM) instead of a JVM inherently linked to a Web Browser.
Go to the Virtuoso "Start Menu" program group and then follow the JDBC Samples-->Jbench (JDK1.1) or Jbench (JDK1.2) menu path, depending on the JVM you have installed. This will execute a DOS batch program that initializes the JBench application.
![]() |
Figure: 4.3.4.1. JBench |
The follow the File-->Connect menu path to make your initial connection. You will need to identify your JDBC Driver (by providing appropriate Driver Name values in the JDBC Driver field) and then provide a valid JDBC URL for your specific JDBC Driver (Jbench uses a valid Virtuoso Driver for JDBC URL that points to the demonstration database listening at port 1112 as its default).
![]() |
Figure: 4.3.4.1. JBench |
Follow the Results-->Table URL menu path, this is how you identify (using a JDBC URL) the location of the "Results" tables into which you will be storing your benchmark data. The default URL is the current JDBC URL (the one used to establish your initial connection), but this can be a totally different database to the one being benchmarked.
Follow the Results-->Create menu path, this is how you actually perform the "Results" table creation in the database identified by the URL in the previous step.
Follow the TPC-A-->Load Tables menu path to prepare your database for the TPC-A benchmark, select a database schema type that matches the database engine that you are benchmarking. If your database is not listed ANSI should suffice (as long as this is an ANSI SQL compliant database).
![]() |
Figure: 4.3.4.1. JBench |
Follow the TPC-A-->Load Procedures menu path to Load the Virtuoso TPC-A stored procedures.
Now that all the benchmark data and stored procedures have been loaded into your database, follow the TPC-A-->Run Benchmark menu path and then configure your actual benchmark session parameters:
The benchmark parameters fall into 4 categories, Bench execution mode, Run Options, SQL Options, and Execution Options.
![]() |
Figure: 4.3.4.1. JBench |
Bench execution mode: These setting allow you to configure the threads used for the benchmark.
Decide on a single or multiple threads test.
No. Threads - this is the number of concurrent threads to be used during the benchmark.
Run Options: These setting allow you to configure the duration related aspects of this benchmark program.
No. runs - this controls how many iterations of the benchmarks you actually run (the default is 100 benchmark iterations).
Duration (mins.) - this is the duration in minutes of each benchmark run.
SQL Options: These setting allow you to configure how your benchmark's SQL instructions are actually handled.
ExecDirect with SQL Text - this means that no form of repetitive SQL execution optimization is being applied (SQL statements are prepared and executed repetitively)
Prepare/Execute Bound Params - this means that the Parameter Binding SQL execution optimization is being applied (SQL is prepared once but executed many times without the overhead of re-preparing statements prior to execution)
Use Stored Procedures - this means that the Stored Procedure SQL optimization is being applied (benchmark instructions are stored within database being benchmarked)
Run All - this implies you want to perform all of the above benchmarks
Execution Options: These setting allow you to configure the tone of your benchmark, for instance it could have Transaction scoping and a mix of record retrieval queries, or it could simply be input and update intensive with a minimal amount of record retrieval queries (the case when the 100 row query checkbox is unchecked a typical OLTP scenario)
Use Transactions - make the benchmark use transaction control (instructions are scoped to transaction blocks)
Do 100 row Query - perform a simulation of a 100 record retrieval as part of the benchmark activity.
Run your TPC-A benchmark.
Follow the TPC-A-->Cleanup menu path to clean up your database so that you can then run other benchmarks (TPC-C like benchmark).
To run the TPC-C benchmark simply follow the appropriate menu path, create the benchmark tables & stored procedures, load the benchmark data and then run the TPC-C benchmark.
The JTA demo is located in the <VIRTUOSO_INSTALLATION_DIRECTORY>\samples\jdbc\JTADemo folder.
The sample requires 2 or 3 Virtuoso instances and an instance of a J2EE 1.3.1 server properly set up and running on the same computer or on the network. To build the sample it's also necessary to have a J2SE 1.4 SDK installed.
The JAVA_HOME and J2EE_HOME environment variables must be set to the J2SE SDK and J2EE installation path respectively.
The virtjdbc3.jar file must be in the classpath of the J2EE server. The setting of the classpath differs across different J2EE servers. For J2EE Reference Implementation (RI) the J2EE_CLASSPATH variable might be set in %J2EE_HOME%\bin\userconfig.bat on Windows or $(J2EE_HOME)/bin/userconfig.sh on Unix.
set J2EE_CLASSPATH=C:/Virtuoso/lib/virtjdbc3.jar
J2EE_CLASSPATH=/home/login/virtuoso/lib/virtjdbc3.jar export J2EE_CLASSPATH
Add the Virtuoso XA datasources to J2EE server. For J2EE RI this is done like this:
j2eeadmin -addJdbcXADatasource jdbc/Virtuoso1 virtuoso.jdbc3.VirtuosoXADataSource dba dba -props serverName=localhost portNumber=1111 j2eeadmin -addJdbcXADatasource jdbc/Virtuoso2 virtuoso.jdbc3.VirtuosoXADataSource dba dba -props serverName=localhost portNumber=2222 j2eeadmin -addJdbcXADatasource jdbc/Virtuoso3 virtuoso.jdbc3.VirtuosoXADataSource dba dba -props serverName=localhost portNumber=3333
Please note that the newly added datasources take effect only after restart of the J2EE server.
The sample folder contains the jtademo.properties file which can be used to configure the sample application. The configuration options are described within the file.
The sample folder contains build and deploy scripts (build.sh and deploy.sh for Linux and Unix and build.bat and deploy.bat for Windows).
Use the build script to build the sample application from the source files.
Deploy the application to the J2EE server. The deploy script performs this task for J2EE RI. Other J2EE application servers might provide different ways for application deployment.
The sample folder contains the run scripts for Linux/Unix and Windows.
The run script accepts the following commands:
create: | Creates and populates the necessary tables. |
check: | Verifies data consistency. |
drop: | Removes data and tables from the databases. |
run: | Executes a number of transactions over database tables. |
The first action to do is to initialize the data with the create command. After this the command might be used one or more times. This executes a series of concurrent updates on the distributed data. The check command verifies that this updates left databases in the consistent state.
For instance, for Unix:
run.sh create run.sh run run.sh check
And for Windows:
run.bat create run.bat run run.bat check
Previous
Sample ODBC Applications |
Chapter Contents |
Next
Contents of Conceptual Overview |