Tuesday, March 20, 2012

rs.exe and Oracle

I am trying to create a .rss file that deploys my reports to the report
server. I have everything working except for the creation of the datasource.
The problem is that I am using an Oracle database and I cannot set the
correct setting in my code.
I can create a datasource; but I have to log into the report server and
change the "Connect Type" dropdown to "Oracle" to get the datasource to work.
The below bit of code works (notice I am setting the Extension to SQL)
...
Dim definition As New DataSourceDefinition()
definition.CredentialRetrieval = CredentialRetrievalEnum.Store
definition.ConnectString = connectionString
definition.Enabled = True
definition.Extension = "SQL"
definition.ImpersonateUser = False
definition.ImpersonateUserSpecified = True
definition.WindowsCredentials = False
...
The below code DOES NOT work (I am setting the Extension to Oracle)
...
Dim definition As New DataSourceDefinition()
definition.CredentialRetrieval = CredentialRetrievalEnum.Store
definition.ConnectString = connectionString
definition.Enabled = True
definition.Extension = "Oracle"
definition.ImpersonateUser = False
definition.ImpersonateUserSpecified = True
definition.WindowsCredentials = False
...
There has to be some easy change here to get this to work with an Oracle
database, I just cannot find out what the Oracle string is to set the
Extension.
Any ideas? Thanks for any help or suggestion.
RobRob,
Here is my rs code that worked for me, looks the same but maybe give it a
shot, the only thing i see if you have "Oracle" and i have "ORACLE", not sure
if that is it.:
Dim Definition As New DataSourceDefinition
Dim Properties(1) As [Property]
Dim Description As New [Property]
Dim Hidden As New [Property]
Description.Name = "Description"
Description.Value = "DataSourceDescription"
Hidden.Name = "Hidden"
Hidden.Value = "False"
Properties(0) = Description
Properties(1) = Hidden
Definition.CredentialRetrieval = CredentialRetrievalEnum.Store
Definition.UserName = "UserName"
Definition.ConnectString = "Data Source=DATABASE;Unicode=True"
Definition.Enabled = True
Definition.Extension = "ORACLE"
Definition.WindowsCredentials = False ' (Prompt and Store)
Definition.ImpersonateUser = False ' (Store)
Definition.EnabledSpecified = True
Definition.ImpersonateUserSpecified = True
Definition.OriginalConnectStringExpressionBased = False
Definition.UseOriginalConnectString = False
"Rob" wrote:
> I am trying to create a .rss file that deploys my reports to the report
> server. I have everything working except for the creation of the datasource.
> The problem is that I am using an Oracle database and I cannot set the
> correct setting in my code.
> I can create a datasource; but I have to log into the report server and
> change the "Connect Type" dropdown to "Oracle" to get the datasource to work.
> The below bit of code works (notice I am setting the Extension to SQL)
> ...
> Dim definition As New DataSourceDefinition()
> definition.CredentialRetrieval = CredentialRetrievalEnum.Store
> definition.ConnectString = connectionString
> definition.Enabled = True
> definition.Extension = "SQL"
> definition.ImpersonateUser = False
> definition.ImpersonateUserSpecified = True
> definition.WindowsCredentials = False
> ...
> The below code DOES NOT work (I am setting the Extension to Oracle)
> ...
> Dim definition As New DataSourceDefinition()
> definition.CredentialRetrieval = CredentialRetrievalEnum.Store
> definition.ConnectString = connectionString
> definition.Enabled = True
> definition.Extension = "Oracle"
> definition.ImpersonateUser = False
> definition.ImpersonateUserSpecified = True
> definition.WindowsCredentials = False
> ...
> There has to be some easy change here to get this to work with an Oracle
> database, I just cannot find out what the Oracle string is to set the
> Extension.
> Any ideas? Thanks for any help or suggestion.
> Rob
>|||One other thing, I posted this before, but here is how you can debug a RS.exe
script. Not sure if this is any help on this issue but can help down the road.
In Visual Studio
1. Create a new Visual Basic Console Application Project: name it RSDebug
2. In the Soultion Explorer window - right click on the RSDebug Project and
select the Add Web Reference option.
3. In the URL text box add:
http://servername/reportserver/reportservice2005.asmx
4. Click Go Command Button (This step takes a while)
5. In the Web Reference Name text box add SSRSWebService
6. Click Add Reference Command Button
7. In the Code Window above the Module Module1 add: Imports
RSDebug.SSRSWebService
Imports
System.Web.Services.Protocols
8. Below the Module Module1 add: Public rs As New ReportingService2005
9. Paste your script code in the Sub Main() procedure
10. Set your breakpoint and go.
Example: (In this example System.IO is needed due to the use of the
MemoryStream object)
Imports RSDebug.SSRSWebService
Imports System.Web.Services.Protocols
Imports System.IO ' This was added because MemoryStream was used
Module Module1
Public rs As New ReportingService2005
Sub Main()
Dim strObjectName As String = "Report Name"
Dim strObjectPath As String = "/Application"
Dim strObjectFullPath As String = strObjectPath & "/" & strObjectName
Dim strLocalFile As String = "Report Name.rdl"
Dim strLocalPath As String = "C:\"
Dim strLocalFullPath As String = strLocalPath & strLocalFile
Dim objReportDefinition As Byte()
Dim objMemoryStream As MemoryStream
Dim objDocument As New System.Xml.XmlDocument()
Try
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
objReportDefinition = rs.GetReportDefinition(strObjectFullPath)
objMemoryStream = New MemoryStream(objReportDefinition)
objDocument.Load(objMemoryStream)
objDocument.Save(strLocalFullPath)
Console.WriteLine("Standard: Report downloaded successfully.")
Catch e As SoapException
Console.WriteLine("Error: " +
e.Detail.Item("ErrorCode").InnerText + " (" +
e.Detail.Item("Message").InnerText + ")")
End Try
End Sub
End Module|||YES!!!
That was it. I used:
Definition.Extension = "ORACLE"
and the datasource was created successfully. Thank you so much for your
help. Sometimes the answer is right in front of your eyes yet one cannot see
it.
Once again, thanks.
Rob
"Reeves Smith" wrote:
> Rob,
> Here is my rs code that worked for me, looks the same but maybe give it a
> shot, the only thing i see if you have "Oracle" and i have "ORACLE", not sure
> if that is it.:
> Dim Definition As New DataSourceDefinition
> Dim Properties(1) As [Property]
> Dim Description As New [Property]
> Dim Hidden As New [Property]
> Description.Name = "Description"
> Description.Value = "DataSourceDescription"
> Hidden.Name = "Hidden"
> Hidden.Value = "False"
> Properties(0) = Description
> Properties(1) = Hidden
> Definition.CredentialRetrieval = CredentialRetrievalEnum.Store
> Definition.UserName = "UserName"
> Definition.ConnectString = "Data Source=DATABASE;Unicode=True"
> Definition.Enabled = True
> Definition.Extension = "ORACLE"
> Definition.WindowsCredentials = False ' (Prompt and Store)
> Definition.ImpersonateUser = False ' (Store)
> Definition.EnabledSpecified = True
> Definition.ImpersonateUserSpecified = True
> Definition.OriginalConnectStringExpressionBased = False
> Definition.UseOriginalConnectString = False
>
> "Rob" wrote:
> > I am trying to create a .rss file that deploys my reports to the report
> > server. I have everything working except for the creation of the datasource.
> > The problem is that I am using an Oracle database and I cannot set the
> > correct setting in my code.
> >
> > I can create a datasource; but I have to log into the report server and
> > change the "Connect Type" dropdown to "Oracle" to get the datasource to work.
> >
> > The below bit of code works (notice I am setting the Extension to SQL)
> > ...
> > Dim definition As New DataSourceDefinition()
> > definition.CredentialRetrieval = CredentialRetrievalEnum.Store
> > definition.ConnectString = connectionString
> > definition.Enabled = True
> > definition.Extension = "SQL"
> > definition.ImpersonateUser = False
> > definition.ImpersonateUserSpecified = True
> > definition.WindowsCredentials = False
> > ...
> >
> > The below code DOES NOT work (I am setting the Extension to Oracle)
> > ...
> > Dim definition As New DataSourceDefinition()
> > definition.CredentialRetrieval = CredentialRetrievalEnum.Store
> > definition.ConnectString = connectionString
> > definition.Enabled = True
> > definition.Extension = "Oracle"
> > definition.ImpersonateUser = False
> > definition.ImpersonateUserSpecified = True
> > definition.WindowsCredentials = False
> > ...
> >
> > There has to be some easy change here to get this to work with an Oracle
> > database, I just cannot find out what the Oracle string is to set the
> > Extension.
> >
> > Any ideas? Thanks for any help or suggestion.
> >
> > Rob
> >
> >

No comments:

Post a Comment