<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic What is the difference between :443/default and Database=default in JDBC connection string in Warehousing &amp; Analytics</title>
    <link>https://community.databricks.com/t5/warehousing-analytics/what-is-the-difference-between-443-default-and-database-default/m-p/38543#M833</link>
    <description>&lt;P&gt;When I use following java code to get namespace from AWD Databricks:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;

public class DatabricksJDBCExample {
    public static void main(String[] args) {
        String jdbcUrl = "jdbc:spark://your-databricks-workspace-url:443/default;transportMode=http;ssl=true;httpPath=sql/protocolv1/o/your-org-id/your-workspace-id";
        String accessToken = "token";

        try {
            // Load the JDBC driver class
            Class.forName("com.databricks.driver.Driver");
			
			Properties connectionProperties = new Properties();

            // Set the necessary properties for the connection
            connectionProperties.setProperty("user", "token");
            connectionProperties.setProperty("PWD", accessToken);

            // Create a connection using the JDBC URL and access token
            Connection conn = DriverManager.getConnection(jdbcUrl, connectionProperties);


            // Create a statement
            Statement stmt = conn.createStatement();

            // Get the list of namespaces (databases)
            String showNamespacesQuery = "SHOW NAMESPACES";
            ResultSet namespacesResult = stmt.executeQuery(showNamespacesQuery);

            System.out.println("Namespaces (Databases):");
            while (namespacesResult.next()) {
                String namespace = namespacesResult.getString(1);
                System.out.println(namespace);
            }

            namespacesResult.close();
            stmt.close();
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can get 'default' as result.&lt;/P&gt;&lt;P&gt;After I changed the connection string to database=default&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;String&lt;/SPAN&gt; &lt;SPAN class=""&gt;jdbcUrl&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"jdbc:spark://your-databricks-workspace-url:443;transportMode=http;ssl=true;httpPath=sql/protocolv1/o/your-org-id/your-workspace-id;database=default"&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;It will throw error:&lt;/P&gt;&lt;P&gt;[SparkJDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Configuration database is not available.:48:47&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jul 2023 07:14:20 GMT</pubDate>
    <dc:creator>charlie_cai</dc:creator>
    <dc:date>2023-07-27T07:14:20Z</dc:date>
    <item>
      <title>What is the difference between :443/default and Database=default in JDBC connection string</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/what-is-the-difference-between-443-default-and-database-default/m-p/38543#M833</link>
      <description>&lt;P&gt;When I use following java code to get namespace from AWD Databricks:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;

public class DatabricksJDBCExample {
    public static void main(String[] args) {
        String jdbcUrl = "jdbc:spark://your-databricks-workspace-url:443/default;transportMode=http;ssl=true;httpPath=sql/protocolv1/o/your-org-id/your-workspace-id";
        String accessToken = "token";

        try {
            // Load the JDBC driver class
            Class.forName("com.databricks.driver.Driver");
			
			Properties connectionProperties = new Properties();

            // Set the necessary properties for the connection
            connectionProperties.setProperty("user", "token");
            connectionProperties.setProperty("PWD", accessToken);

            // Create a connection using the JDBC URL and access token
            Connection conn = DriverManager.getConnection(jdbcUrl, connectionProperties);


            // Create a statement
            Statement stmt = conn.createStatement();

            // Get the list of namespaces (databases)
            String showNamespacesQuery = "SHOW NAMESPACES";
            ResultSet namespacesResult = stmt.executeQuery(showNamespacesQuery);

            System.out.println("Namespaces (Databases):");
            while (namespacesResult.next()) {
                String namespace = namespacesResult.getString(1);
                System.out.println(namespace);
            }

            namespacesResult.close();
            stmt.close();
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can get 'default' as result.&lt;/P&gt;&lt;P&gt;After I changed the connection string to database=default&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;String&lt;/SPAN&gt; &lt;SPAN class=""&gt;jdbcUrl&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"jdbc:spark://your-databricks-workspace-url:443;transportMode=http;ssl=true;httpPath=sql/protocolv1/o/your-org-id/your-workspace-id;database=default"&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;It will throw error:&lt;/P&gt;&lt;P&gt;[SparkJDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Configuration database is not available.:48:47&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 07:14:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/what-is-the-difference-between-443-default-and-database-default/m-p/38543#M833</guid>
      <dc:creator>charlie_cai</dc:creator>
      <dc:date>2023-07-27T07:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: What is the difference between :443/default and Database=default in JDBC connection string</title>
      <link>https://community.databricks.com/t5/warehousing-analytics/what-is-the-difference-between-443-default-and-database-default/m-p/38897#M837</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/85427"&gt;@charlie_cai&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;database is not a valid configuration parameter available in the jdbc string. You can use ConnCatalog and ConnSchema to provide this information.&lt;/P&gt;&lt;P&gt;This is also documented here -&amp;nbsp;&lt;A href="https://docs.databricks.com/en/integrations/jdbc-odbc-bi.html#:~:text=To%20specify%20the%20default%20catalog%20and%20schema%2C%20add%20ConnCatalog%3D%3Ccatalog%2Dname%3E%3BConnSchema%3D%3Cschema%2Dname%3E%20to%20the%20JDBC%20connection%20URL" target="_blank"&gt;https://docs.databricks.com/en/integrations/jdbc-odbc-bi.html#:~:text=To%20specify%20the%20default%20catalog%20and%20schema%2C%20add%20ConnCatalog%3D%3Ccatalog%2Dname%3E%3BConnSchema%3D%3Cschema%2Dname%3E%20to%20the%20JDBC%20connection%20URL&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 07:44:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/warehousing-analytics/what-is-the-difference-between-443-default-and-database-default/m-p/38897#M837</guid>
      <dc:creator>Tharun-Kumar</dc:creator>
      <dc:date>2023-08-02T07:44:11Z</dc:date>
    </item>
  </channel>
</rss>

