Skip to Content
author's profile photo Former Member
Former Member

How can I connect to MySQL external database

Hello.

I have a SAP system running in SQL Server 2003.

I need to connect to external MySQL DB., to operate with this information in ABAP program.

I have done the step necesary... I mean I go to DBCO transaction and configure the connection like this:

DB CONNECTION --> AFIS

DBMS --> MSS

user name --> xxxxxx

DBpass -->xxxxxx / xxxxxx

Conn Info -->MSSQL_SERVER=192.168.1.233 MSSQL_DBNAME=alliance OBJECT_SOURCE=alliance

I do a test program, when I do the statement CONNECT TO, sy-subrc 0 and connection = DEFAULT... I mean, with this form I cannot connect to MySQL Database...

Can you help me to do this?? I think the problem it's the connection string in DBCO... but I'm not sure...,

Would be possible to connect by MySQL ODBC??? I mean , installing the ODBC driver in my SAP server, and using this in ABAP Program??

Thks.

DATA: BEGIN OF wa,

cod_modelo(20),

END OF wa.

DATA: dbs TYPE dbcon-con_name.

DATA: con(20) TYPE c.

DATA : ls_wa LIKE wa.

con = 'AFIS'. "DB Connection in DBCO above

EXEC SQL.

CONNECT TO :con

ENDEXEC.

WRITE sy-subrc. ---> The result it's 4

EXEC SQL.

GET CONNECTION :con

ENDEXEC.

WRITE : con. --> The result it's DEFAULT

EXEC SQL.

SET CONNECTION DEFAULT

ENDEXEC.

write : con. --> The result it's DEFAULT

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Apr 17, 2009 at 08:02 AM

    Check if

    Note 178949 - MSSQL: Database MultiConnect with EXEC SQL

    can help you.

    Markus

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 17, 2009 at 12:39 PM

    -

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 27, 2009 at 02:21 PM

    We have SAP ERP 6.0 running with DB6 on Windows 2003 64-Bit. I tried to get an ODBC connection to mySQL like described above, but it didn't work. I have defined the ODBC DSN on the SAP System and the test did work. But with DBCO definition (DBMS = MSSQL , Conn.info = MSSQL_DSN= ) there is no connection possible (ERROR SQL error 1-: [DBNETLIB][ConnectionOpen (Connect()).]SQL Serverdoes not exist or access denied.).

    Have you any idea what could be wrong??

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 27, 2009 at 03:27 PM

    Hi Gudmundur,

    yes, I have dbmsslib.dll installed on the SAP System.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 27, 2009 at 04:53 PM

    Hi Gudmundur,

    good idea to set MSSQL_DATASOURCE=<your_dsn_name>. After that, the trace told me to install the client softfware for provider MSDASQL. I installed MSDASQL and the connection to mySQL works.

    Thank you

    Detlef

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.