This project has moved and is read-only. For the latest updates, please go here.


MSSQL connection with SQL user


Hello Marco,

First things first - this project is just awesome!

I ran into a situation today where I built an RDF "viewer" with RDFSharp and everything looked great (see attached). I am running it off of a SQL Server database. Everything worked well on my dev machine, but when I wanted to use a remote database and a SQL login, I couldn't get it to work. I ended up recompiling the RDFSharp.dll and making the following changes to RDFSQLServerStore.cs
      #region Ctors
        /// <summary>
        /// Default-ctor to build a local SQL Server store instance ("LOCALHOST\\SQLEXPRESS")
        /// </summary>
        //public RDFSQLServerStore(String sqlServerDatabase): this("LOCALHOST\\SQLEXPRESS", sqlServerDatabase) { }

        /// <summary>
        /// Default-ctor to build a SQL Server store instance
        /// </summary>
        public RDFSQLServerStore(String sqlConnectionString) {
            if(sqlConnectionString != null && sqlConnectionString.Trim() != String.Empty){
                sqlConnectionString = sqlConnectionString.Trim();
                //if(sqlServerDatabase != null && sqlServerDatabase.Trim() != String.Empty) {
                //    sqlServerDatabase = sqlServerDatabase.Trim();

                    //Initialize store structures to SQL Server values
                    this.StoreType    = "SQLSERVER";
                    this.Connection   = new SqlConnection(sqlConnectionString);
                    this.Commands     = new Dictionary<String, SqlCommand>();
                    this.StoreID      = RDFModelUtilities.CreateHash(this.ToString());       
Because I was testing remotely, Integrated Security was not an option for me. I think it is a good idea to just allow a connection string and then it can be either integrated security or not. I made the change, tested, and everything works well now.

This is for the Museum of Modern Art in NY BTW. I am putting together a proof-of-concept for Linked Data. Thanks!


file attachments


mdesalvo wrote Sep 17, 2015 at 8:47 AM

Thanks Steve,
both for your appreciation and for your very useful suggestion on the ability to support connection strings in constructors of SQL stores. I will add this into the trunk baseline, which serves the 0.8.x branch. I'm also evaluating to do a release in which your suggestion could be integrated, along with other little backports from the trunk.

Thanks also for sharing your use case: this is very important for me, it encourages me to do even better with responsability :)


wrote Sep 17, 2015 at 8:48 AM

wrote Sep 20, 2015 at 11:54 AM

mdesalvo wrote Sep 20, 2015 at 11:56 AM

The feature has been integrated into GitHub's project codebase. It will be delivered in and 0.8.2 releases.