Setting up SDB on SQL Server 2005

imageFor the non-Java developer, like me, setting up and configuring SDB can be tricky. While it’s fresh in my mind I’ll commit it to blog so that those who come after will not tear their hair out like I just did.

SDB sits below Jena providing it with database support for a triple store rather than the more restrictive RDF XML file. The benefits of using a database are obvious, but the difficulties are not. the following instructions assume that you are running JRE 1.6, Vista and Cygwin. You need Cygwin to be able to run the batch files that come with SDB. You could probably adapt them to work on DOS, but Cygwin allows you to run the scripts as is.


  1. Get a copy of SDB & put it somewhere handy (I chose C:\etc\downloads\dev\semantic-web\sdb-1.0)
  2. Get a JDBC driver for SQL server.
    1. copy it to the lib dir under SDB. I’m not sure why, but I had to do this  despite the fact that there is an environment var that ought to be enough.
  3. Create a database for your triple store (I called mine TestTripleStore)
    1. Remember that you must use binary collation (I chose Latin1_General_BIN).
    2. Create a user and login for the new database (I chose sdbuser).
      1. Login as that user using SQL Management Studio – in case you need to change the user credentials on first login.
    3. Assign the new user ownership of the new triple store database.
    4. Setup TCP/IP access on your database server.
  4. setup the following environment variables using your .profile or .bashrc file (remember to source the file before you try to do anything)
    Note the use of DOS/Windows style path declarations despite the use of Cygwin – this one always catches me out.
  5. write the SDB configuration file (sdb.ttl) and place it in the $SDBROOT directory. This is straightforward – just modify the server and database name as appropriate:
    @prefix sdb:     <; .
    @prefix rdfs:     <; .
    @prefix rdf:     <; .
    @prefix ja:      <; .

    # Microsoft SQL Server

    _:c rdf:type sdb:SDBConnection ;
        sdb:sdbType        “MSSQLServer” ;
        sdb:sdbHost        “localhost” ;
        sdb:sdbName        “TestTripleStore” ;
        sdb:driver         “”

    [] rdf:type sdb:Store ;
        sdb:layout         “layout2” ;
        sdb:connection     _:c ;

  6. Create the triple store for SDB:
    sdbconfig –sdb=sdb.ttl create

If all goes according to plan, you should get no errors and the following tables in SQL server.



4 thoughts on “Setting up SDB on SQL Server 2005

  1. Dude I freakin’ dig your blog. You have posts of high value.

    If you could post how you get the whole stack above working with linq2rdf that would be schweet! Or even better, if you Jena running on a EC2 (Amazon) cluster combined with SimpleDb (Amazon WS again) setup as the triple persistence layer, then using Linq2Rdf for interrogation.

    Have you used any of SemWeb’s OWL inferrence capabilities? I’ve tried using my own rolled OWL doc (rolled with Protoje) with it and met limited success, although I think it has more to do with my OWL writing incompetencies than limitations in SemWeb.

  2. Johnny – thanks!

    No I haven’t tried any of the above. I have tried doing various kinds of inference with SemWeb, and met with pretty poor results. I don’t think reasoning support was much of a priority for Josh Tauberer’s govtrack site, so it never got the attention necessary for full reasoner support… Hence the reason why I’m focusing on getting better Jena/Joseki/SDB support, so that I can show off semantic web technologies better to .NET developers.

    Needless to say, if you can get Jena etc working on the cloud with SPARQL support then LinqToRdf will work with it – it just needs a SPARQL endpoint to work with. the jena aspect of the setup is really independent of the LinqToRdf side of things (which just requires you to click on the MSI file). LinqToRdf will work with any standards compliant SPARQL engine. I will be documenting the whole jena etc setup process as I go along though, so watch this space…

    Next on my list for LinqToRdf is support for SPARQL Update which whilst not complete as a standard yet, is mature enough (I’m told) to warrant the effort in supporting it.



  3. HI andrew here i have a doubt .. iam trying
    connect sqlserver from cygwin..i have installed
    ssh and execiuted open ssh-congong-host
    It successfully executed.Then what to do after that
    How to set up the enviroment files which u r
    specified above.

  4. Didn´t you need to set the classpath pointing to sdb.jar?

    I am geting the error “Exception in thread “main” java.lang.NoClassDefFoundError: sdb/
    Caused by: java.lang.ClassNotFoundException: sdb”

    Thanks for the help.

Comments are closed.

Create a website or blog at

Up ↑

%d bloggers like this: