all groups > sql server programming > august 2004 >
You're in the

sql server programming

group:

OPENROWSET using http



OPENROWSET using http Anubis
8/11/2004 11:16:30 PM
sql server programming: Hello,

Thank you to oj who helped me get this far...

I have one final question remaining with the OPENROWSET function...

SELECT *
FROM OPENROWSET ('Microsoft.Jet.OLEDB.4.0',
'Text;Database=http://192.168.0.50/Texts/;HDR=YES;FMT=Delimited','SELECT *
FROM TextFile1.csv') AS TableA

When I attempt to run this I get the following error:

Server: Msg 7399, Level 16, State 1, Line 6
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.
[OLE/DB provider returned message: Internal internet failure.]


The URL is correct as I can successfully get the directory listing.

Any help with this would be great, however just to answer your questions...

No, I can't simply use a directory listing such as C:\Texts\ or \\MyPC\Texts
as these are unavailable in my situation.

Thanks

-Steve

RE: OPENROWSET using http John Bell
8/11/2004 11:53:01 PM
Hi

I guess using a UNC address is also not possible?

Having never used or seen openrowset being used in this way I can only guess
that it is either permissions for the service account acessing http or
permissions on the temporary directory such as
http://support.microsoft.com/default.aspx?scid=kb;en-us;296711

You may want to request the file and handling into two stages.

John

[quoted text, click to view]
Re: OPENROWSET using http Anubis
8/12/2004 12:02:13 AM
Hello John,

You guessed right.. UNC not possible...

How could I split the process into two stages?

Thanks
-Steve



[quoted text, click to view]

Re: OPENROWSET using http oj
8/12/2004 12:11:05 AM
OLEDB provider cannot reference an url as a datasource. Thus, you cannot
reference an url. The datasource has to be somewhere that sqlserver
(executed under sqlserver service or proxy acct depending user's security
level) can get to.

1. Read up on xp_cmdshell and pay attention to the proxy acct stuff; this
should give you some understanding as to how sqlserver accesses network
resources.
2. Read up on sp_oa*; you can access external data on the web by invoking
'msxml2' provider.


[quoted text, click to view]

Re: OPENROWSET using http Anubis
8/12/2004 12:33:32 AM
Hello Oj,

I have got the OPENROWSET to work however the URL couldn't have any sub
DIR's

Database=http://server/folder <== Generated an error
Datebase=http://server/ <== Retruned the results as did
Database=ftp://server/

This functionality seems to be built into this function however it appears
as though is isn't documented.

Thanks to all for your help!
-Steve



[quoted text, click to view]

Re: OPENROWSET using http oj
8/12/2004 4:27:19 PM
Thanks for the update. I did not know such was even possible.

[quoted text, click to view]

Re: OPENROWSET using http Anubis
8/12/2004 5:34:47 PM
After a little more testing I have been able to suite it to my
application...

It seems as though using FTP is the easiest way (and is quite quick too).

With FTP I can use a sub dir such as

ftp://server/folder and I can even use authentication such as
ftp://admin:pass@server/folder

Using http still generates an error of "Cannot find '' " but as long as FTP
works I've got no problems.

Thanks Oj for all your help you've certainly saved me some hair!

-Steve




[quoted text, click to view]

AddThis Social Bookmark Button