Can someone please help me to understand a simple batch file? Supposedly, this batch file is supposed to pull information from an MS Access database named "Widgets" in preparation for upload to an off-site server. So I am double-clicking on the file on my PC, which pulls data from tables in a database that is physically located on a different PC (local server) in my office. Then it exports to an excel file which is uploaded to an off-site server. Here is the script:
"C:\Program Files\Microsoft Office\Office11\msaccess.exe" "C:\Backup\Widgets.mdb" /X Job_Search_Export_Macro
It doesn't seem to be working - after running it I can see the excel file that it creates. What I can't see is if the off-site server is grabbing the data. What am I doing wrong? I hope I have provided enough background information.
All that batch file does is start MS Access and instruct Access to open the Widgets.mdb* database and run a macro called Job_Search_Export_Macro (/X is a command line switch for msaccess.exe that tells it to invoke the specified macro). The batch file doesn't actually do any of the other stuff you described. It's the macro that's purported to do that, and if it's not working, the problem lies in the macro's VBA code, not the batch file.
Since the question just asks to explain the batch file, I'm posting this as an answer. If you want to resolve the problem, you'll need to provide the macro's code, and add the vba and ms-access tags.
Related
Unable to install SQL Server (setup.exe). Exit code (Decimal):
-2054422498Exit message: The specified directory, "C:\Program Files\Microsoft SQL Server)", for the INSTALLSHAREDDIR parameter is not valid because this directory is compressed or is in a compressed directory. Specify a directory that is not compressed.
I have already unchecked the Compress contents to save disk space option in advanced properties of the folder as suggested in another similar questions here.
Please help me figure out the solution to install SQL Server.
You have to remove compression.
Like I asked in the question, I had already unchecked the Compress contents to save disk space option in advanced properties of the folder however the same changes were required in the parents folder too (topsail's comment).
So I repeated the same steps as shown MBuschi's answer to the parent folder too and it worked fine.
I'm using an SSIS package to unzip a file that's on another server. I've looked around for solutions and can only see answers for files that are on the same server. I found this answer but couldn't get it working - how to unzip rar files which are in remote server using ssis task
I thought referencing the server like this would work in the arguments field on an execute process task, but it didn't:
x backup.gz "-o\\server\E$\folder\backup.gz"
I can use a batch file but it still doesn't work, I feel like I'm referencing the server wrong?
I'm posting this rather odd issue here in the remote chance that someone has come across this before, or possibly just has an idea or two about what I could try or check next because I'm stumped.
Summary: SQL 2008 SSIS package tasks that attempt to create files with .zip extension fail with
"Access to the path is denied"
Detail: This first occurred in a test environment with a package that works fine in Dev (and Prod). The part that makes this problem odd is that it is all about the File Extension, not security. I mention this now to curb replies about checking the security (SSIS Account, Directory Level permissions etc.) :- it's not that, 100%.
So, I've built an SSIS package as a proof of behavior, that takes 3 files (a.txt, b.txt, c.txt) and respectively for
(a) uses CozyRoc Zip to Create a Zip,
(b) uses a script task to create a .zip (using GZipStream - I know this creates a GZIP not a ZIP but bear with me...) and
(c) native SSIS File System Task copies the file from c.txt to c.zip (yes, creating a .zip file that is not really a zip file).
All Three fail with the above message - the .ZIP files are created for (a) and (b), but remain at 0 length. (For (c) just the error message).
Now, I edit the SSIS package and change the extensions of the destinations (to .ZOP or .ZIP2 or .GZ or .ANYTHING), and all 3 work perfectly. And this is obviously how I know that it's the .ZIP extension not a "normal" security issue.
So I've initially assumed this is a one-off on this test server because it was the only place it happens, but I've found another box (build rehearsal) on which exactly the same problem exists. I've tried associating .ZIP with various different programs (Windows Explorer, WinZip, 7Zip, WinRar & "no program") and nothing works, and I've googled the problem to death with no luck yet.
I've tried creating .ZIP files with the various installed archive programs using their GUIs and they all work fine. Existing .ZIP files can be unzipped using CozyRoc. Existing .GZ (GZIP) files renamed to .ZIP can be unzipped using the script GZipStream decompress. And I can rename files to and from .ZIP using SSIS or Explorer/CMD. It's just SSIS (specifically SSIS) creating a file with extension .ZIP (specifically .ZIP) throws this error.
I'm starting to suspect it might have something to do with SSIS thinking that .ZIP is an archive "folder" not a ".ZIP File" but I don't know where to go with this idea, proving it or fixing it.
Any ideas at all? - at my wits end!!
Thanks in advance
P.S. The "obvious" answer of using .ZIP2 and renaming is not an option, there are (literally) hundreds of packages running in production that create .ZIP files and packages need to move from Test to Prod without modification. I really need a solution, not a workaround, in this instance if there is one.
This turned out to be a RedGate tool (HyperBac) having a file association with .ZIP extension files (amongst others). Hyperbac's monitoring of .ZIP files appears to have clashed with SSIS's attempt to write to the .ZIP file, as procmon reported shared file access violations, causing a spurious ACCESS DENIED error to be reported by the package.
Since use of the tool is necessary on our environments, I was able to solve the problem by deleting the .ZIP association using the GUI ("Hyperbac Configuration Manager" > "Extensions" > Ext=.ZIP, Delete)
What is the default SSIS Account that is used in SSIS packages.
In one of my packages I have a Data Flow task that creates a flat file. A BAT file later runs and creates a file based on information in that .txt file. If I execute the .BAT in Windows Explorer it runs fine. When SSIS tries to execute it I can see the CMD window open and it tries to access the txt file and isnt able to. Says "Unable to access nameoffile.txt"
I assume the issue is that the permissions are probably inherited by the SSIS user account so I am trying to figure out which account that is.
If you are running it from the IDE then it uses your permissions. Most likely the problem is that your file is locked by some other process in your SSIS package. To verify:
Add a PAUSE to your batch file to make it wait for any key.
Run your package. While the dos prompt is waiting, go into windows explorer and run your batch file again - you'll find the same error.
I changed the attrib value in dos for that specific folder by attrib -r -s and it worked. It thought it was read-only.
I am using Windows Server 2012 server, with a SQL Server 2012 database.
Adding Modify, Read, Write permissions to the folder containing the required file to the NETWORK SERVICE user seems to work for me.
I have a batch file which starts a Java server class. The output of the Java is redirected to a log file. This batch file is stared via a windows service. Problem is this log file is becoming very huge. Since the Java server is running, it is not possible to do any modification in the Log file as it is locked. How can I create a new log file for every day?
My idea was to write another batch file which will stop the service, backup the existing log file, delete and start the service file again. Is this approach correct?
java -Xms32m -Xmx256m gtServer >> abclog.txt
Above is the code in the batch file which starts the sever
Any tips on how we could back up the file without stopping the java server?
Thanks in advance
Karthik
Heard about log4j?
Ok, seriously, would it be possible to use some proper logging facility? It usually provides something for this purpose like RollingFileAppender.