We have a existing closed source third party application using a Pervasive PSQL database. For Example the PSQL are located in the directory c:\test and have names like holiday.dat, offers.dat and so on. I want to read and if possible write to these files without having installed the Pervasive Workstation Engine. With the Workstation Engine and an ODBC connection it runs without any problems. But we won't install the Workstation Engine on any client and the third party application doesn't it, too.
On connectionsstrings.com i found the connection string:
"Provider=PervasiveOLEDB;Data Source=C:\datafilesDirectory;"
using directives:
using Pervasive.Data.SqlClient; using System.Data.OleDb; using System.Xml.Serialization;
test connection snippet:
string strAccessConn = "Provider=PervasiveOLEDB;Data Source=C:\datafilesDirectory;" string strAccessSelect = "SELECT * FROM holidays"; // Create the dataset and add the Categories table to it: DataSet myDataSet = new DataSet(); OleDbConnection myAccessConn = null; try { myAccessConn = new OleDbConnection(strAccessConn); } catch(Exception ex) { Console.WriteLine("Error: Failed to create a database connection. \n{0}", ex.Message); return; } try { OleDbCommand myAccessCommand = new OleDbCommand(strAccessSelect,myAccessConn); OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(myAccessCommand); myAccessConn.Open(); myDataAdapter.Fill(myDataSet,"Categories"); } catch (Exception ex) { Console.WriteLine("Error: Failed to retrieve the required data from the DataBase.\n{0}", ex.Message); return; } finally { myAccessConn.Close(); }
The application can't open the database connection.