pyodbc DSN question

Thread Starter

mbxs3

Joined Oct 14, 2009
170
I have a working python script that I compile into an exe with pyinstaller.

The script makes a database connection and in my dev setup, I am passing the database connection parameters (username, password) in the connection string.

The exe will end up running on another users PC and, while I think it unlikely, I do not want them to have the ability to extract the database password from any of my code.

I was hoping to create a DSN in the Windows ODBC Data Source Administrator on the production PC and only pass the DSN parameter in my python code. However, I have been unsuccessful in getting this to work. In my searching, all the example I see using a DSN also have a password assigned in the pyodb connection string. So is what I want to do even possible?
 

Thread Starter

mbxs3

Joined Oct 14, 2009
170
This is actually the same webpage I followed to setup my original connection. However, when I use a string like the one you show, my connection is not successful.

I have the ODBC configured on the Windows machine in the ODBC Administrator. (I am using a 64-bit machine and I configured the connection in the 64-bit and 32-bit ODBC administrator, I am pretty sure the 32-bit version is called).

May be a dumb question but MyDSN should be whatever I named the data source on the ODBC administrator, correct?
 
Top