Re: ODBC access to TSM from VBScript
2002-09-04 10:31:00
Here you go:
==================================================
dim dbc
dim recordSet
dim sql
dim recordCount
dim myArray
call testTsm
sub testTsm
set dbc = WScript.CreateObject("ADODB.Connection")
set recordSet = WScript.CreateObject("ADODB.Recordset")
WScript.Echo "Connecting to TSM server..."
' your_dsn = your TSM ODBC driver DSN name.
' your_admin = your TSM Admin ID
' xxxxx = your TSM Admin password
dbc.Open "your_dsn", "your_admin", "xxxxx"
WScript.Echo "Connected!"
sql = "select * from admins"
recordSet.Open sql, dbc
myArray = recordSet.GetRows()
for r = 0 to UBound(myArray, 2)
WScript.Echo "ADMIN_NAME: ", myArray(0, r)
next
recordSet.Close()
dbc.Close()
end sub
==================================================
Andy Raibeck
IBM Software Group
Tivoli Storage Manager Client Development
Internal Notes e-mail: Andrew Raibeck/Tucson/IBM@IBMUS
Internet e-mail: storman AT us.eyebm DOT com (change eye to i to reply)
The only dumb question is the one that goes unasked.
The command line is your friend.
"Good enough" is the enemy of excellence.
Peter Bjoern <pebjn AT WMDATASDC DOT DK>
Sent by: "ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU>
09/04/2002 05:27
Please respond to "ADSM: Dist Stor Manager"
To: ADSM-L AT VM.MARIST DOT EDU
cc:
Subject: ODBC access to TSM from VBScript
Has anybody actually had any success in accessing the TSM database from a
VBScript piece of code (running as asp in IIS) on a Win2K machine via the
ODBC connection ?
I have installed the ODBC driver from the TSM 4.2 CD and configured an
ODBC
datasource with a DSN pointing to the TSM server.
I know the ODBC DSN works because I can use Excel, MSQuery and Lotus
Approach to extract data
from the TSM database without any problems.
But what I will really like is to get it to work from VBScript.
So far I have not been successful in doing that.
All the examples I have found about how to access an ODBC datasource from
VBScript
have ended in miscelaneous errors.
Has anybody done a similar thing from VBScript and how did you do it ?
A few lines of example code would of course be wonderful.
Regards
Peter
|
|
|