From "client tdp session number" to "session number" - teradata

My question is related to the Teradata DB with Unity.
My starting point is the Client TDP Session Number from the connection.
My target is to obtain the Session Number (the same that you can obtain with the command SELECT SESSION) or the Unity Session Number.
Is there any system tables or views that I can use to extract this information?
Thanks!

Related

Stored procedure works on Local host but not on production server

I am currently working on an ASP.net based fleet management application. The application fetches the daily exchange rate and allows users to make transactions based on the exchange rate. There transactions are of two kinds
1. Local Currency (exchange rate =1 )
2. USD
I have written a simple select query read exchange rate value from a table in database. This query works when I access it using local host but when I try to access it using the deployed application it doesn't work
The SQL query is
SELECT id_exchange_rate, Exchange_rate
FROM NVP_ExchangeRate
WHERE CAST(Exchange_Rate_date as date)=CAST(#date_today as date)
AND Manual_rate IS NULL
It is enclosed inside the following block
if (currency_actual == "USD")
{
}
Either of the two conditions is failing.
Can someone help me with this ?
Also, The same application is deployed in 2 QA servers. It is working in both the QA servers.
Just thought that I'd add an answer to my question.
In the first query, I am getting the value of current date from the application (DateTime.Now in c#) and then passing this date to my SQL query. My Application server was based in India. However, my database server was based in Mexico.
So when I use DateTime.Now on an Indian server, it returns the current Indian date. When I take this date and go to my database query which is in Mexico (which is almost 12 hours behind India), the dates don't match as Mexico is almost a day behind us.
The root cause of this issue could be attributed to poor programming on my part.

what is the maximum lenght of sessions ASP.net 4.0 session ID - store as varchar or char or nvarchar?

I checked my own server session Ids and they are all 24 characters
I am storing each logged in person session Id at my sql server
So my question is
having a column
char(24) is enough for storing SessionIds of visitors ?
ASP.net 4.0
Session kept as : State Server tcpip=127.0.0.1:42424
Putting aside whether you should be doing this or not, the SessionIDManager enforces an 80-character limit on session IDs.
http://msdn.microsoft.com/en-us/library/system.web.sessionstate.sessionidmanager.sessionidmaxlength(v=vs.100).aspx

CreateUserWizard control problem (password issue)?

Every password that i enter and when i click the button, it tells me that the password is wrong. it activates this field in its properties: InvalidPasswordErrorMessage.
I suspect that the user tries to use the password to connect to the database.
Another weird thing, is even when a password fails to be created..(invalid), the control stores the record in the database... for example in the PasswordFailed in the members table, i get a date and the users details (The control did it in a few occassions, which is bad for login)..
The main issue however, is with the password always being invalid..
In the membership configuration you will find attributes for setting minimum number of non alpanumeric characters, min length etc. Try lowering all such values and see if it accepts your passwords. A complex password like "abc%12U8" should also be accepted.
But the error message also displays upon db connection errors so you should test the connection to the database.
also the db identity should be a member of all the "aspnet_.*" roles on the database.

How to change data source in reportviewer control

I have a reportviewer (Microsoft.ReportViewer.WebForms) control on my page. All my reports use one data source. I want to be able to let my reports run on a different database when started from my UAT enviroment. So the location of the reports is the same, but the data comes from a different db. I cannot seem to find how this is done, is it even possible?
EDIT: They are server reports on SQL Server . I know you can set the dataset programmaticaly but I just want the reports to point to a different db and leave the rest of the report intact.
2005
TIA,
John
Did you want to pass a full connection string to the report as a parameter? You can do it but sometimes SSRS gets funny and make sure you delete the report off the server before you deploy a new copy when doing this...
1. Make a parameter - let's call ours connectionStr. Make it not null, not blank, single select and text as the data type. Eventually, you will want to hide this parameter but for testing please leave it visible.
2. So the value you will be using as the connection string... (for testing I set this as the default for the parameter, with nothing put under the available values section) Data Source=MySQLServerName;Initial Catalog=MyDatabaseName;Persist Security Info=True;User ID=MyUserNameForTheServer;Password=MyPasswordForTheServer;MultipleActiveResultSets=True
3. You need an unattended execution account on your report server or you get this: unattended execution account is not specified. (rsInvalidDataSourceCredentialSetting). http://msdn.microsoft.com/en-us/library/ms156302.aspx I can't provide more details because my boss had to do this part for me.
4. Under your datasource properties in SSRS... check Embedded Connection, select the type (mine is just a normal MS SQL Server), for the connection string, open the expression box and put: =Parameters!connectionStr.value and then click credentials and make sure the last option for no credentials is selected.
5. Your datasets for that datasource will no longer be happy when you try to edit them in design view but you can switch the datasource connection properties back to how they were, not using the parameter based connection string, for editing them.
My reports are on different servers, with different instances of the Report Server, too. On some servers, they need to get their data from various databases depending on whatever, stuff. This way, with the connection string as a parameter, I can use the same reports everywhere and just deploy them to the different servers. If you are having to pass this connection string around your app or to a report viewer, I suggest using encryption.
Like I said... SSRS get's funny when you start doing this, though. Your reports should always work in preview mode after doing this, if they don't even when provided with the correct connection strings, then you have an issue that won't be solved by just deploying to the server. Trouble shooting problems with this once they are on the server but not working include checking permissions, making sure the report receives the correct connection string and making all your stored procedures and functions within the SQL database are all the same.
If you want to just pass the database name and everything else is the same (server name, username, password) then just set the connection string parameter equal to your database name and for the datasource expression value use
="Data Source=MySQLServerName;Initial Catalog=" + Parameters!connectionString.value + ";Persist Security Info=True;User ID=MyUserNameForTheServer;Password=MyPasswordForTheServer;MultipleActiveResultSets=True"
I needed to pass the whole thing in, and you can play around with the credential settings - you might be able to save the server username/password info in there for each report so that the unattended execution account is not needed.

Lazy loading of Session variables in ASP.NET SQL Server Mode

Would like to know whether the ASP.NET Session Provider in SQL Mode, would optimistically fetch the entire Session State object (i.e all the keys and their values when we request one) or fetch them in a lazy fashion (i.e goes to the Database and fetch only the requested key and corresponding value)?
I installed the SQL Session State for SQL like this:
aspnet_regsql.exe -sstype c -ssadd -d mydatabase -U MyUserName -P MyPassword -S xx.xx.xx.xxx
Below is one of the "select" Stored Procedures that gets installed. I tried to make some sense of it.
It appears to me that a user's entire session state is serialized and stored in one database record. This would mean the user's entire session state would be loaded in order to access any record.
I am guessing that it is probably loaded by default during the early stages of the ASP.net page or application life-cycle (perhaps only if the compiler recognized access to Session() in any of the page's code).
Here's the table where the session data gets stored, for reference:

Resources