Showing posts with label built. Show all posts
Showing posts with label built. Show all posts

Thursday, March 22, 2012

ASP COM and database access

Hello All,

I am currently creating a browser interface for our thick client which
was built on Visual Basic using COM ( a three tier environment). We
support environments where the SQL database server is separate from the
application server.

The problem I am facing is this.

When I try to access the database server from the ASP page through the
COM object, I get access denied. This is because the COM is running
under the IWAM account and it does not have access to the database
tables. Since this is a system account I cannot add it to the database
server which is on a different machine possible a different domain too.
When I gave anonymous access to the database server, it worked fine but
this is obvously not a solution I want. The other option is to create a
COM+ wrapper for every objects (possibly 100)which can be run under a
specific account. But this will be a huge task.
Are there any other options? Any ideas are appreciated.
Thanks
SatishHi.I think this id COM fault not Database server.

Try to change access permissions using "dcomcnfg". On the Server where
IIS running.
Add IWAM account to allow access and to launch com objects.
It woks fine in my case. And i had the same situation.

sss wrote:
> Hello All,
>
> I am currently creating a browser interface for our thick client
which
> was built on Visual Basic using COM ( a three tier environment). We
> support environments where the SQL database server is separate from
the
> application server.
>
> The problem I am facing is this.
>
> When I try to access the database server from the ASP page through
the
> COM object, I get access denied. This is because the COM is running
> under the IWAM account and it does not have access to the database
> tables. Since this is a system account I cannot add it to the
database
> server which is on a different machine possible a different domain
too.
> When I gave anonymous access to the database server, it worked fine
but
> this is obvously not a solution I want. The other option is to create
a
> COM+ wrapper for every objects (possibly 100)which can be run under a
> specific account. But this will be a huge task.
> Are there any other options? Any ideas are appreciated.
> Thanks
> Satishsql

Tuesday, March 20, 2012

ASP + ADO + SQL 2005, new column [ORD ID]?

I'm developing some queries using ASP with a componente built in Visual basic 6.0 SP6, I get the data using ADO to a SQL 2005 (version 9.0.1406) when I run a code like this:

Code Snippet

Sub ShowRs(rsAuxi)
Dim Campo
Response.Write "

"
Response.Write " Ord ID"
For Each Campo In rsAuxi.Fields
Response.Write " " & Campo.Name & ""
Next
Response.Write ""
Do While Not rsAuxi.EOF
Response.Write " "
Response.Write " " & rsAuxi.Absoluteposition & ""
For Each Campo In rsAuxi.Fields
Response.Write " " & Campo.Value & ""
Next
rsAuxi.MoveNext
Response.Write ""
loop
Response.Write "

"
end sub

the ADO execute a Store Procedure like this:

Code Snippet

CREATE PROCEDURE [dbo].[SP_TPO_REQ_HEAD]
AS
SET NOCOUNT ON
BEGIN
SELECT
[COD_REQ_HEADER],
[NUM_REQ_HEADER],
[FECHA]
FROM [dbo].[TPO_REQ_HEADER]
END

I supose that when I draw the ADO recordset in the ASP (using the frist code) I get a table with 3 columns, but I get a table with 4 fields!!! and the first column is ORDER ID, now my question is WHO IS ADDING THIS NEW COLUMN?

Thanks in advance

JJ

You must have been executing another procedure than the one mentioned above. Another attribute is not just added automagically.

Jens K. Suessmeyer

http://www.sqlserver2005.de

|||

The problem is your own code, which is adding the "new colunm":

' Your code, commented

Sub ShowRs(rsAuxi)

Dim Campo

Response.Write "<table border=1><tbody><tr>"

' This adds the Heading for the Ord ID "field"

Response.Write "<td class=TipoLetra>Ord ID</td>"

' This adds the heading for the fields returned in the Stored Procedure / in your example, 3 fields

For Each Campo In rsAuxi.Fields

Response.Write "<td class=TipoLetra>" & Campo.Name & "</td>"

Next

Response.Write "</tr>"

' This iterates as many records as your recordset (returned from stored procedure)

Do While Not rsAuxi.EOF

Response.Write "<tr>"

' THIS ADDS THE "FIELD", which is just the record number in the recordset !

Response.Write "<td class=TipoLetra>" & rsAuxi.Absoluteposition & "</td>"

' This iterates as many fields in each record, as returned in the recordset (3 in your example)

For Each Campo In rsAuxi.Fields

Response.Write "<td class=TipoLetra>" & Campo.Value & "</td>"

Next

rsAuxi.MoveNext

Response.Write "</tr>"

loop

Response.Write "</tbody></table>"

end sub

|||

thanks... I guess that I need a long vacations...

Thursday, March 8, 2012

AS/400 Parameters

Connected to AS/400 server through ODBC. Can submit queries, just built a matrix report, looks good.

However I want to incorporate a Parameter and have tried prefacing the parameter COSTCENTER with everything under the sun:

@.COSTCENTER (SQL Server version of parameter declaration)

:COSTCENTER (Oralce version of parameter declaration)

%COSTCENTER

#COSTCENTER

etc. etc.

I keep getting the same error:

Error in WHERE clause near '@.'. Unable to parse query text.

My inquiries are as follows:

1. Can you use parameters with an AS/400 connection?

2. If yes, howshould the parameter be declared?

I searched BOL, GOOGLE, so far nothing...

Which ODBC driver are you using?

AS/400 Parameters

Connected to AS/400 server through ODBC. Can submit queries, just built a matrix report, looks good.

However I want to incorporate a Parameter and have tried prefacing the parameter COSTCENTER with everything under the sun:

@.COSTCENTER (SQL Server version of parameter declaration)

:COSTCENTER (Oralce version of parameter declaration)

%COSTCENTER

#COSTCENTER

etc. etc.

I keep getting the same error:

Error in WHERE clause near '@.'. Unable to parse query text.

My inquiries are as follows:

1. Can you use parameters with an AS/400 connection?

2. If yes, howshould the parameter be declared?

I searched BOL, GOOGLE, so far nothing...

Which ODBC driver are you using?

Wednesday, March 7, 2012

AS Cube as DataSet for RS Multi-Value & Range Parameters?

Platform: All SQL '05 Std

I'm struggling with two issues involving the use of AS Cube data as parameters in a SSRS Report.

Background: I've built a report exclusively using an AS cube as it's data source, including the source for multi-value and range parameters. As a note, the cube is complex and at least one of the dimensions is large (~10,000 attribute values). Lastly, the date field being used is a "date time" datatype (more on this in a moment).

The two issues are...

(1) Even after initial caching (both in VS and as deployed to Report Mgr), the entry of all parameter values suffers long delays (~40 seconds) during apparent data refreshing of tyhe small dimensions, and > 60 seconds for the large dimension, in the parameter list. If possible for the large dimension, I'd like to create a separate lookup table for the large dimension, but it does not look straightforward when my data source is the OLAP cube. QUESTION: Is this possible to do, and/or is there a better way?

(2) My date dimension field that records the actual date (ig. yyyy-mm-dd) also contains, as a date-time datatype field, the HH:MM:SS values (hh:mm:ss is all zero's, by the way). In other words, the values look like yyyy-mm-dd hh:mm:ss . Anyway, SSRS is throwing an error on the " : " (colon) symbols. Of course, if this field were being used as an output field, I could just change the field format in SSRS, but it's not output, it's an input parameter, and I don't know how it's possible to alter formatting on such a field. In the VS preview, the following error appers...

"An error occurred during local report processing. An error has occurred during report processing. Query execution failed for data set "FromDimSvcDateFullDate". Range operator (:) operands have different levels; they must be the same"

QUESTIONS: (a) Is it possible, either in SSAS or in SSRS, to alter formatting on the date field to remove the hh:mm:ss info? (b) What other solutions are suggested here?

Note: If I have to go back to my source data and change the data type, I'm afraid that my OLAP report (and others) will no longer function.

Note: Nobody on the SSRS thread is apparently able to provide feedback on this SSAS / SSRS issue.

(1): To isolate whether the delays are occurring in MSAS, the report (or both), you can trace MDX query execution times for SSAS by using SQL Profiler. If some of the MDX parameter queries are taking too long, maybe those could be tuned.

(2): What does the MDX query for the FromDimSvcDateFullDate data set look like - typically, there will be calculated measures defined, like ParameterCaption and ParameterValue? You should then be able to edit the definition appropriately to customize the data returned, using theVBA data coversion functions supported in MDX.

|||

The reason you were getting this error:

"An error occurred during local report processing. An error has occurred during report processing. Query execution failed for data set "FromDimSvcDateFullDate". Range operator (:) operands have different levels; they must be the same"

is most likely because you picked different Levels of dates for the FROM and TO in reporting service: Ie: "2004Q1" and "2006". It should have nothing to do with the colons in the dates. Picking 2004-01-01 00:00:00 to 2004-01-03 00:00:00 doesn't render an error.

I found this post when I was looking for a clean way around this or a way to give the user a more friendly message in this case... I'm still looking though :)

|||Thank you for responding.

AS Cube as DataSet for RS Multi-Value & Range Parameters?

Platform: All SQL '05 Std

I'm struggling with two issues involving the use of AS Cube data as parameters in a SSRS Report.

Background: I've built a report exclusively using an AS cube as it's data source, including the source for multi-value and range parameters. As a note, the cube is complex and at least one of the dimensions is large (~10,000 attribute values). Lastly, the date field being used is a "date time" datatype (more on this in a moment).

The two issues are...

(1) Even after initial caching (both in VS and as deployed to Report Mgr), the entry of all parameter values suffers long delays (~40 seconds) during apparent data refreshing of tyhe small dimensions, and > 60 seconds for the large dimension, in the parameter list. If possible for the large dimension, I'd like to create a separate lookup table for the large dimension, but it does not look straightforward when my data source is the OLAP cube. QUESTION: Is this possible to do, and/or is there a better way?

(2) My date dimension field that records the actual date (ig. yyyy-mm-dd) also contains, as a date-time datatype field, the HH:MM:SS values (hh:mm:ss is all zero's, by the way). In other words, the values look like yyyy-mm-dd hh:mm:ss . Anyway, SSRS is throwing an error on the " : " (colon) symbols. Of course, if this field were being used as an output field, I could just change the field format in SSRS, but it's not output, it's an input parameter, and I don't know how it's possible to alter formatting on such a field. In the VS preview, the following error appers...

"An error occurred during local report processing. An error has occurred during report processing. Query execution failed for data set "FromDimSvcDateFullDate". Range operator (:) operands have different levels; they must be the same"

QUESTIONS: (a) Is it possible, either in SSAS or in SSRS, to alter formatting on the date field to remove the hh:mm:ss info? (b) What other solutions are suggested here?

Note: If I have to go back to my source data and change the data type, I'm afraid that my OLAP report (and others) will no longer function.

Note: Nobody on the SSRS thread is apparently able to provide feedback on this SSAS / SSRS issue.

(1): To isolate whether the delays are occurring in MSAS, the report (or both), you can trace MDX query execution times for SSAS by using SQL Profiler. If some of the MDX parameter queries are taking too long, maybe those could be tuned.

(2): What does the MDX query for the FromDimSvcDateFullDate data set look like - typically, there will be calculated measures defined, like ParameterCaption and ParameterValue? You should then be able to edit the definition appropriately to customize the data returned, using theVBA data coversion functions supported in MDX.

|||

The reason you were getting this error:

"An error occurred during local report processing. An error has occurred during report processing. Query execution failed for data set "FromDimSvcDateFullDate". Range operator (:) operands have different levels; they must be the same"

is most likely because you picked different Levels of dates for the FROM and TO in reporting service: Ie: "2004Q1" and "2006". It should have nothing to do with the colons in the dates. Picking 2004-01-01 00:00:00 to 2004-01-03 00:00:00 doesn't render an error.

I found this post when I was looking for a clean way around this or a way to give the user a more friendly message in this case... I'm still looking though :)

|||Thank you for responding.

Thursday, February 9, 2012

Are there any built in aritmetic capabilities on the Date and Time type?

Simply put, I have a 'Date and Time', (06/03/2006 11:40:00), passed to the SelectCommand via the QueryString. I would like to gain data that is between the supplied time and 1 hour prior.
Is there a simple way to take 1 hr off the 'Date and Time" value or is it necessary to build code that parses the string then adjusts it?

The 'Time' and 'TimeStamp' entities below are both of type 'Date and Time' and all values are gained from the same sql database. I.e. the time used as the basis for selecting the hr period is from the same database as the one where the hour period will be selected from.

Any help would be great.

SelectCommand="SELECT [Timestamp], [Volume] FROM [out8$] WHERE (([CustomerLvl1] = @.CustomerLvl1) AND ([Timestamp] = @.Timestamp))">

<SelectParameters>

<asp:QueryStringParameterDefaultValue="TNT Express"Name="CustomerLvl1"QueryStringField="Cust"

Type="String"/>

<asp:QueryStringParameterDefaultValue="20/02/2006 22:20:00"Name="Timestamp"QueryStringField="Time"

Type="DateTime"/>

Perhaps you could do something like this:

SELECT [Timestamp], [Volume] FROM [out8$] WHERE
[CustomerLvl1] = @.CustomerLvl1) AND [Timestamp] >= @.Timestamp ANDDATEDIFF(hh, [TimeStamp],getdate()) =1

|||For future reference, you can view all the Date and Time functions onMSDN here.

Are seperate databases betters?

Hi. I have been talking with some developers who have built a hosted application supporting multiple customers. Their database approach is to create a new, dedicated database (same schema each time) for every customer that signs-up.

This approach is contrary to typical hosted DB designs that I have delt with -- that is, a single database holding multiple customer information rather than a unique database for each customer.

Does the improved security of a dedicated database out-weigh the additional maintenance requirements?

If anyone has some objective thoughts on this topic, I'd love to hear them.

Thanks,
BillIf this is a "hosted" application for, say, a cadre of retail stores each one of which has its own block of customers, products, sales, etc to deal with, then the stores are the hosting-company's "customers."

Each store expects to see and to deal with only its own set of information, and considers that information to be highly proprietary.

The hosting-company will have, ex minimis, a warehouseman's fiduciary duty with respect to the information, extending not only to the stores but indirectly to their customers. I think that having separate databases, with separate login-IDs etc, is really the only scenario that would work.|||It really depends on the requirements - Do the customers need to have additional isolation(security/fault tolerance/performance) ? How much data will be stored for each customer and what data will be maintained ?|||Thanks for the replies.

[The hosting-company will have, ex minimis, a warehouseman's fiduciary duty with respect to the information, extending not only to the stores but indirectly to their customers...]

Even with a single database, reasonable precautions are taken. All customers have separate logins and distinct logical segregation of data. The approach is roughly analogous to a bank safe with safe boxes holding the possessions of multiple parties.

[It really depends on the requirements - Do the customers need to have additional isolation(security/fault tolerance/performance) ? How much data will be stored for each customer and what data will be maintained ?]

I think if you were to ask any given customer, their knee-jerk reaction would be to say that they want their own database. But other than the fear of co-mingling of data, there are no specific scale or performance reasons that would demand it.

My concern with separate databases is the administrative overhead if you have a thousand customers, youd have a thousand databases. Things like Schema updates, index rebuilds, etc. would become a significant activity.|||My biggest worry would be if someone from company A deletes half their data. After the restore, company B asks "Where is my data from today". Just my .02 USD.|||Originally posted by billdavidheiser
[The hosting-company will have, ex minimis, a warehouseman's fiduciary duty with respect to the information, extending not only to the stores but indirectly to their customers...]

Even with a single database, reasonable precautions are taken. All customers have separate logins and distinct logical segregation of data. The approach is roughly analogous to a bank safe with safe boxes holding the possessions of multiple parties.

[It really depends on the requirements - Do the customers need to have additional isolation(security/fault tolerance/performance) ? How much data will be stored for each customer and what data will be maintained ?]

I think if you were to ask any given customer, their knee-jerk reaction would be to say that they want their own database. But other than the fear of co-mingling of data, there are no specific scale or performance reasons that would demand it.

My concern with separate databases is the administrative overhead if you have a thousand customers, youd have a thousand databases. Things like Schema updates, index rebuilds, etc. would become a significant activity.

As usual, what it really comes down to is: "it depends." Multiple databases make it less likely that the wrong customers' data will be visible but have their own negative implications as well. I think that the best advice, borne out by this little discussion, is that the designer must be keenly aware of the tradeoffs that will inevitably be made with any decision. Every decision is a compromise. No matter how forcibly a particular position may be argued on a forum ;) it is neither "right" nor "wrong."|||Multiple databases have the following advantages:

If one or some customers ask for his or their data backup you can easily do it.

If one or some customers ask for some changes which may be related to the table structures, you can easily handle it.

If one or some customers leave, you can easily backup and delete (drop) his or their databases without cleaning his or their data in one database.|||Originally posted by sundialsvcs
As usual, what it really comes down to is: "it depends." Multiple databases make it less likely that the wrong customers' data will be visible but have their own negative implications as well. I think that the best advice, borne out by this little discussion, is that the designer must be keenly aware of the tradeoffs that will inevitably be made with any decision. Every decision is a compromise. No matter how forcibly a particular position may be argued on a forum ;) it is neither "right" nor "wrong."

["it depends."]

Ah, very helpful. Thank you. Are you an Economics professor by any chance? :)

Seriously though; I understand what you are saying and agree. I was hoping to hear if anyone out there has a real-world experiance with trying to maintain a boat-load of individual customer databases.|||MCrowley brings up a good point which ties into fault tolerance. What happens if the database is suspect or part of it is corrupt - all of your users would be hosed if using 1 database.

What about the amount of data being stored per customer and the frequency of updates/deletes/inserts per customer ? Is the amount of data fixed per customer and do they infrequently change data ?|||The company that I'm working for has individual customer database for each customer. All databases have the same structure except some extra fields for some databases based on the customers requirements. We had some problems which happened to some of databases and the websites related to those databases were affected. In this case, individual customer database shows an advantage.

For the maintenance of the databases, since they have almost same structure you can use a script to do a job for all databases. I think that the advantages are much more than disadvantages.