WinBatch Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: KeithW on October 21, 2021, 01:37:51 pm

Title: SQL DB Connections
Post by: KeithW on October 21, 2021, 01:37:51 pm

For those much more knowledgeable in the SQL & WinBatch world than I am......

I need to run a series of processes that involve MySQL & MS-SQL where I have to do some data conversions and then access the DBs.
This is destined to be a nightly procedure.

Do Data Conversion 1  (have tools and processes to do this)
Connect to My-SQL and execute a Stored Procedure
Do Data Conversion 2 (again tool  process in place)
Connect to MS-SQL and run an DB Update process.

Was wondering if WinBatch could be used to automate this with a single script as there are multiple sets of DBs that have this process done and I would like to setup one script per DB set to simply this setup.  Manually it all works but is a huge hassle withoout automating...

If WB can handle this, could more of the gurus point me in the proper direction to try and implement something like this?

Title: Re: SQL DB Connections
Post by: td on October 21, 2021, 02:10:20 pm
You might consider looking at some of the database examples in the Tech Database using COM automation objects like ADO and the ODBC extender. There is a lot of stuff in Tech Database on the subject of databases and I am sure one of the several database gurus on the forum would be more than willing to help you once you narrow the focus a bit.
Title: Re: SQL DB Connections
Post by: KeithW on October 21, 2021, 02:31:17 pm

Thanx for the hints, will go take a look at the Tech DB.  Not sure how much simpler I can make the above procedure.  The two data conversions are handled by an external program that can be called by WB.

The two SQL situation are...

MySQL ...   login and call "myStroredproc"  and exit

MS-SQL ...  login and pass a single  "SQL UPDATE" command  and exit

Nothing more involved at this time... if this all works its another copy of WB+Compiler, otherwise it won't be.... ???

Title: Re: SQL DB Connections
Post by: JTaylor on October 21, 2021, 02:50:14 pm
Search for "MySQL Example".  MSSQL should be similar but probably with a different Connection String.   If you set up a DSN for it, it is even simpler.

Title: Re: SQL DB Connections
Post by: stanl on October 22, 2021, 02:52:45 am
I have some MySQL and SQL Server snippets in my archives. Most use MySQL ODBC drivers 5.2 and are somewhat dated, but I'm sure I can dig out some that use the .net drivers [and may have posted some stuff that made it to the Tech DB]