Accessing MS SQL from REXX

Accessing MS SQL from REXX

Post by dschrier1 » Sat, 28 Feb 2004 00:03:39


Does anyone know if you can connect to Microsoft SQL Server from a
REXX script? I have done some searching and all I see is the
interface between REXX and DB2. Thanks.
 
 
 

Accessing MS SQL from REXX

Post by David Rugg » Sat, 28 Feb 2004 00:46:24


I would use Mark Hessling's SQL package. Then if nothing else you can
access Microsoft SQL though ODBC.

--
David Ruggles
CCNA MCSE (NT) CNA A+
Network Engineer Safe Data, Inc.
(910) 285-7200 XXXX@XXXXX.COM

 
 
 

Accessing MS SQL from REXX

Post by Jeff Glat » Sat, 28 Feb 2004 08:05:06

>DS

Depends upon what interpreter you're looking for, and what operating system
your script is running on. For Reginald, you can FUNCDEF and directly use the
ODBC functions in the Windows OS. In the next few days, I'll be putting up an
example of that on my web site, as well as a tutorial about using Reginald with
ODBC. Check the Reginald forum for information and announcements about it:

http://www.yqcomputer.com/

For Regina, you can check out Mark's RexxSql package. I'm not sure if it
supports ODBC, but it does do MySQL.

For Object REXX, I don't know what choices you have.
 
 
 

Accessing MS SQL from REXX

Post by Michael Lu » Sat, 28 Feb 2004 21:08:50


> For Object REXX, I don't know what choices you have.

RexxSQL works there as well...

--
Michael Lueck
Lueck Data Systems

Remove the upper case letters NOSPAM to contact me directly.
 
 
 

Accessing MS SQL from REXX

Post by David Rugg » Sun, 29 Feb 2004 00:38:35


I know it supports ODBC which is why I suggested it. I've used it with
IBM's ObjREXX several times to connect both to a Pervasive.SQL
database, and Microsoft Database, using an ODBC connection. It works
great, but ended up not being able to use it for another (non-rexx)
reason and so I don't currently use it.

--
David Ruggles
CCNA MCSE (NT) CNA A+
Network Engineer Safe Data, Inc.
(910) 285-7200 XXXX@XXXXX.COM
 
 
 

Accessing MS SQL from REXX

Post by chuck » Sun, 29 Feb 2004 07:29:30

Hello David,

I access MS-SQL through IBM ObjectRexx in many production systems.

/** rexx <-> sql code follows ***/

::method GetSQLData
_connectH = .OLEObject~new( "adodb.connection" )
_recordsetH = .OLEObject~new( "adodb.recordset" )

/* setup for errors in OLE */
signal on error name OLEerror /*
only way to trap OLE-generated errors */

/* connect to the server 'YourServerName.whatever.wherever' */
_connectH~ConnectionString = " DRIVER=SQL Server;
SERVER=YourServerName; DSN=YourDataBaseName;
DATABASE=YourDataBaseName"
_connectH~Open

/* build the select statement */
_selectStatement = "select distinct workgroupName from
YourSQLTableView where PersonName like '%Snoopy%'

/* read the database */
_recordsetH~Open( _selectStatement , _connectH )
_rows = _recordsetH~GetRows

/* store and show the result set */
_group.0 = _rows~items
do _a = 1 to _group.0
_group._a = _rows~at( 1 , _a )
say "row #" || _a "=" _group._a
end

_recordsetH~Close

GetDataContinue:

_connectH~Close

return


OLEerror:
/**********************
* called via ORexx jump
**********************
signal off error

signal GetDataContinue

return /* not really used, but good habit nonetheless */
/** rexx <-> sql code precedes **/

My thanks to Lee Peedin and Jan Engehausen who made suggestions that
led me to what we/I use today.

Chuck Moore