How to set the config file for SSIS dll - dll

I have a dll that I have created being loaded into an SSIS package. That dll references a config file with a connection string in it. For some reason instead of trying to get the connection string from that file SSIS tries to get the connection string from DtsDebugHost.exe.Config. How do I tell SSIS to get the connection string from the right file.

Related

What's the best way to place a local SQLite database file in a WinForms application to publish the project on GitHub and distribute the executable?

I'm trying to push to GitHub a Windows Forms VB.Net application which does CRUD operations on a local SQLite database file, but I realized the db3 file and System.Data.SQLite.dll are excluded from the push because the contents of bin/Debug folder where they're located are a part of the .gitignore policy template on Visual Studio, which absolutely makes sense.
I have tested the .exe file out of this Debug development folder and couldn't run the application either, throwing the exception: "Could not load file or assembly 'System.Data.SQLite, Version=1.0.116.0, Culture=neutral, PublicKeyToken=...' or one of its dependencies"
My Problem is all the guides I've checked to use a SQLite in a Windows Forms project place the database file in bin/Debug, I guess for the simplicity of the tutorial. So this way of referencing the SQLite db3 in bin/Debug works fine in my application:
Public dbFullPath As String = Application.StartupPath & "\\myDatabase.db3"
Public conStr As String = String.Format("Data Source = {0}; version = 3;", dbFullPath)
However, I don't know how to place the database at the same level of other project files like .vb Forms and the Resources folder and reference it so the app works and all the necessary files are pushed to my public repository.
I created an App_Data folder at project level and placed the database file inside and then tried to replace the path String from:
Public dbFullPath As String = Application.StartupPath & "\\myDatabase.db3"
to this:
Public dbFullPath As String = "App_Data\\myDatabase.db3"
But I'm unable to open the database in a different place other than bin/Debug.
Thank you very much for your help.
In order to run the application outside of the visual studio environment you will need to copy both the x64 and x86 folders which are generated at build time
In Chem4Word we use the NuGet package SQLite 1.0.117 to read and write to a SQLite database which is deployed to C:\ProgramData\Chem4Word, but it could be anywhere in the file system to suit your purpose.
Our installer also deploys the contents of the above folders (x64 and x86) beneath the application folder in C:\Program Files (x86)\Chem4Word as shown below
The "seed" database is stored as an embedded resource, hence gets checked in to the repository.

How to include an MS Access DB on the startup path of the setup file of ClickOnce and call it with the app.exe

I built an app in VB.NET integrated with an Access DB.
Before deploying the app, I had the standard structure of a Windows Forms project with the bin/Debug folders and the EXE file with the DB file.
Now I have the "Public" folder with the installation file inside like the setup, the application manifest, etc ...
In this way, the application EXE (that is into the AppData\Local\Apps) does not find the DB and returns the following error:
System.Data.OleDb.OleDbException (0x80004005):Cannot find file "C:\Users\me\AppData\Local\Apps\2.0\QP63K7B2.Q6O\QXCJLXG6.VWW\cons..tion_f8ea45aa6e4eea3e_0001.0000_d39d4d46cbe37100\database.accdb".
Because the connection string I use is:
Provider=Microsoft.ACE.OLEDB.12.0; Data source=" & Application.StartupPath & "/database.accdb
The question is:
Can I manually put the DB into the "Publish" folder with the installation files and change the connection string to point to that file?
Something like that:
Provider=Microsoft.ACE.OLEDB.12.0; Data source=" & Application.**setupPath** & "/database.accdb
Your connection string is wrong. DO NOT do this:
"Provider=Microsoft.ACE.OLEDB.12.0; Data source=" & Application.StartupPath & "/database.accdb"
Do this:
"Provider=Microsoft.ACE.OLEDB.12.0; Data source=|DataDirectory|\database.accdb"
Because there is no code, you can store that in a config file rather than building it at run time. ClickOnce creates a dedicated folder for data files. When you use "|DataDirectory|" in a connection string, it will resolve to the program startup folder in a non-ClickOnce app - that includes while debugging in VS - but it will resolve to that dedicated data folder in a ClickOnce app. It will also resolve to the App_Data folder in an ASP.NET app. If you do it the way you're supposed to, it will just work. Don't try to move the database. Just fix your connection string.

Deployed SSIS package fails when running from a SQL Agent Job

Let me know what additional info would help. I have an SSIS package that Imports a csv file to SQL Server and moves that csv into a subfolder of the folder where the csv resides. I can run the package from the Integration Services Catalog with no problem, but when running from the Agent Job it says it can't read the .csv file and I've tried different versions of the file. I tried recreating the job also. No luck. Also the C# script task is not moving the csv to the archive folder even when I run the package from the ISC. The agent error tells me to look at the Execution of the package which says basically it can't open the csv.

SSIS Deployment Variable Issue

I have created an SSIS package which uses a for each loop container and an Excel connection string that I have created from a variable so I can loop through multiple files. My package works without issue and if I have a number of files in my source folder and I simply execute the package it works perfectly looping through all the files doing what I want it to do.
The issue I have is when I deploy the package, If I have files within my source folder it executes without error but when you look at the source folder it still has the files in. When digging a bit deeper in to the package reports it looks like it is reporting that there were no files found. If I manually execute the dtsx file in runs without issue and imports everything as it should.
Is there any reason why after deploying the package it is unable to recognise the files or the variable that I store the file name in?
Sounds like it could be permissions related. Does the SQL Server Service account have permissions to the directory where the files are stored?

How can i specify the relative file of dtsconfig file for SSIS in SQL JOBS

I am working with ssis package. and i developed some packages with the configuration file. In the configuration file i given the all relative paths of the connections like FlatFileConnection, OLEDB Connection etc. it is running fine with dtexec command with /config configuration file path.
But now i need to create a sql job to run this ssis package automatically every day. In this case i want to give the relative path of the config file(I dont want to hard code to the path of configuration file. it should take from the same path of the .dtsx file path) . how can i do this?
Thanks in advance.
Eshwer
You can’t!
You must have the path for the config file on your job step.
If you had it configured somewhere else you would need a configuration to show where the cofig file is. Doesn’t make sense, right?
In SQL Server Management Studio, highlight SQL Server Agent -> Start. Highlight Job ->New Job…, name it , myJob.
Under Steps, New Step, name it, Step1,
Type: SQL Server Integration Service Package
Run as: myProxy
Package source: File System
Browse to select your package file xxx.dtsx
Click Ok
Schedule your job and enable it.........