Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 'CSV file is allready exclusively opened'

Author  Topic 

djorre
Yak Posting Veteran

94 Posts

Posted - 2009-06-27 : 06:27:56
Hi friends,

I got this 'LabJack U12' USB-PLC device that logs it's tags into a csv file every 0.2 seconds. I want to report real time with reporting services. So I created a linked server on sql2008 express:

/****** Object: LinkedServer [LabJackLOG] Script Date: 06/27/2009
EXEC master.dbo.sp_addlinkedserver @server = N'LabJackLOG', @srvproduct=N'Jet 4.0', @provider=N'Microsoft.Jet.OLEDB.4.0', @datasrc=N'c:\LabJackLOG', @provstr=N'Text'

The problem is that this does not work when the csv file is being appended by the LabJack logging program, and that is, all the time.

select thetime from LabJackLog...logging#csv

OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "LabJackLog" returned message "The Microsoft Jet database engine cannot open the file ''. It is already opened exclusively by another user, or you need permission to view its data.".
Msg 7306, Level 16, State 2, Line 1
Cannot open the table "logging#csv" from OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "LabJackLog".

When I disable the logging, it does work. But that's not good. How can I workaround this in sql2008? I only need reading permissions. Maybe I can create a vb program that copy's the csv every 5 minutes but I don't know, maybe this can be done in sql2008 stored procedures? Is there a possiblility for that? Or for giving me the rights to open it read only?

Greetings,

Joris

djorre
Yak Posting Veteran

94 Posts

Posted - 2009-06-27 : 06:48:52
Ok I got it, simply add

EXEC master..xp_CMDShell
'copy c:\LabJackLog\logging.csv c:\LabJackLog\loggingsql.csv'

to the query and then use logginsql.csv...
Go to Top of Page
   

- Advertisement -