Author Topic: SQL DB Connections  (Read 108 times)

KeithW

  • Full Member
  • ***
  • Posts: 167
SQL DB Connections
« on: October 21, 2021, 01:37:51 pm »
Greetings,

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?

Regards,
Keith

td

  • Tech Support
  • *****
  • Posts: 3945
    • WinBatch
Re: SQL DB Connections
« Reply #1 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.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

KeithW

  • Full Member
  • ***
  • Posts: 167
Re: SQL DB Connections
« Reply #2 on: October 21, 2021, 02:31:17 pm »
td,

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.... ???


Keith

JTaylor

  • Pundit
  • *****
  • Posts: 1743
    • Data & Stuff Inc.
Re: SQL DB Connections
« Reply #3 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.

Jim

stanl

  • Pundit
  • *****
  • Posts: 1572
Re: SQL DB Connections
« Reply #4 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]