Reading/writing Files To Network Drive
Mar 20, 2007
We have a package that is using a ForEach loop container to access files on a network drive. For some reason I am getting a message that the ForEach enumerator is empty and did not find any files that matched the pattern. For the pattern I left the default *.* for testing purposes. I have specified the file folder as \remoteserverfilesharesubfolder and also as \remoteserverc$filesharesubfolder and have gotten the same message. However when I map a network drive and set the file folder to the network drive it finds the files. Is this a permissions issue?
After I finish processing the file I want to move it to a new directory. Once this is deployed in production, the package will not be running under a domain account and probably won't have access to the network folder. Is there any way to specifiy in the connection manager itself that it should use a specific account to access the folder?
TIA,
Sabrina
View 1 Replies
ADVERTISEMENT
Feb 16, 2008
I need to select all the records in a table, loop through them one by one, calculating some new field data, and then write the new data back to the same table. Here is the basic structure of what I've come up with:<CODE>SqlCmd = SqlConn.CreateCommandSqlStatement = "SELECT ProductID, Name FROM tblProducts"SqlCmd.CommandText = SqlStatementSqlRdr = SqlCmd.ExecuteReaderIf SqlRdr.HasRows Then While SqlRdr.Read If SqlRdr.FieldCount > 0 Then ... SqlWriteCmd = SqlConn.CreateCommand SqlStatement = "UPDATE tblProducts SET Name = '" & NewName & "' WHERE ProductID = " & CStr(ProductID) SqlWriteCmd.CommandText = SqlStatement SqlWriteCmd.ExecuteNonQuery() SqlWriteCmd = Nothing End If End WhileEnd IfSqlRdr.Close()SqlCmd = Nothing </CODE>I get an error that tells me to close out the Reader before trying to execute the write query. But I can't close it out for the loop to work properly. So I assume that there must be another way to do this simple task, but I'm so new to all of this that I need some help! Thanks!
View 1 Replies
View Related
Jun 13, 2007
I am new to database programming. What I want to do is have a database on a clients PC to use as data storage. This program will connect to a program running on our server (via TCP) which will store this information in another database. The clients database will only be accessed by my program - so I think that I don't need to register it with SQLEXPRESS. The servers database will probably need to be so another program can access it.
The problem I was having was writing and reading to a database that I created inside Visual Studio 2005. As I see it, there could be three issues - reading, writing, or setup of the database. To find out this issue I downloaded the Northwind database. The code below returns column 0 row 0 of the Customers table.
Code Snippet
NORTHWNDDataSet northwindDataSet = new NORTHWNDDataSet();
NORTHWNDDataSetTableAdapters.CustomersTableAdapter customersTableAdapter = new NORTHWNDDataSetTableAdapters.CustomersTableAdapter();
customersTableAdapter.Fill(northwindDataSet.Customers);
string data = (string)northwindDataSet.Customers.Rows[0].ItemArray[0];
Console.WriteLine("COL 0 - ROW 0: " + data);
This code returns "ALFKI". Which is what is in col 0 row 0 (This can be checked by right clicking on the Customers table in NorthWNDdataset.xsd and selecting preview data).
Next is writing. This is where I have the issues. The method below is one way that I tryed.
Code Snippet
DataRow row = northwindDataSet.Customers.NewRow();
row[0] = "1";
row[1] = "2";
row[2] = "3";
row[3] = "4";
row[4] = "5";
row[5] = "6";
row[6] = "7";
row[7] = "8";
row[8] = "9";
row[9] = "10";
row[10] = "11";
northwindDataSet.Customers.Rows.Add(row);
try
{ customersTableAdapter.Update(northwindDataSet.Customers);//table);
northwindDataSet.AcceptChanges();
MessageBox.Show("Update worked");
}
catch
{
MessageBox.Show("Update do not work!");
}
The messagebox shows "Update worked" - yet the data did not get added.
Thanks in advance.
Using:
Visual Studio 2005
C#
SQL Server Management Studio Express
View 3 Replies
View Related
Sep 9, 2004
I'm trying to read a byte array of an image datatype from sql server, and then to put this in another field in the database. I get a byte array, but somehow the image doesn't get into the db well with the sql parameters. Does anyone have an idea how to tackle this problem?
Thanks a lot, Hugo
View 2 Replies
View Related
Nov 22, 2004
Halo, I am a bit new to this
Please can someone help me, I would like to write a file(Any type) to a SQL database like a attached document(s) for the current record and be able to detatch the document when needed.
I use VB.NET for a ASP.NET app.
I basicly would like to attach documents to a piece of equipment may it be any kind and if the user views the equipment he will be able to detatch the documents for that piece of equipment and open it with the correct software.
PLEASE HELP!!!!!!!
View 1 Replies
View Related
Apr 27, 2006
It looks like its not possible to both read and write the same variable from a script using the conventional Me.Variables.<variable> syntax.
I can only assign a variable as Readonly or ReadWrite and not both. If I assign it ReadOnly I can only access it in the PreExecute subroutine. If I assign it ReadWrite I can only access it in the PostExecute subroutine (in fact doesn't this just make it WriteOnly in fact?). So I can only either read in or read out a variable using this syntax, noth both. Is this right?
So the read and write a variable to a script, the VariableDispenser approach is the only option to use. Is this right? and is it documented somewhere that this is how to use variables in scripts. Thanks.
View 13 Replies
View Related
Jul 20, 2007
Hi,
I want to make an application that fills in the variables into a dtsx package (ssis).
I'm able to read the variables created in the package
Application app = new Application();
Package p = app.LoadPackage(pkg, null);
Connections myConns = p.Connections;
foreach( Variable v in p.Variables){
Console.WriteLine(v.Name);
Console.WriteLine(v.Value);
Console.WriteLine(v.Namespace);
Console.WriteLine("/////////////////////");
Console.WriteLine("/////////////////////");
}
i'm also able to add on
Variable myVar = p.Variables.Add("amyCustomVar", false, "User", "3")
When the applications is closed the package does not contain the variable. So this is all done in memory.
Is their a way to actually write the variable into the physical package.
View 1 Replies
View Related
Feb 14, 2008
Hi,
I have a data structure called 'Quote' which contains a number of different variables and controls ranging from text boxes, check boxes and radio buttons, i need to be able to read and write this from a database.
First I think a description of my overall project is needed:
Project Description
I have been given a brief that basically says: i have to create a programmed solution in VB to solve a problem. This problem can be anything we like, and I personally have chosen to create a program that manages quotes for building Log Cabins (this is very contrived and far from anything someone would do in the real world).
My solution will allow a generic user to create a quote (using a form with controls such as text boxes, check boxes, radio buttons) , and then save this to file. These users may then wish to load/edit this quote at a later date, from another form.
Whilst completing this project, i'll only have up to about 5 records (quotes) within the system, so i dont need the ability to store hundreds of records. And each record will be relatively short, with only about 10-15 data items within the data structure.
Also the Admin (or business owner in this case) need to be able to view all saved quotes in a presentable format, and edit them if needs be, from within this same program.
This solution does not need to be absolutely perfect and 100% efficiently coded, or have all the bells and whistles a real-world program would have. This is for an A level computing project by the way.
So basically, i need to be able to read from the database (to populate a Data Grid (i imagine this is best way?)) and so Admin can access any quote and edit it (editing is not vital, but viewing/printing is. Maybe i should stop at just viewing any quote?). Also i need generic users to be able to fill in the Edit Quote form and then save this data into the database.
And is a data structure really required for me to use a database?
I've never used databases in VB before (but have used them elsewhere, mainly Access) and so am completely new to this. Any help will be much appreciated.
Thanks
View 13 Replies
View Related
Apr 27, 2006
I'm doing a test package which reads a flat file, makes an adjustment using the derived column task and writes to the same flat file. But, the read locks the flat file, so the write can't access it. Any ideas for a resolution?
Thanks,
Dave
View 2 Replies
View Related
Apr 24, 2008
I have an SSIS package which accesses a map UNC path drive. It works fine when I run SSIS from Visual Studio. However, when I run this from a SQL Server job, it gives an error.
I am not allowed to use xp_cmdshell due to security reasons. If someone can point me to right direction, that would be greatly appricated.
Thanks
Z
View 20 Replies
View Related
Jul 23, 2005
Hi,When i use to work on Windows 2000 advance server and Sql 2000I was able to do network restoration by using a mapped drive where mybackup use to be lying.What i did was I assigned administrator rightsto my login and in Services (mssqlserver)i added my login.Then I was able to access any mapped drive from my network in Sqlserver 2000.Now i have switched my OS to Windows Server 2003.What I want to know is , is their any other setting that has to donefor network restoration , because after following above steps then to Iam not able to access mapped drive in SQL SERVER 2000.So can anyone help me to know what setting should i do in Windows 2003server or in SQL Server 2000 to do a network restoration of database.Thanks in advanceTV
View 1 Replies
View Related
Sep 12, 2007
Hi I have a simple ftp task that downloads some files from an ftp to a local directory. That package run as a sheduled job from the sql 2005 server without a problem so far.
Now I whant to have the same task but to download the files to different mapped network drives , so I mapped the drives then I changed the paths to the config file but since then the job fails...
is it possible to do that or I did something wrong?
Thanks
g
View 4 Replies
View Related
Jan 15, 2007
Hello,
I need help with the setup of my sql server express 2005 and more specifically, with the location of the database files. Normally, database files are located on the c: drive. In my situation, being in a high school environnement, I need to have the database files on the network drive ... lets call it g:drive. The reason why it cannot be on c:drive is because this drive is protected using DeepFreeze. Now, I was able to change the location of the new drive as I went into the properties window of the sql server instance but when I try to create this new database, sql gives me grief ;-|
I am from the group of people that thinks that to anything, there is a solution and am hoping that to this problem, there is hope of a solution.
Can anyone help?
Thank you
View 1 Replies
View Related
Nov 20, 2001
We're trying to backup some dbs to a network drive but fail.
I read that the 'a/c to run SQLAgent must be a domain user a/c with
proper permission to access the network drive.'
What is proper permission? Read, Write ?
Only the a/c that runs SQLAgent needs the proper permission, the job's owner doesn't?!?
Thanks in advance,
Ben
View 1 Replies
View Related
Nov 25, 2001
I am using SQL2K server. I have a scheduled job which invokes a DTS package. One of the tasks in the DTS package invokes an OS command (from a .bat file) to map a network drive to b made available (dynamically, referring to a mapped drive letter, say "Y" or "Z") in successive tasks to refer to a source or destination TEXT file(s). Basically, the DTS package must be able to refer to the TEXT files (source/destination, depending on the task I have) located somewhere in the network. [ I use the NET USE command in the .bat file to map the network drive.)
The DTS package works stand-alone from SQL Enterprise Manager.
But, when the package is invoked from a scheduled job, the step containing the DTS package fails - the task which maps the network drive fails - access violation /session error...
How do I handle the batch job to overcome this problem?
I appreciate tips/solutions from anyone....
Thanks.
K.K.Rengan
View 1 Replies
View Related
May 4, 2000
Hi guys.
Has anyone ever done SQL DB backup directly onto a maped network drive?
We've got a really huge DB 100GB+ that just wont fit into the local Hard Disk for backup.
Thank you in advance for your help.
Cheers,
Stephen
View 3 Replies
View Related
Nov 14, 2000
I have creted a backup device on network drive and getting the following error when I run the backup command as a job.SQL server and the agent are running on a domain account which has full permission on the network drive.Any help is greatly appreciated.
Thanks!
"Cannot open backup device 'mccdiffbkpond2build'.
Device error or device off-line. See the SQL Server error
log for more details. [SQLSTATE 42000] (Error 3201) Backup or
restore operation terminating abnormally. [SQLSTATE 42000]
(Error 3013). The step failed"
View 1 Replies
View Related
Oct 24, 2000
I am setting up a backup on one of my DB's and the network drive does not appear as an location that I can backup too. Only the C drive is present. However, on the server I do have a drive mapped to the network drive, so it should be available. Has anyone encountered this issue before?
Thanks!
Scott
View 10 Replies
View Related
Oct 23, 1998
I need to know if there is a way to perform a SQL Server 6.5 backup to a remote network drive WITHOUT USING A TRUST LOGIN.
My network administrator refuses to put a TRUST relation on the Primary Domain Controller. I`m not really sure why, but I need a workaround.
Thanks,
"Work-around Bob"
View 1 Replies
View Related
Feb 2, 2004
Hi there,
Does anyone know if it's possible to perform a MSSQL7 database backup on a network drive instead of the local drives ?
...and if yes, how to proceed ?
It seems to be possible under MSSQL2000.
Many thanks for your help in advance,
Matt
View 6 Replies
View Related
Nov 29, 2007
I know , it is not going to work , just wondering if anyone could give any reasons for that. Whether it was intentional constraint or just internally compact edition was designed in particular way which makes such a usage not possible. It is a pity that it doesn't work that way as it would be much easier transitional path for many Visual Foxpro , MS Access applications.
In my case I just want READ-ONLY database either for multi-user access via shared drive or stand-alone on local drive.
View 1 Replies
View Related
Mar 17, 2008
HI
i am trying to take a backup on Network drive but i am getting following error message. althought when i try to type the address in window explorer. i can access the specific folder. so that there shouldn't be network security issue.... and even thought the backup device name is correct.
when i try to take backup on local disk, it work's fine....
Executed as user: NT AUTHORITYSYSTEM. Cannot open backup device 'FullBackup(\0.0.0.0SQL_BackupsFullBackupsFullBackup.bak)'. Operating system error 5(error not found). [SQLSTATE 42000] (Error 3201) BACKUP DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed.
View 6 Replies
View Related
Oct 4, 2006
Sql server prompts "access denied"
while firing the following query
EXEC master..xp_cmdshell 'dir \servernamesharedfolder*.* '
how to access the folders and files existing in network drive.
View 3 Replies
View Related
Apr 23, 2008
I am having difficulty getting both xp_cmdshell and the Scripting.FileSystem to work via sp_OACreate/sp_OAMethod with files residing on network drives . I am able to create/move/copy/delete files on local drives through both of these methods, but when I specify a network drive as the target an operation requiring write access I get an "Access is Denied" error. I recognize that the SQLServer service account is being used to perform these operations, and I have granted Full control permissions to this user on the directory I'm trying to perform the operation on. Is there some other permission either on the SQLServer or Windows account that is required to enable write access from T-SQL?
--Listing of network directory works fine:
EXEC xp_cmdshell 'dir \Gol-devftprootgolsolgolEngMaint';
GO
Volume in drive \Gol-devftproot has no label.
Volume Serial Number is 5493-88CD
NULL
Directory of \Gol-devftprootgolsolgolEngMaint
NULL
04/23/2008 12:37 PM <DIR> .
04/23/2008 12:37 PM <DIR> ..
03/28/2008 01:56 PM <DIR> 40083388
04/23/2008 12:37 PM <DIR> 4008343A
04/23/2008 11:05 AM 230 4008343a.task
12/18/2007 12:15 PM <DIR> 4008CE92
04/23/2008 08:41 AM <DIR> 4008D108
04/22/2008 06:40 PM <DIR> 4008D134
04/21/2008 02:46 PM <DIR> 4008D15D
03/05/2008 10:14 PM <DIR> 4008D1BA
02/12/2008 04:41 PM <DIR> 4008D1FA
10/29/2007 11:06 PM <DIR> 4008D583
04/21/2008 02:41 PM <DIR> CMU
04/22/2008 02:25 PM 313 ESN_All.task
09/05/2007 11:22 AM <DIR> HotSpot
04/23/2008 07:25 AM <DIR> M4008CEC7
04/23/2008 07:56 AM <DIR> M4008D1BC
04/22/2008 05:24 PM <DIR> M4008D1CF
04/21/2008 02:43 PM <DIR> MEU3
04/21/2008 02:43 PM <DIR> Tools
2 File(s) 543 bytes
18 Dir(s) 25,083,801,600 bytes free
-- Local copy works fine...
EXEC xp_cmdshell 'COPY C:TestLoad4008D1FA4008D1FA.TASK C:Temp';
GO
1 file(s) copied.
-- Copy to network drive fails
EXEC xp_cmdshell 'COPY C:TestLoad4008D1FA4008D1FA.TASK \Gol-devftprootgolsolgolEngMaint';
GO
Access is denied.
0 file(s) copied.
View 8 Replies
View Related
Oct 13, 2000
In 6.5 , I was NOT able to use mapped network drive for new database
device if the MSSQLSERVER service is running under local system account,
but if I changed it to using a domain a/c which has the authority to
create files on mapped drive, I was able to do it.
But if I tried it in 7.0, it never work and got msg:
Server: Msg 5105, Level 16, State 2, Line 1
Device activation error. The physical file name 'e:est2.mdf' may be
incorrect.
Server: Msg 1802, Level 16, State 1, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check
previous errors.
Is it something that's normal for 6.5 and 7.0 ????
i.e. we can only create databases on LOCAL drives ?
I am just thinking of in case we run of space locally, we can temporarily
make use of remote mapped network drive. (say at time of upgrading)
Any one has this experience ?
View 2 Replies
View Related
Aug 6, 2003
I am new to the DB Administration.
How do i back up the data to a network drive mapped on a day to day basis.
View 4 Replies
View Related
Jul 11, 2007
Good Morning,
I'm hoping that someone can help me. I have a SQL 2005 SSIS package that will run Friday mornings to empty/load a table with data from another database. On Friday evenings I'll need to run another package, but want to make sure the table load completed prior to launch. For this I planned to use a file watcher task, however I cannot for the life of me figure out how to output a 'done' semaphore, from the morning job, to a networked drive.
A file system task will not work because there is not a 'create file' option. I do not have an existing file that I can rename either.
I tried an execute process task running cmd.exe with the following argument:
Code Snippetecho Done> \NetworkedServerftprootLoad.Done
This fails because UNC paths are not recognized. (The package executes from another server so I cannot use a local path, nor am I allowed to set-up a local share.)
Can someone offer an alternative suggestion? I'm really hoping this is easier than I'm making it.
Thank you in advance,
Roger
View 3 Replies
View Related
Dec 8, 2007
I have a network drive that is mapped as Z: on my local machine. When creating a new database, that drive does not show up in the list of available paths. If I try to hardcode the drive/path info, I get an error message: "The system cannot find the path specified."
View 1 Replies
View Related
Jun 18, 2007
I am using SQL Server 2005 Express Edition. I am planning on upgrading to either Workgroup or Standard edition. While working with Express Edition I did find out that this version does not support backup to a network drive.
My question is:
Is it possible to backup directly to a network drive using a Workgroup/ Standard edition of SQL Server rather than backing up to a local drive and then 'copy and paste' to a network drive like the Express Edition.My other question is :
Given a database limit of 50GB, which one of the editions, Workgroup or Standard, will be appropriate for use.Thank you for your time and patience.
Regards
Berly Sam
View 4 Replies
View Related
May 27, 2007
Hi,
I have created an sql server 2005 maintenance plan for a daily backup. The plan has two 'Back up database task' i.e. one backup on the local drive while the second on a network drive. When the plan is executed, a backup is created on the local drive but not on the network drive. If i check the log, it says "Access Denied" whereas i have full access to the network drive with complete permissions to read, write and delete.
Can anyone help me understand how to take a backup on both a local and network drive at the same time using a maintenance plan ? I shall be obliged...
Regards...
View 2 Replies
View Related
Jan 6, 2000
Hi
I am having an Access database on a shared network drive which has read/write access rights on the that shared network drive.
When I try to Access data through the linked server it gives me gives me a message box saying you do not have permissions to view the data.
Also if i try to use xp_cmdshell to copy over the mdb file to my local drive it say 'Access denied'
But when I copy (through command prompt) the same file to another network drive or my local drive where I have full control the linked server can connect sucessfully.
The problem is the i cannot have 'full control' permissions on shared drive where my database resides.
Has anybody encountered this problem....
Any help will be greatly appreciated.
Urgent
Puru
View 1 Replies
View Related
Jan 30, 2008
Hi!
What is the fastest whay to take the resultset
from an temporary table (# table)
and write it to an remote destination (mapped network drive)
initiated from stored proc?
Similar question if I take the resultset and convert it to xml (using FOR XML clause)
and want it written to disk.
Thank you for your ideas ;-)
View 3 Replies
View Related
Apr 29, 2008
I recently created a program that connects to a Microsoft SQL database that was stored on my computer and it worked fine. As soon as I tried to connect to the same database via a network drive I got an error stating that "The file Y:Filename.mdf is on a network path that is not supported for database files.". I can't seem to get it to work, if anybody has any ideas what I'm doing wrong I would appreciate your help.
Don
View 5 Replies
View Related