になったときにRedshiftへのJDBC接続で問題が発生しました。ドキュメントに示されている例を使用すると、ユーザーにプレーンパスワードがあるときにRedshiftクラスタに簡単に接続できますが、#文字のパスワードがあるユーザーは認証に失敗します。私は両方の資格情報を使用してSQL Workbench/Jを使用してクラスタに接続できます。私が以下を使用すると、接続に問題はありません。Redshift JDBC接続で、#文字のユーザーパスワードが
DriverManager.setLoginTimeout(60);
Properties props = new Properties();
props.setProperty("user", "johndoe");
props.setProperty("password", "superSecret");
props.setProperty("tcpKeepAlive", "true");
Connection connection = DriverManager.getConnection("jdbc:redshift://xxxxxxx.us-east-1.redshift.amazonaws.com:5439/dev", props);
私は以下を使用し、
DriverManager.setLoginTimeout(60);
Properties props = new Properties();
props.setProperty("user", "johndoehash");
props.setProperty("password", "superDouble#Secret");
props.setProperty("tcpKeepAlive", "true");
Connection connection = DriverManager.getConnection("jdbc:redshift://xxxxxxx.us-east-1.redshift.amazonaws.com:5439/dev", props);
私はSQLワークベンチ/ Jを使用して、両方のアカウントでクラスタにログオンしますが、いくつかのためにできる認証エラー
java.sql.SQLException: [Amazon](500310) Invalid operation: password authentication failed for user "johndoehash";
at com.amazon.redshift.client.messages.inbound.ErrorResponse.toErrorException(ErrorResponse.java:1830)
at com.amazon.redshift.client.InboundDataHandler.read(InboundDataHandler.java:454)
at com.amazon.support.channels.AbstractSocketChannel.readCallback(Unknown Source)
at com.amazon.support.channels.PlainSocketChannel.read(Unknown Source)
Caused by: com.amazon.support.exceptions.ErrorException: [Amazon](500310) Invalid operation: password authentication failed for user "johndoehash";
を取得なぜ私のアプリケーションを介して接続することはできません。私が間違っていることに関するアイデアは?
パスワードを変数に割り当ててから、そのパスワードをsetpropertyに渡すことはできますか。 –
はい、私はそれをして、同じ結果を得ました。 #(おそらく推測)httpでの使用のために、おそらく#が何らかの問題を引き起こしていると考えて、URLEncoder.encode(パスワード、 "UTF8")を変更しました。 – user2843144
申し訳ありませんが、私は正確な解決策を持っていない、私はjavaに知らされていない、ちょうど推測を取って、何が助けて、右ですか? CHR(35)を使ってみましたか? –