Reputation: 5876
I am trying to embed IronPhyton scripting language into the C# project. I am hoping to let users write code with IronPhyton in my C# project.
I need to let users get data from database with IronPhyton, but I couldnt find a way to import the pyodbc library. Where should I put the library files in order for IronPyhton to make a connection? Should I add the library into the Visual Studio? I am lost. The library is not a DLL file, it is bunch of .pdb files.
this code below is IronPhyton.
import pyodbc
cnxn = pyodbc.connect("DRIVER={SQL Server};SERVER=SOME-PC;DATABASE=my_db")
cursor = cnxn.cursor()
Upvotes: 0
Views: 1322
Reputation: 54332
I think you cannot use Python libraries that use native libraries (DLLs or other binary files) in IronPython. Instead of trying to use pyodbc
use .NET ways of connecting to database. See http://www.ironpython.info/index.php?title=Databases_with_Odbc . I have tested it with Oracle ODBC connections and it works.
Similar problem is in Jython where you can use JDBC drivers or pure Python libaries.
Upvotes: 1