cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to log-in using password containing characters like +,-"'()

Former Member
10,064

Hi,

I am using Sybase SQL Anywhere 9.x. I faced very interesting problem and am not sure if its really a problem or as designed.

I am not able to log-in to DB once I set the password to "i+:7-)DB". Am using GRANT CONNECT TO "dba" IDENTIFIED BY "i+5:Q7-)DB" command to set the password.

The error it gives while logging-in is "JZ002: Password property "too long. Maximum length is 30."

Does sybase expand passwords if they contain special characters like +,-"'() etc. And truncates the password to max 30 characters while setting the password?

Thanks in advance. Vineet

Accepted Solutions (0)

Answers (4)

Answers (4)

johnsmirnios
Participant

I tried v90 and it worked fine too. I think the error you are seeing is not from the database server: "JZ002" isn't one of the engine's error codes. What app are you using to connect with? Maybe it is specific to that app?

Breck_Carter
Participant
0 Kudos

The message is coming from jConnect: http://www.sybase.com/detail?id=1009784

Maybe jConnect doesn't like that combination of characters, and is throwing this confusing message about length.

jeff_albion
Advisor
Advisor

Using jConnect within a JDBC application can sometimes be tricky. Note that there are three ways to specify connection options (specifically, login options) to a JDBC Connection from a DriverManager object:

.getConnection(String url)

.getConnection(String url, Properties info)

.getConnection(String url, String user, String password)

Note that the login information can either be contained directly on the JDBC URL string (e.g. 'pwd='), in a properties file, or directly provided to the .getConnection() call as a parameter.

How you are actually passing the password to the JDBC driver in your reproducible?

Here is my attempt at using your specified password, with dbisql, from the command line on version 9.0.2.3951 - this seems to work for me. Also to keep in mind, (and as Volker correctly points out) 9.0.2 has been end-of-life'd and the "-jconnect" option on dbisql is no longer supported in current versions.

=====================

> dbinit v9.db
Adaptive Server Anywhere Initialization Utility Version 9.0.2.3951
Creating system tables
Collation sequence:  1252LATIN1
Creating system views
Setting permissions on system tables and views
Setting option values
Initializing UltraLite deployment option
Database "v9.db" created successfully

> dbspawn dbsrv9 v9.db
Adaptive Server Anywhere Start Server In Background Utility Version 9.0.2.3951

> dbisql -c "UID=dba;PWD=sql;ENG=v9" GRANT CONNECT TO "user1" IDENTIFIED BY "i+5:Q7-)DB";
Execution time: 0.003 seconds

> dbisql -jconnect -c "UID=user1;PWD=i+5:Q7-)DB" -host localhost -port 2638
Connected

=====================

graeme_perrow
Advisor
Advisor

A bunch of password-related changes were made to SA version 10.0, and I verified that the GRANT statement you listed in your question behaves as expected in 10.x, 11.x, and 12.x. It wouldn't surprise me that some non-alphanumeric characters did not work properly in version 9.x, but I don't have the code for 9.x in front of me, nor do I have 9.x installed anymore, so I can't confirm.

Former Member
0 Kudos

Thanks to all for replying..

I am connecting to Db using 'jconnect' and then running GRANT command. command am using: dbisql.exe -jconnect -c "FILEDSN=path.dsn"

Is there a way to know what all characters not supported by SA or jconnect driver?

Breck_Carter
Participant

This Microsoft topic might help:

http://msdn.microsoft.com/en-us/library/ms378428.aspx

Scroll down to see this...

Escaping Values in the Connection URL

You might have to escape certain parts of the connection URL values because of the inclusion of special characters such as spaces, semicolons, and quotation marks. The JDBC driver supports escaping these characters if they are enclosed in braces. For example, {;} escapes a semicolon.

Escaped values can contain special characters (especially '=', ';', '[]', and space) but cannot contain braces. Values that must be escaped and contain braces should be added to a properties collection.

Note White space inside the braces is literal and not trimmed.

VolkerBarth
Contributor
0 Kudos

Given that, you might think about switching to the iAnywhere JDBC driver, which is also part of the SQL Anywhere client libraries, instead of jConnect. AFAIK, the iAnywhere JDBC driver should not have this password limitations but should behave identical to the ODBC driver in that respect.

Former Member
0 Kudos

Ok, so here is something i figured out. I have two DB running A and B command to connect to A is dbisql -onerror exit -jconnect -c "FileDSN=path"

A runs on default port 2638

For B, command is dbisql -jconnect "FILEDSN=path" -host localhost -port 3989

JZ002 error occurs in case of B. Its coming even with a single bracket")" character

Error is coming from jdbc driver. But reason is not valid for this.

For A ")" in password gives invalid username and password

VolkerBarth
Contributor
0 Kudos

For case B, your sample statement seems to miss the -c option in front of "FILEDSN=..." (unless it's not necessary with v9, note the "-jconnect" option was dropped with v10) - But I don't know if this will matter here...

Former Member
0 Kudos

Sorry, it was a typo mistake, correct one is dbisql -jconnect -c "FILEDSN=path" -host localhost -port 3989

VolkerBarth
Contributor
0 Kudos

I'm still trying understand:

  1. You are about to run a script via DBISQL.
  2. You use the "-jconnect -c "FILEDSN="... options when starting dbisql.
  3. The script contains the GRANT CONNECT statement, which then does fail.
  4. The error only returns when connecting to database B, not with database A.

Is this is correct, what are the differences between A and B (or the difference in the FileDSNs for both)?

What does happen when you use GRANT CONNECT with a "simple" PWD, say "IDENTIFIED BY myPwd"?

What does happen when you run the same script with "dbisql -odbc" or when using dbisqlc?

Former Member
0 Kudos

point 1, 2, and 3 succeeds(I am able to reset the password using GRANT command). Problem comes when I am trying to connect using DBISQL to database B.

The only difference in two DBs is the way we are connecting to them

DB B is running on different port.

I understand " ; special characters cannot be used inside passwords. But the problem am facing are with other characters too like )(}{