Differences between revisions 2 and 3
Revision 2 as of 2006-02-13 17:28:06
Size: 1211
Comment:
Revision 3 as of 2009-09-20 22:11:43
Size: 1211
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Using Multiple Connections in an IJ test script

Sometimes when you are writing a test, it is useful to work with multiple connections inside your IJ test script.

IJ supports multi-connection scripts elegantly, using the "show connections" and "set connection" commands. There is also the ability to name a connection, so you don't have to refer to them as Connection 1, Connection 2, etc.

When you are writing an IJ script for a regression test, this feature is somewhat more subtle, because generally the connection has already been established by the test harness. You don't want to open a connection to a hard-coded URL inside the script, because that would not work with different frameworks (DerbyNet versus embedded, for example).

The solution is that you can use abbreviated connection urls in IJ, omitting the scheme and framework information from the beginning of the URL, and IJ will then use whatever framework it is currently running under.

See jdbcapi/users.sql for an example:

  • connect 'wombat;shutdown=true;user=francois;password=paceesalute';
  • connect 'myDB;create=true;user=dan;password=MakeItFaster';

Thanks to Knut Anders for this observation.

MultiConnectionTip (last edited 2009-09-20 22:11:43 by localhost)