what if user deletes some file from installed folder - deployment

I have created windows application setup using Visual Studio 2010 Ultimate, .Net Framework version 4.0 and Access database ,It is getting installed properly in default location ,but I want to know what if user deletes some file or data from this location ,what can I do for this ?what is the right way?

You have many choices to do that:
1. Use the Compiled Executable Version of Your MS Access Database File.
You can compile your database into an Executable File.
But I don't know that you can access to it from other Programming Languages like C# or not. I think you must search the Internet.
In MS Access 2013:
Go to the File -> Save As -> Save Database As -> Make ACCDE "File will be compiled into an executable only file."
In MS Access 2010:
Go to the File -> Save & Publish -> Save Database As -> Make ACCDE
In MS Access 2007:
Go to the Database Tools ribbon tab -> Make ACCDE (in the Database Tools group)
2. Encrypt Database with the Password.
You can save your MS Access database file with Password; in this way, you must set the Password in database connection string for accessing to it.
In MS Access 2013:
Go to the File -> Info -> Encrypt with Password "Use a password to restrict access to your database. Files that use the 2007 Microsoft Access file format or later are encrypted."
Go to the File -> Info -> Decrypt Database "Removes the password from this database."
In MS Access 2010:
Go to the File -> Info -> Encrypt with Password
Go to the File -> Info -> Decrypt Database
In MS Access 2007:
Go to the Database Tools ribbon tab -> Encrypt with Password (in the Database Tools group)
Go to the Database Tools ribbon tab -> Decrypt Database (in the Database Tools group)
3. Backup Your Main Database.
You can create a backup version of your database in somewhere else; you can do this with two ways:
Write some codes for create a backup file from your database with the backup ability of the MS Access. You can do this manually from MS Access program:
In MS Access 2013:
Go to the File -> Save As -> Save Database As -> Back Up Database "Back up important database regularly to prevent data loss."
In MS Access 2010:
Go to the File -> Save & Publish -> Save Database As -> Back Up Database
In MS Access 2007:
Go to the Microsoft Office Button -> Manage -> Back Up Database (under Manage this database)
For creating A backup file, you can simply create a copy of your file with writing some codes to do that.
The scenario for doing both is as follows:
Add or Call your codes for closing time of your application program that is closed by the end-user. Run your codes in the background Thread(s). Copy or back up it in somewhere like as follows:
%WINDIR%..\ProgramData\YourSubFolder(s)
%USERPROFILE%\AppData\Local\YourSubFolder(s)
%USERPROFILE%\AppData\LocalLow\YourSubFolder(s)
%USERPROFILE%\AppData\Roaming\YourSubFolder(s)
Somewhere else like:
Another folder in your program root folder or sub-folders(s)
Another folder in where you want
Etc.
Hint: You can change attributes of your database file (in the root folder or sub-folder(s) of your program) and/or its backup file (in somewhere else) to the Read-only, Hidden, System, Read-only + Hidden, Read-only + System, Hidden + System or Read-only + Hidden + System for increasing security.
You can't see Hidden files in default mode of displaying items; so, for see Hidden items, you must do the following:
or
You can't see System files in default mode of displaying items; so, for see System items, you must do the following:
With doing this scenario, you can add some codes for running in the start-up time of your program for checking is there Database in its folder or not. And if it can't find the main database, just copy your database simply from backup folder to its initial folder in your application folder/sub-folder(s).
4. Change the Security Attributes of the Main and Backup Database.
You can change the security attributes for the Main Database (in the root folder or sub-folder(s) of your program) and its backup file (in somewhere else) to restrict access to both of them as follows:
Add or Call your codes in closing time of your application program that is closed by the end-user. Run your codes after completing background Thread(s) for backup the Main Database (if you're used Backup Scenario). These codes must change the Security attributes to the specific Windows OS or User-defined (must define by you if you want to use it) Group or User. With this method, when program isn't running, no one can access to both database files.
Remember that you must add or call some codes for changing the Security attributes of both databases in start-up time of your application program; because they must accessible by the application.
If you want to use a Group, you can do the following:
In order of what I mentioned above, THE BEST SOLUTION IS:
Hybrid method:
Combine all methods together for achieve to the better and more secure method:
Compiled Executable Version of the MS Access Database File + Encryption with the Password + Backing Up the Main Database + Changing Security Attributes for Both Databases

Related

Instant logging and file generation in Db2

I am currently using Community version on linux server, have configured db2audit process
Which generated audit files at respective location. Then user have to manually execute db2audit archive command to achieved logs file and have to execute thedb2 extract command to extract the archived files into flat ascIII files and then we have to load the files into respective tables.
There only we can analyze the logs by query the tables. In this whole process lots of manual intervention is required.
Question:-Do we have any config settings or utility
with the help of which we can generate logs files which include SQL statement event, host, session id,Timestamp and all instantly and automatically.
need to set instant level logging mechanism to generate flat files for logs of any SQL execution happened or any event triggered in database level in DB2 on linux server

Transfer a file from AS400 to another machine in the same network

I am trying to export the data of a table on AS400 to another machine through iSeries commands but I am stacked in the middle of the process. I have a stored procedure in which I create the CSV file but after completion I need to transfer this file to another machine (which is of course connected to the AS400).
In the stored procedure, I used the CPYTOIMPF command to export table data to CSV and I wrote the file on the AS400 file system. I don't know if there is an option to write the file directly to another machine.
CALL QSYS2.QCMDEXC(
'CPYTOIMPF FROMFILE(LIBRARY/TABLE) TOSTMF('/QIBM/UserData/TestFolder/2.CSV') STMFCODPAG(*PCASCII) RCDDLM(*CRLF)'
);
This step is completed and the file is written on that directory.
Now I need to transfer this file to a web server that is connected to AS400 without after the above command is completed.
How can I do that?
You can use FTP on IBM i. Here is a modified example from the IBM Knowledge Center
This is a CL program
PGM
OVRDBF FILE(INPUT) TOFILE(MYLIB/QCLSRC) MBR(FTPCMDS)
OVRDBF FILE(OUTPUT) TOFILE(MYLIB/QCLSRC) MBR(OUT)
FTP RMTSYS(SYSxxx)
ENDPGM
This program overrides the input of the FTP client to a script in MYLIB/QCLSRC member FTPCMDS, and the output of the FTP client to MYLIB/QCLSRC member OUT. The first line of the script must contain the userid and password for the remote location.
Here is a sample script from the same Knowledge Center reference:
ITSO ITSO <== This is the user id and password
CD ITSOLIB1
SYSCMD CHGCURLIB ITSOLIB2
GET QCLSRC.BATCHFTP QCLSRC.BATCHFTP (REPLACE
QUIT
This should not be used outside your network as the user id an password are sent in plain text. It also can be a security risk as production user id's and passwords must be stored in plain text in the source file.
In addition, Scott Klement has a presentation on how to use ssh, scp, and sftp on IBM i. This is quite a long thing, so you might want to read about it here.
A short summary is that scp might be the easiest way to go. but you will need to:
Make sure that OpenSSH option of the OS is installed.
Make sure your Windows server is set up as an ssh server.
Set up a digital key to use for the transfer. Private key goes on client side, and public key goes on server side.
Use scp fromfile user#host:tofile in Pase to transfer the file.

Crystal Reports Server 2013 - RPT file location

I have my Crystal Reports server configured against an Oracle data source, but now I need to switch it to be configured against a SQL Server data source, on a different server. This server has no way to communicate with the original server to use the import tool.
I was looking into how to import the data myself. Looking at the tables, I see that it stores binary fields in the database. Are the reports stored as binary data inside the data source, or does each RPT file has a copy somewhere on the disk? If it is on the disk where? If it's inside the data source binary field, does importing the data to a new server will still work?
The CCM (Central Configuration Manager) – not to be confused with the CMS – has the ability to migrate your database repository from one database to another, even if the database vendor differs (i.e. Oracle vs. Microsoft).
Have a look at the administrator guide, the procedure is described in chapter 11, Managing Central Management Server (CMS) Databases, section 4 Copying data from one CMS system database to another.
A small excerpt:
You can use the Central Configuration Manager (CCM) or cmsdbsetup.sh
to copy system data from one database server into another database
server. For example, if you want to replace the database with another
database because you are upgrading the database or are moving from one
database type to another, you can copy the contents of the existing
database into the new database before decommissioning the existing
database.
Regarding the reports themselves, they are not stored in the database, but in the file repository. However, you need to view the database and file repository as one: the first contains the metadata while the latter contains the actual files. However, they can not function separately.
In other words, you cannot just copy the RPT files from the file repository to another server and expect them to work, as the information that is contained in the metadata (such as authorisations) will be missing. On the other hand, if you just copy the database repository but omit the file repository, you'll end up with all the information regarding your reports, but you won't be able to open or run them.

Windows Service ran by domain account cannot access file while full control

I have created a C# service that:
- Picks up and opens a local text file
- Opens an Excel-file used as template (saved locally)
- Fills in the data from the text file in the excel file
- Saves the Excel file to a network folder.
The service runs using a domain account (I cannot give the local system account rights on the network from our network admin...). When the service tries to open the template, I get an access denied error:
Microsoft Excel cannot access the file 'C:\BloxVacation\Template\BloxTemplate.xlsm'. There are several possible reasons:
• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.
The file does exist and the path is correct.
The file is not used by another user or program.
I try to OPEN the workbook (no other workbook is open), not SAVE it.
I have received the same error using the system account. The reason for this is that, when using interopservices, the system account needs a desktop folder (bug in Windows 7: http://forums.asp.net/t/1585488.aspx).
C:\Windows\System32\config\systemprofile\Desktop
C:\Windows\SysWOW64\config\systemprofile\Desktop
Create those 2 files and the error disappears for the system account.
I have given the domain user rights to those folders and the error disappears as well however, the service hangs on the code line where I open the excel file. When I execute the exact same code with the system account, the code execute well (Note: I save the file locally).
objXL.Workbooks.Open(BloxVacationService.ExcelTemplateFilePath)
Has anybody an idea how to solve this issue without having to rewrite the entire service in OpenXML? Thank you very much in advance.
If you have done all the things described in the question and it still doesn't work (as it was with me), the answer is pretty simple:
Make the domain user local admin on the machine that runs the service. It solved the problem.

Restore full external ESENT backup

I've wrote the code that creates full backups of my ESENT database, using JetBeginExternalBackup API.
Following the MSDN guidelines, I backed up every file returned by JetGetAttachInfo and JetGetLogInfo.
I've made the backup, erased old database, and copied the backup data to the database folder.
The DB engine was unable to start, the JetInit error code is "JET_errMissingLogFile".
I've checked the backup, it only contains the database file, and "<inst>XXXXX.log" log files. It lacks the current log file (I'm using circular logging, BTW).
Is there any way to restore such backup?
I don't want to use JetExternalRestore API because it's too complex: I don't need to restore to another location, I don't understand why there're 3 input folders not 2, and I don't know the values to supply in genLow and genHigh arguments.
I do need external backups: the ESENT database is used by ASP.NET on a remote server, and I'm backing it up over the Internet.
Or, maybe there's a way to retrieve the name of the current log file, and I should just add it to the backup?
Thanks in advance!
P.S. I've got no permissions to span processes on my web server, so using eseutil.exe is not an option.
Unpack all backed up files to a single folder.
Take the name of your main database file. Replace extension to .pat. Create zero-length file with that name, e.g. database.pat.
After this simple step, call JetRestoreInstance API, it will restore the backup from that folder.