Menu

Can the databases in the cluster have their own username and password?

Help
yylqinghao
2014-07-13
2014-07-18
  • yylqinghao

    yylqinghao - 2014-07-13

    Can the databases in the cluster have their own username(not the admin user) and password? For now, int the config file, every database has their own admin user, but the normal user which be used to execute SQL strings must be same, as given in the code: DriverManager.getConnection("jdbc:ha-jdbc:mycluster", "username", "password");
    even put their own normal user in the config file by set <property name="user">username</property>, but the password is not decoded by ha-jdbc, so it cause an error when connecting to database.
    my english is not good, can you understand what the problem is?

     
  • Paul Ferraro

    Paul Ferraro - 2014-07-14

    I understand the question.
    No - the authentication information used by your application must be the same on every database in your cluster. This is because the parameters supplied to Driver.connect(...) are passed through to each database. I don't want to have to implement user management within HA-JDBC since most application servers already implement user management via the javax.sql.DataSource abstraction.

     
  • yylqinghao

    yylqinghao - 2014-07-15

    I can't exactly got your point on "most application servers already implement user management via the javax.sql.DataSource abstraction". Do you mean hajdbc's DataSource already implement the user management? But i can't see that.
    I think applications access a cluster via the Driver can use the same authentication information for every databases, because with Driver, there is no place to store the authentication information. But with DataSource, the authentication information can store in the DataSource's properties, like general DataSources do.

     
  • Paul Ferraro

    Paul Ferraro - 2014-07-15

    Most application servers provide a facility for defining database resources including any authentication details. The server exposes this resource to an application via the javax.sql.DataSource api. This allows an application to obtain a database connection via the getConnection() method without having to supply a user name and password. That is what I meant by user management.

     
  • yylqinghao

    yylqinghao - 2014-07-16

    Thank you very much for your response.
    I agree you with the opinion on the application user management. But with ha-jdbc, we can't obtain a database connection via the getConnection() method without supplying a user name and password, even use the application user management, unless we use the same user name and password that are supplied via getConnection(username, password) method, or set the password in the Property of the database without obfuscation.
    That is my point.

     
  • Paul Ferraro

    Paul Ferraro - 2014-07-18

    If the databases defined in your cluster were themselves managed by the application server, then you would not need to use the same user name and password on each database. Why is this requirement so problematic?

     

    Last edit: Paul Ferraro 2014-07-18

Log in to post a comment.