Links

9.2. Setting up database connections (MySQL, SQL Server, or PostgreSQL)

  1. 1.
    Navigate to the "Connectors" section from the main menu.
  2. 2.
    Click the "Add Connector" button to open the database connection setup dialog.
  3. 3.
    Select the desired database type (MySQL, SQL Server, or PostgreSQL) and provide the necessary connection information, such as hostname, port, username, and password.
  4. 4.
    Provide Connection Information
    • Hostname or IP address: Enter the server name or IP address where the database is hosted. Make sure it's accurate and reachable from your network. If possible, use the IP address instead of the DNS name to avoid resolution issues.
      • If your database server is hosted on your local machine or within your private network, entering "localhost" or a private IP address (e.g., 192.168.x.x) might not work if the AI2sql platform is hosted externally. In such cases, you may need to set up port forwarding or use a VPN/SSH tunnel to securely expose your database server to the internet.
    • Port: Provide the port number on which your database server is listening for connections. This value is usually the default port for your chosen database type (e.g., 3306 for MySQL, 5432 for PostgreSQL, 1433 for SQL Server). It's not necessary to enter the port number for SQL Server.
    • Database Name: Enter the name of the database you want to connect to. Ensure that it's spelled correctly and case-sensitive, if applicable.
    • Authentication: Select the appropriate authentication method (e.g., username/password) based on your database server's configuration.
    • Username: If using username/password authentication, enter the username with the necessary privileges to access the database.
    • Password: If using username/password authentication, enter the password associated with the provided username.
    • Add the AI2sql connector's IPs to your firewall's whitelist, if necessary. (52.151.220.65,52.151.220.76,52.151.220.92,52.151.220.113,52.151.220.203,52.151.220.211,20.119.16.24)
Note: If the direct connection to your database does not work for you, as an alternative, you can add your DDL (Data Definition Language) script to AI2sql. This way, you can still use our platform to generate SQL queries without directly connecting to your database. Follow the guide below to learn how to add your DDL script to AI2sql: https://ai2sql.gitbook.io/ai2sql/3.-managing-tables/3.1.-importing-tables-using-ddl