Menu

#4 no support for JDBC URL (connection string)

2.0
closed
None
2019-12-30
2019-08-17
No

jdbcsql has no support for JDBC URL string. Tool without support for JDBC URL is limited to basic database configurations and it is just a toy... Think about a case that you need to connect to a Oracle DB cluster, in that case you need specify more details than just a hostname and port...

Example of simple JDBC URL to access local mysql database:

jdbc:mysql://localhost:3306/test

Discussion

  • Atanas Dichev

    Atanas Dichev - 2019-08-17
    • status: open --> accepted
     
  • Atanas Dichev

    Atanas Dichev - 2019-08-17
    • assigned_to: Atanas Dichev
     
  • Atanas Dichev

    Atanas Dichev - 2019-08-18
    • status: accepted --> closed
     
  • Atanas Dichev

    Atanas Dichev - 2019-08-18

    Look in the documenation how to configure JDBCConfig.properties file. The content of JDBCConfig.properties file is database urls.

     
  • Petr Slansky

    Petr Slansky - 2019-08-18

    This tool is just a toy! Everything is hardcoded and difficult to change by end user... :-(

    An example of JDBC string to connect to AWS Aurora cluster (https://stackoverflow.com/questions/56403686/aurora-mysql-jdbc-fail-over)

    jdbc:mysql:replication://master.xxxx.rds.amazonaws.com:3306,read.xxxx.rds.amazonaws.com:3306/dbnamerhere?autoReconnect=true&logger=com.mysql.jdbc.log.Slf4JLogger&allowSlavesDownConnections=true&readFromMasterWhenNoSlaves=true&loadBalanceBlacklistTimeout=5000
    

    This JDBC url is longer and has more options but it is not so bad as JDBC url for big Oracle cluster with several nodes.

    With your design, user has to create extra "jar" archive for each cluster he needs to manage. Once you work for bigger company, you can manage "many" databases...

    Possible workarround, I don't like it but it works. I use "-h" to pass JDBC url. Unfortunately, I have to use mandatory option "-d" even I don't need it.

    java -cp .:commons-cli-1.2.jar:commons-csv-1.1.jar:postgresql-9.3-1102-jdbc4.jar com.azsoftware.jdbcsql.Run -m jdbc -h "jdbc:postgresql://51.159.26.58:46839/rdb?ssl=true&sslmode=require" -d "whatever" -U dbuser -P "secret" "SELECT COUNT(*) FROM pg_settings;"
    

    This is what I added to JDBCConfig.properties file to define "jdbc" driver

    # postgresql settings, host is JDBC url
    jdbc_driver = org.postgresql.Driver
    jdbc_url = host
    

    I beleive you can do it much easier...

     

    Last edit: Petr Slansky 2019-08-18
    • Atanas Dichev

      Atanas Dichev - 2019-08-18

      Congratulation for the brilliant decision.
      I promise when I have enough time I'll added option for custom url.

       
  • Atanas Dichev

    Atanas Dichev - 2019-08-18
    • status: closed --> accepted
     
  • Atanas Dichev

    Atanas Dichev - 2019-12-30
    • status: accepted --> closed
     
  • Atanas Dichev

    Atanas Dichev - 2019-12-30
    • Milestone: 1.0 --> 2.0
     

Log in to post a comment.

MongoDB Logo MongoDB