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

asked 30 Sep '11, 13:07

Vineet's gravatar image

Vineet
1405814
accept rate: 25%

retagged 04 Oct '11, 14:34

Jeff%20Albion's gravatar image

Jeff Albion
10.7k171174


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?

permanent link

answered 01 Oct '11, 00:07

John%20Smirnios's gravatar image

John Smirnios
8.9k377112
accept rate: 39%

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.

(01 Oct '11, 07:54) Breck Carter

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.

permanent link

answered 30 Sep '11, 14:25

Graeme%20Perrow's gravatar image

Graeme Perrow
8.5k371109
accept rate: 52%

edited 30 Sep '11, 14:25

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

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

permanent link

answered 04 Oct '11, 14:29

Jeff%20Albion's gravatar image

Jeff Albion
10.7k171174
accept rate: 24%

edited 04 Oct '11, 14:39

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?

permanent link

answered 01 Oct '11, 23:42

Vineet's gravatar image

Vineet
1405814
accept rate: 25%

2

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.

(02 Oct '11, 04:47) Breck Carter
Replies hidden

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.

(03 Oct '11, 07:17) Volker Barth

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

(03 Oct '11, 17:52) Vineet
Replies hidden

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...

(03 Oct '11, 18:25) Volker Barth

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

(04 Oct '11, 03:43) Vineet
Replies hidden

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?

(04 Oct '11, 04:04) Volker Barth

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 )(}{

(04 Oct '11, 13:34) Vineet
showing 4 of 7 show all flat view
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×99
×67
×33
×11

question asked: 30 Sep '11, 13:07

question was seen: 4,299 times

last updated: 04 Oct '11, 14:39