Query any Microsoft SQL Server database with XQuery through the Stylus XQuery XQJ API. Only the JDBC URL changes across vendors — the XQJ code below is identical for every supported database.
jdbc:xquery:sqlserver://host:1433;databaseName=your_database
import javax.xml.xquery.*;
import java.util.Properties;
import com.ddtek.xquery.xqj.DDXQDataSource;
public class SqlServerExample {
public static void main(String[] args) throws XQException {
DDXQDataSource ds = new DDXQDataSource();
ds.setProperty(DDXQDataSource.JDBCURL,
"jdbc:xquery:sqlserver://server1:1433;databaseName=stocks;User=sa;Password=secret");
XQConnection cn = ds.getConnection();
XQPreparedExpression q = cn.prepareExpression(
"for $c in fn:collection('customers')/* return <name>{$c/CompanyName/text()}</name>");
System.out.println(q.executeQuery().getSequenceAsString(new Properties()));
cn.close();
}
}
| Test family | Status |
|---|---|
| SQL data-type coverage (BIGINT, DECIMAL, DATETIME, NVARCHAR, XML, …) | ✔ |
| Relational use cases — query & join pushdown | ✔ |
| XQuery Functions & Operators library | ✔ |
| XQuery Update Facility (XUF) | ✔ |
| Modules & prolog | ✔ |
| Namespaces | ✔ |
| Internationalization & encodings | ✔ |
| Regression & customer defects | ✔ |