MS SQL Server problem and project file question

15 views
Skip to first unread message

Martin Schwarz

unread,
Jan 11, 2020, 10:23:55 AM1/11/20
to sofastatistics
Dear Grant,

First of all, thanks for programming such a smart and easy to use application as SOFA Statistics. 

As some of my colleagues are in need of a simple to use statistical program we selected SOFA Statistics. Shifting all of our data into an MS SQL Server I wanted to set up a project file to connect to our data source. Unfortunately, all of my attemps were fruitless. I have no problem to access ur data from my RStudio but using the same credentials SOFA only throws error messages at me. 

As suggested I carefully checked the text.proj fiel and discovered some serious diffences between the properly working default file and my own. Thus, I kindly ask you to send any supportive suggestion to overcome the minor problem so that we can benefit from SOFA's possbilities.

Please, find attached the default file and my own text file (credentials have been changed). Especially the neccesity of the "u" prefix is very irriating as "u"s are not generated in a new project file at all! 

Thanks for your support,
Martin
Error message.jpg
default.proj
test.proj

Grant Paton-Simpson

unread,
Jan 18, 2020, 11:55:54 PM1/18/20
to sofasta...@googlegroups.com

Hi Martin,

Heh - sorry about the annoying u"" requirement - that is gone from SOFA now that I have ported it to Python 3.

I suspect the problem is nothing to do with the credentials and more to do with staleness of the code for connecting to MS SQL Server.

The attached file is probably where it all goes wrong and where it can be fixed.

It may even be something in this part:

def get_DSN(provider, host, user, pwd, db):
    """
    http://www.connectionstrings.com/sql-server-2005
    """
    DSN = f"""PROVIDER={provider};
        Data Source='{host}';
        User ID='{user}';
        Password='{pwd}';
        Initial Catalog='{db}';
        Integrated Security=SSPI"""
    return DSN
The bottom line is that if python can connect to MS SQL Server then we can make SOFA do the same. A good starting point would be for me to make and supply you with a simple Python script that you tweak until it connects to your database successfully. Is that something you or one of your colleagues would be willing to help with? I don't think it will be hard from your end but testing in the real context would be really useful.

All the best,
Grant

--

---
You received this message because you are subscribed to the Google Groups "sofastatistics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sofastatistic...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sofastatistics/f419d1bf-4373-4efa-9264-b88779a6a321%40googlegroups.com.
dbe_ms_sql.py

Martin Schwarz

unread,
Jan 26, 2020, 1:44:05 AM1/26/20
to sofastatistics
Hi Grant,

thanks for replying. I second your thought as I can connect via RStudio without any problem. 
So playing around with some code is definitively no problem at all as the benefit (accessing the database with SOFAStats directly) is definitively worth it. 

As I am not very familiar with Python itself I kindly ask you to put me in the right direction and then I will do my best to find the missing link.
I will give the attached file a try and come back on this asap.

All the best for now and thanks for your splendid support,
Martin
To unsubscribe from this group and stop receiving emails from it, send an email to sofasta...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages