SR2 allows you to reference other databases within your XML files. This is handy if you want to reference information from a different content domain or if you need to lookup information in a different application database.
Remember, that the two fields must return an 'id' and a 'name' column. If you don't have them, you can use alias the column names.
The following is a SR2 Type 10 with the SQL query coming from another database:
Note: JDBC_url is the same data as you used in the *-ds.xml file.
<field>
<columnName>Channels</columnName>
<title>Channels</title>
<label>Channels</label>
<type>10</type>
<jdbc_driver>com.microsoft.jdbc.sqlserver.SQLServerDriver</jdbc_driver>
<jdbc_url>jdbc:microsoft:sqlserver://sql.company.com:1433;DatabaseName=sample;SelectMethod=cursor</jdbc_url>
<jdbc_username>username</jdbc_username>
<jdbc_password>password</jdbc_password>
<sql>select corpid as id, deptname as name, description from departments order by name</sql>
<isRequired>0</isRequired>
<defaultValue></defaultValue>
<maxLength></maxLength>
<maxselect>5</maxselect>
<displayFields>name,CompanyName</displayFields>
<isReadOnly>0</isReadOnly>
<panel>metadata</panel>
</field>
JDBC Reference:
JDBC Format for SQL Server 2000 JDBC Driver
<jdbc_driver>com.microsoft.jdbc.sqlserver.SQLServerDriver</jdbc_driver>
<jdbc_url>jdbc:microsoft:sqlserver://sql.refreshsoftware.com:1433;DatabaseName=sample;SelectMethod=cursor</jdbc_url>
JDBC Format for SQL Server 2005 JDBC Driver
<jdbc_driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc_driver>
<jdbc_url>jdbc:sqlserver://sql.refreshsoftware.com:1433;DatabaseName=sample;SelectMethod=cursor</jdbc_url>
JDBC Format for Oracle JDBC Driver
<jdbc_driver>oracle.jdbc.driver.OracleDriver</jdbc_driver>
<jdbc_url>jdbc:oracle:thin:@//host_name:1521/service_name</jdbc_url>