Example 1: Accessing report sets via URL using the switching database command at runtime

To access report sets via URL, you can switch the connection in the same database or between different databases at runtime with the commands listed in the section Running report sets via URLs with protocols or commands. As a result, if the databases you want to switch between have the same structure, you will then be free from having to build another similar catalog. You can use the switch database commands to set the JDBC connection or to change the user name/password in order to connect to another database.

Switching the connection and user/password in the same database
  1. Set the Oracle database named oracle815 connection when designing the report set Report1.cls, and later switch the connection to the Oracle database named demo at runtime.

    The URL for switching the connection:

    http://localhost:8888/jrserver/SampleReports/SampleReports.cat/Report1.cls?jrs.cmd=jrs.try_vw&jrs.result_type=1
    &jrs.jdbc_url=jdbc:oracle:thin:@host:1521:demo

  2. Specify the user ID system/manager to ensure security when designing the report set Report1.cls, and then switch to the user ID Scott and the password tiger.

    The URL for switching the user ID and password:

    http://localhost:8888/jrserver/SampleReports/SampleReports.cat/Report1.cls?jrs.cmd=jrs.try_vw&jrs.result_type=1
    &jrs.db_user=Scott&jrs.db_pswd=tiger

  3. Set the Sybase 12 database named master when designing the report set Report1.cls, and later switch the connection to the Sybase 12 database named product at runtime.

    The URL for switching the connection:

    http://localhost:8888/jrserver/SampleReports/SampleReports.cat/Report1.cls?jrs.cmd=jrs.try_vw&jrs.result_type=1
    &jrs.jdbc_url=jdbc:sybase:Tds:host:5000/product

  4. Set the SQL database named MBA2000 when designing the report set Report1.cls, and later switch the connection to the SQL database named JTTest at runtime.

    The URL for switching the connection:

    http://localhost:8888/jrserver/SampleReports/SampleReports.cat/Report1.cls?jrs.cmd=jrs.try_vw&jrs.result_type=1
    &jrs.jdbc_url=jdbc:inetdae:host:1433?database=JTTest&sql7=true

Switching the connection between different databases
  1. Set oracle815 connection when designing the report set Report1.cls, and then switch the connection to Access database with the JDBC-ODBC driver named products at runtime.

    The URL for switching the connection:

    http://localhost:8888/jrserver/SampleReports/SampleReports.cat/Report1.cls?jrs.cmd=jrs.try_vw&jrs.result_type=1
    &jrs.jdbc_driver=sun.jdbc.odbc.JdbcOdbcDriver&jrs.jdbc_url=jdbc:odbc:products

  2. Set oracle815 connection when designing the report set Report1.cls, and then switch the connection to SQL server database named products at runtime.

    The URL for switching the connection:

    http://localhost:8888/jrserver/SampleReports/SampleReports.cat/Report1.cls?jrs.cmd=jrs.try_vw&jrs.result_type=1
    &jrs.jdbc_driver=com.inet.tds.TdsDriver&jrs.jdbc_url=jdbc:inetdae:JT_P05:1433?database=products&sql7=true