Accessing MySQL in parallel to SQLBase

Discussion forum about all things SqlBase or SqlTalk
Dobby
Germany
Posts: 20
Joined: 24 Apr 2017, 11:52
Location: Salem Germany

Accessing MySQL in parallel to SQLBase

Post by Dobby » 22 Dec 2021, 16:46

Good day, everyone!

My application is runnung against SQLBase 12 developed with TD 7.3.
I need to access a MySQL databse to transfer some data to the SQLBase.
I already installed the ODBC-driver on the windows machine.

In fact I hav no idea, how to connect to the mysql databse.

How do I have to set SQLServername, SQLDatabase, SQLUser and SQLPassword?
Do I have to consider anything special when using SQLConnect()
Do I need special entries with in the sql.ini file?

I tried different things, but all without success.
I went thru the entries of this forum, thu the wiki and the examples but couldn't find a solution for me.

I would appreciate any help in this case.
Does anyone has for me some lines example code? Would be so great.

many thanks, best regards and merry x-mas
Dobby

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 290
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Re: Accessing MySQL in parallel to SQLBase

Post by thomas.uttendorfer » 22 Dec 2021, 16:58

Hi Dobby,

first of all you need a 32-bit ODBC datasource for MySql.

Then in sql.ini you have to activate sqlodb32

Code: Select all

[win32client.dll]
comdll=sqlodb32
Configure your ODBC datasource name in this section (also sql.ini).

Code: Select all

[odbcrtr]
remotedbname=MYSQLDBNAME,DSN=MYSQLDBNAME
Now you should be able to connect.

Regards Thomas
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

Dobby
Germany
Posts: 20
Joined: 24 Apr 2017, 11:52
Location: Salem Germany

Re: Accessing MySQL in parallel to SQLBase

Post by Dobby » 22 Dec 2021, 18:30

Hello Thomas,

thanks for your answer.

Your mentioned prerequisites are all in place.
But how do I tell the SQLConnect() command to use the odbc connection and not the SQLBase.


beat
Dobby

FRBhote
India
Posts: 2206
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Accessing MySQL in parallel to SQLBase

Post by FRBhote » 23 Dec 2021, 07:37

It will connect based on SQLDatabase, SQLUser and SQLPassword.

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 290
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Re: Accessing MySQL in parallel to SQLBase

Post by thomas.uttendorfer » 23 Dec 2021, 08:02

First set SqlDabase, SqlUser and SqlPassword for Database 1 and connect SqlHandle.
Then set those vars for Database 2 and connect another SqlHandle.
Now - based on the handle - you can talk to the database you want.
Of course you can't use SqlImmediate in this scenario (in fact you can - but I wouldn't do it).
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

Dobby
Germany
Posts: 20
Joined: 24 Apr 2017, 11:52
Location: Salem Germany

Re: Accessing MySQL in parallel to SQLBase

Post by Dobby » 23 Dec 2021, 10:08

Hello everybody,

I'm really sorry, but it seems that I'm too stupid about all this.

Here are my entries from sql.ini:

Code: Select all

[win32client.dll]
comdll=sqlodb32            ;for ODBC-Connection
comdll=sqlws32              ;for SQLBase Connection

[odbcrtr]
remotedbname=SPEZUPDATES,DSN=SPEZUPDATES
My 32-Bit ODBC connection is configured on the DataSourceName SPEZUPDATES
configured is:
  • the name of the MySQL-Server
  • the database name (which is the same as the DSN)
  • the user for the database
  • the password for the user
TEST DSN ist successful

In the Code I have the following:

Code: Select all

Set SqlServername='SPEZUPDATES'
Set SqlDatabase='SPEZUPDATES'
Set SqlUser='updates'
Set SqlPassword='MySecretDBPassword'
Call SqlConnect( hMySQL )
Call SqlSetIsolationLevel( hMySQL, 'RC' )
Before I have defined:

Code: Select all

When SqlError
	Call SalMessageBox(
			'One ore more of these informations may be incorrect or missing:
			
			Server:		' || SqlServername || '
			Database: 	' || SqlDatabase || '
			User:		' || SqlUser || '
			
                        ', 'Database connection failed!', MB_Ok)
	Call SalQuit(  )
It always runs into this SqlError.
The connection to the SQLbase which is done before is still working.

I'm really sorry to bother you again. :-(

best regards
Dobby

FRBhote
India
Posts: 2206
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Accessing MySQL in parallel to SQLBase

Post by FRBhote » 23 Dec 2021, 11:05

Put a breakpoint on the SqlConnect and see which statement is causing the problem.

Also, see if it connects with sqltalk.

Return to “SqlBase General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 2 guests