Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RecordSet Authentication Setting ? 1

Status
Not open for further replies.

terawebwriter

Programmer
Nov 22, 2002
10
US
VI Newbie here, challenged with connecting to a Teradata table, dbc.databases, and returning the results in a Grid DTC.

My learning application works fine using <b>MY</b> authentication credential when its embedded in the RecordSet DTC properties. Problem is, I need to learn how to set this dynamiclly with a preceding login page.

Removing the Recordset properties for userid/password, and then setting the Application(DataEnvironmentName) string simply results in an Exception Operation in the PM.ASP module when attempting to create the DE connection object or results set.

I'm using a System ODBC driver, but probably can flick it to a DSN-less connection (haven't tested it yet).

Any tips for setting the userid/password on the fly?
 
Its possible (see below), but..
Unfortunately, in 3-tier systems the end-user login is not usually passed back as far as the database connection. Instead the application has one or two generic connection ids. This is quite different to client-server applications.

The benefit here is that the database connections can...
1. be 'pooled' - so 100 web users only actually need 10 connections at any one time.
2. do not need to be closed (by implication of pooling) - thus start-up time is reduced. Remember, each server round trip (each page view) is like a brand new session - connections will need to be re-opend each time. Pooling 'spoofs' the open/close, so that it tries to use an open-but-unused connection in preference.

But to answer your query...

If you show the underlying javascript code generated by the RecordsetDTC, you will see how it makes the connection.

You should see something like:

rsList.advise(RS_ONBEFOREOPEN, _setParametersrsList);
var DBConn = Server.CreateObject('ADODB.Connection');
DBConn.ConnectionTimeout = Application('cn1_User_ConnectionTimeout');
DBConn.CommandTimeout = Application('cn1_User_CommandTimeout');
DBConn.CursorLocation = Application('cn1_User_CursorLocation');
DBConn.Open(Application('cn1_User_ConnectionString'), Application('cn1_User_RuntimeUserName'), Application('cn1_User_RuntimePassword'));
...and so on...

You can see where the userID and password are applied - but they come from the Application globals.

You need to override this - and the easiest way that I can see is to convert the Recordset DTC to 'Runtime Text' (on the right-mouse menu for the DTC). Only do this after you are happy with the SQL clause.

The above code will now be editable on the page - you can change it as you see fit. So now replace the UserID and Password bits from the code above with variables of your choosing.

You may hold the UserID and Password in Session variables - in which case just alter the Application(&quot;...&quot;) to Session(&quot;...&quot;).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top