Working with JDBC

VuGen provides full support for the JDBC protocol which is used for defining how a client may access a database.

Supported databases

The JDBC protocol supports all databases used via standard JDBC interface.

It also has custom support for non-standard usage of following databases:

  • Postgres
  • MySQL
  • Oracle
  • H2

Back to top

Recording JDBC scripts

To record JDBC script use the Java Record Replay protocol.

In Recording Options:

  • Under Recording Protocol > Recorder Options, select JDBC and record as with any Java Record Replay script
  • To avoid long and repetitive scripts, configure VuGen to generate loops where necessary by selecting Recording Protocol > Code Generation Options > Search for loops

For more information about recording Java Record Replay scripts, see Java Record Replay protocol recording tips.

Back to top

Known issues

  • Blob and Clob class recording is not supported.
  • Advanced non-standard features are not supported.

Back to top

Sample script


public class Actions{
	public int action() throws Throwable{
		_properties1 = System.getProperties();
		_properties1.put("", "XML");
		_driver1 = new org.h2.Driver();
		_driver2 = org.h2.Driver.load();
		_string1 = "jdbc:h2:~/test";
		_string2 = "user";
		_string3 = lr_unmask("3fbae0ecdbfa75c3");
		_connection1 = java.sql.DriverManager.getConnection(_string1, _string2, _string3);
		_string4 = "SELECT count(1) FROM USERS";
		_preparedstatement1 = _connection5.prepareStatement(_string4);
		_resultset1 = _preparedstatement1.executeQuery();
		_boolean1 =;
		_int1 = _resultset1.getInt(1);

		return 0;
	}// end of method: public int action() throws Throwable

	public int init() throws Throwable{
		return 0;
	}// end of method: public int init() throws Throwable

	public int end() throws Throwable{
		return 0;
	}// end of method: public int end() throws Throwable

	/* ------ fields ------ */
	java.util.Properties _properties1;
	org.h2.Driver _driver1;
	org.h2.Driver _driver2;
	java.lang.String _string1;
	java.lang.String _string2;
	java.lang.String _string3;
	java.sql.Connection _connection1;
	java.lang.String _string4;
	java.sql.PreparedStatement _preparedstatement1;
	java.sql.ResultSet _resultset1;
	boolean _boolean1;
	int _int1;

Back to top

See also: