locked
Connect to JDBC Database url from ASP.NET Application RRS feed

  • Question

  • User-73514677 posted

    Hi.

    Is it possible to connect to JDBC database link from ASP.NET web application ?

    I have a jdbc link, to which I want to connect and query a table. 

    String databaseURL = "jdbc:mysql://localhost:3306/test";

    How to achieve this in C# ?

    Thanks

    Monday, January 4, 2021 5:34 PM

All replies

  • User-939850651 posted

    Hi venkatzeus,

    In Java, you could obtain a Connection instance that is connected to a particular database by calling DriverManager.getConnection(url) using the databaseURL you mentioned.

    But in C#, if you want to connect to MySql database, you need to use MySql.Data.MySqlClient reference, and follow its specifications and use the correct connection string to get the connection instance.

    Something like:

    string connStr = "server=localhost;database=test;port=3306;user=xxx;password=xxx";
    MySqlConnection conn = new MySqlConnection(connStr);

    You could also refer to this offcial document.

    Best regards,

    Xudong Peng

    Tuesday, January 5, 2021 5:54 AM
  • User-73514677 posted

    Hi.

    The Jdbc connection url I have is the IBM Robot scheduler. 

    I have this JDBC link only as a database connection.

    Tuesday, January 5, 2021 6:16 AM