AutoRegisterPostgresAndMysqlConnections

Automatic Registration of PostgreSQL and MySQL Connections

Tracked by Issue 123290)

PostgreSQL and MySQL are important open source database, and it would be good if NetBeans made it as easy as possible for developers to work with them.

We already include and register the PostgreSQL and MySQL drivers. Given that we know these are available, another incremental step we can take is to automatically register default connections to these databases, when appropriate.

PostgreSQL by default is configured to listen on the local host at port 5432, with a user of 'postgres' and an empty password.

Similarly, MySQL has a default port of 3306 on localhost, with a default user/password of root/{empty}.

When NetBeans starts up, a separate thread is run (and a Progress Bar is displayed) which does the following things:

  • Check and see if a connection to the MySQL and PostgreSQL database on the local machine is already registered
  • If it is not, attempt to connect to the database using the default parameters.
  • If the connection succeeds or we detect that the server is running even though the connection failed, register the connection with the correct URL, host, port and the default user and display it in the connection list.

Once this registration happens, we not this, so that if the user deletes this connection, we do not annoyingly re-add the connection next time NetBeans starts up.

The visible result of this change would be two new connections showing up in the Database Explorer when you open :

Image:reg-connections_AutoRegisterPostgresAndMysqlConnections.jpg

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo