.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Post New Web Links

Linked server to csv file

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :Sql Server
 

I,m using SQL Server 2008 R2 express and i,m trying to use Linked server on a CSV file but i get the message 7303, level 16, state 1 Cannot initialize the data source object of OLE DB Provider. The message also says that the path to the file is incorrect. But i,ve checked that the csv file acually is placed unde C and that i spelled the name correct.  Is something wrong with my script or do i have to do anything that makes the server available (but i,m trying to do this on my C drive wher SQL is installed it,s actually not on a different server)?

The file im trying to connect to is a test file that looks like this.

Name;Date;Amount
Name1;2009-11-01;100,10

And the script i,m using looks like this.

EXEC

 

sp_addlinkedserver

@server

=


View Complete Post


More Related Resource Links

linked server to excel file

  

Hi!

I,m trying to make a linked server connection to an excel 2007 file. I have SQL server 2008 R2 and i have used the code below. When i test the connection to the linked server it works but i still only get this error (se below). I also tried different security settings such as Not be made, Be made without using a security content, Be made using the logins current security content and be made using this security content Remote login = Admin, with password (password left blank). someone and ideas on how to solve this?

 

 

Msg 7399, Level 16, State 1, Line 1

The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "XLFile" reported an error. The provider did not give any information about the error.

Msg 7330, Level 16, State 2, Line 1

Cannot fetch a row from OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "XLFile"

EXEC sp_addlinkedserver
@server = 'XLFile', 
@srvproduct='ACE 12.0',
@provider='Microsoft.ACE.OLEDB.12.0', 
@datasrc= 'C:\File2.xlsx',
@provstr='EXCEL 12.0; Hdr=Yes';
GO

Select *
FROM XLFile...[Sheet1$]

Arne Olsson

scripts file not found on server - 404

  

Fiddler is showing a 404 error when my published web application runs. the jquery.js file in
/scripts is highlighted in red by fiddler as not found. ( IIS log also shows the 404 error ).
I run the web app from visual studio, on local host - no problems. The publish is successful.
All the files are in the scripts folder of the web app on the server.

In the site.master I have:
<script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

Visual studio does not complain about this. ( which indicates the file is found. )

Oddly, when I fully qualify the path, VS says file not found, but after I publish and run, fiddler
shows the jquery file being found and sent to the browser.
<script src="/MvcApplication1/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

when the <script> path is "../../Scripts/jquery-1.4.1.min.js", the fiddler error is
404: /Scripts/jquery-1.4.1.min.js .

when the <script> path is "/MvcApplication1/Scripts/jquery-1.4.1.min.js", fiddler shows the file
being sent to the browser from that /MvcApplication1/Scripts path.

Both the Scripts fol

how to make a css style background image be linked to an image in the resource file

  

hey guy, i need help in a very troubling matter. I want to make a textbox with a specific style, within this style a set of images as background parts, how can i attach these images to the custom control as whenever i take the .dll file and add it to the toolbar the images do not appear. So i tried to make them as resource files and their property as embedded in .resx file, so how to make the css style background image url to be linked to any of those image.


thanks in advance


Uploading to SQL Server using AJAX muiltiple file uploader and dynamic SQL Server Tables

  

I am getting an error on the following code when trying to pload files directly to a database.  

 Incorrect syntax near ','.

 Incorrect syntax near 'image'.

 

    Private Sub Uploader_FileUploaded(ByVal sender As Object, ByVal args As UploaderEventArgs)

        Dim data() As Byte = New Byte((args.FileSize) - 1) {}

        Dim stream As Stream = args.OpenStream

        stream.Read(data, 0, data.Length)

    End Sub

 

Private Sub ButtonTellme_Click(ByVal sender As Object, ByVal e As EventArgs)

 

        Dim objConn As New SqlConnection("Data Source=mrpoteat.db.2798093.hostedresource.com; Initial Catalog=mrpoteat; User ID=mrpoteat; Password=Colgate23;")

        objConn.Open()

        Dim strCommandText As String = ""

        For index = 1 To Attachments1.Items.Count Step 1

            strCommandText += "pic" + index.ToString() + Space(5)

Problem download file from SQL Server

  


Hello everyone. I am having an issue downloading files that I have store in SQL Server. I have no problem in a WinForm. What am I doing wrong in my code?

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Response.Write("Downloading....")

        Dim sch As New clsReport
        Dim fileData As New clsReport.Letter
        fileData = sch.DownloadLetter(Session("LetterID"))
        Dim ms As System.IO.MemoryStream = fileData.fil

        Dim fil As Byte() = ms.ToArray
        Dim nam As String = fileData.name
        Dim ext As String = fileData.ext
        If Not fil Is Nothing Then
            Try
                ' Response.Clear()
                Response.AppendHeader("Content-Disposition", "attachment; filename=" + nam & "." & ext)
                ' Response.AddHeader("Content-Disposition", nam & "." & ext)
                Response.AddHeader("Content-Length", fil.Length.ToString)
                Response.ContentType = "Application/octet-stream"
                Response.Buffer = True
                Response.BinaryWrite(fil)
            Catch ex As Exception
                Response.Write(ex.Message)
            End Try

        End If


    End Su

Insert into SQL Server with ajax file uploader

  

I am getting error in here 

 

Incorrect syntax near '987'

987 is where i put clientname.text

        Dim objCmd As New SqlCommand("Create Table " + clientname.Text + "(name Varchar(50), event Varchar(50), date1 datetime, username Varchar(50), password Varchar(50), " + strCommandText + ")", objConn)

        objCmd.CommandType = CommandType.Text

        objCmd.ExecuteNonQuery()
       
        Dim objConn2 As New SqlConnection("Data Source=dddd.db.2.hostedresource.com; Initial Catalog=mrpoteat; User ID=xxxxx; Password=xxxxxx;")
        objConn2.Open()
        Dim strCommandText2 As String = ""
        For index2 = 1 To Attachments1.Items.Count Step 1
            If String.IsNullOrEmpty(strCommandText2) Then
                strCommandText = "@pic" + index2.ToString()
   &

OpenSearch Descriptor File Generator for SharePoint Server 2007 Sites

  
Learn about the OpenSearch Location Builder Tool, which you can use to create an OpenSearch Description (.osdx) file to connect SharePoint Server 2007 sites to the Windows Client via the OpenSearch protocol.

AssemblyInfo file not present in ASP.NET Server Control Project

  

Hi,

I have created my first Custom asp.net server control.But i think such projects probably contains AssemblyInfo file.But i am missing that. When i created project that file was not added.

I am working on VS 2008 Team System Edition,with VB.NET language.How to get that file ? 


Linked Server to access Excel 2007

  

Hi

I'm tried SELECT * INTO XXX FROM OPENROWSET alongwith Microsoft.ACE.OLEDB.12.0.

Apparently the query requires the sql account to have SYSADMIN privileges.

Considering that SYSADMIN should not be provided to a database account on a Production Server, I tried using the Linked Server method.

Following is my code.


Exec sp_addlinkedserver 'AB2','Ace 12.0','Microsoft.ACE.OLEDB.12.0','\\202.46.215.35\sagarr\Test1\cpc\c2\AB2.xlsx',NULL,'Excel 12.0;IMEX=1'
Exec sp_addlinkedsrvlogin 'AB2','false',NULL,NULL,NULL
go
SELECT * INTO [CPCAB2.xlsx] FROM OPENQUERY([AB2] ,'SELECT * FROM [Sheet1$]')
Exec sp_dropserver 'AB2','droplogins'


Now i get the following error

Error.15247-User does not have permission to perform this action

My Excel file, Database and Windows Application run on separate machines.

i have provided the following privileges

GRANT ALTER ANY LOGIN TO sqlaccount
GRANT ALTER ANY LINKED SERVER TO sqlaccount


EXEC sp_configure 'show advanced options', 1
RECONFIGURE
EXEC sp_configure 'ad hoc distributed queries', 1
RECONFIGURE

The DisAllowAdHocProcess in

Accessing file on remote server

  

Hi,      
       I need help to achieve the following.
 
       I have integrated the Single Sign On to my webapplication. Service Provider(SP) is developing in .net platform and windows server.Identity Provider (IdP) is configured in apache and linux server.
 
       For authentication I am redirecting the user to IdP and authenticate at IdP and return back to my .net website. So I have user's database in IdP as a db file user.db (see the apache configuration below) for authenticating user.
 
          <Location /idp/Authn/RemoteUser>
               AuthType Basic
       &

Insert Excel Data via File Upload into sql server database???

  
Hi all, I have requirement that User can Upload the Excel Sheet Data to sql server Database at once. How i do that Any Article or hint is apperciated.   Regards 

Linked Server to access Excel 2007

  
Hi I'm tried SELECT * INTO XXX FROM OPENROWSET alongwith Microsoft.ACE.OLEDB.12.0. Apparently the query requires the sql account to have SYSADMIN privileges. Considering that SYSADMIN should not be provided to a database account on a Production Server, I tried using the Linked Server method. Following is my code. Exec sp_addlinkedserver 'AB2','Ace 12.0','Microsoft.ACE.OLEDB.12.0','\\202.46.215.35\sagarr\Test1\cpc\c2\AB2.xlsx',NULL,'Excel 12.0;IMEX=1' Exec sp_addlinkedsrvlogin 'AB2','false',NULL,NULL,NULL go SELECT * INTO [CPCAB2.xlsx] FROM OPENQUERY([AB2] ,'SELECT * FROM [Sheet1$]') Exec sp_dropserver 'AB2','droplogins' Now i get the following error Error.15247-User does not have permission to perform this action If I execute the query from Query Analyzer it works fine, but fails when I execute it using Windows App and encapsulate code in Stored Proc. My Excel file, Database and Windows Application run on separate machines. i have provided the following privileges GRANT ALTER ANY LOGIN TO sqlaccount GRANT ALTER ANY LINKED SERVER TO sqlaccount EXEC sp_configure 'show advanced options', 1 RECONFIGURE EXEC sp_configure 'ad hoc distributed queries', 1 RECONFIGURE The DisAllowAdHocProcess in Registry has value 0 Please let me know what additional permissions should i set to get it working???

Linked server to access 2010

  
I keep getting an error when setting up a linked server in sql 2008 R2 x64 to a microsoft access database file (mdb or accdb file).  (The problem occurs on computers with either the 32-bit or 64-bit version of ms office installed).  What are the proper connection string settings?  (This is after right clicking linked servers in ssms and selecting "add new linked server")  The below settings don't work: Provider (from dropdown): Microsoft Office 12.0 Access Database ENgine OLE DB Provider Product name: Access Data source: C:\foopath\foo.mdb  --also doesn't work for foo.accdb Provider string: Microsoft.ACE.OLEDB.12.0 An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "MYLINKEDSERVER". OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "MYLINKEDSERVER" returned message "Could not find installable ISAM.". (Microsoft SQL Server, Error: 7303) I got some exotic errors when following the directions in Books Online (under sp_addlinkedserver). For example: OLE DB provider 'Microsoft.Jet.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apa

No Way to retrieve data from oracle ref:_cursor over T-SQL and linked Server?

  
Hello, for an migration projekt we want to compare results from sp's from oracle and sqlsserver. Same calls should retrieve same results. Also we want build an automatic test for this. But is there now way to retrieve results from oracle sp's whit rev_cursor over linked Server? No one answer to this: http://social.msdn.microsoft.com/forums/en-us/sqldataaccess/thread/2BAC6743-8701-4476-8F36-0377A5761525   greetings Michael

SQL Server JDBC: java.lang.SecurityException: Invalid signature file digest?

  
Hi I am following these instructions for using SQL Server JDBC driver and using sqljdbc4.jar file: http://msdn.microsoft.com/en-us/library/ms378526.aspx When registering the driver to instruct JDBC Driver Manager which driver to load: Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); It throws and exception: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes What does this mean and how do I resolve it? NOTE: I followed a similar posting, but it did not resolve it: com.microsoft.sqlserver.jdbc.SQLServerException.class throws java.lang.SecurityException: http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/ab35688e-ca33-423e-a9bd-54e30fcb5091/ Thanks Jeff in Seattle

Unable to open physical file - Operating system error 5: 5(error not found) Microsoft SQL Server: Er

  
I am trying to attach a database to SQL 2005. This database has not previously been attached. I have only just installed SQL.   I get the following message: Unable to open physical file "C:\ArrowSQL\Arr@Data\Arrow_data.mdf" Operating system error 5: "5(error not found)" (Microsoft SQL Server: Error 5120)".   I have loaded SQL and the database fiel and directory with the same user acccount which is a local adminstrator ont hsi machine. I have checked that I have read/write access to the file.   The machine runs Windows Vista Business. SQL has SP 2 loaded.   What causes this?

Distributed Transactions fail on Linked server

  
We get the below error while performing a distributed transaction on linked server. We have several linked servers configured in the source server and all of them succeed with the distributed transaction except on one.   We did all the basic troubleshooting and moreover the distributed transactions work fine if we use a remote server instead.   Need your expert guidance in resolving this issue     Error:   OLE DB provider "SQLNCLI10" for linked server "SERVERNAME.REDMOND.CORP.MICROSOFT.COM" returned message "No transaction is active.". Msg 7391, Level 16, State 2, Line 3 The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "SERVERNAME.REDMOND.CORP.MICROSOFT.COM" was unable to begin a distributed transaction.     Test code:   begin distributed transaction   select top 10 * from [SERVERNAME.REDMOND.CORP.MICROSOFT.COM].master.sys.objects   ROLLBACK     Source server :      Microsoft SQL Server 2008 (RTM) - 10.0.1779.0 (X64)        Nov 12 2008 12:10:04        Copyright (c) 1988-2008 Microsoft Corporation        Enterprise Edition (64-bit) on Windows NT 6.0 <X64> (Build 6001: Service Pack 1) (VM)     Target server :     Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86)        Jul  9 2008 14:43:34        Copyright (c) 1988-2008 Microsoft Corporation        Enterprise Edition
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend