cancel
Showing results for 
Search instead for 
Did you mean: 

java.sql.SQLException: JZ00L: Login failed

0 Kudos

Hi ,

I am trying to connect to a Sybase ASE Database using attached java Program. I have tried it with jconn4-7.0.7.jar , jconn4d.jar library one by one but unfortunately nothing works .

Environment :

OS : SUSE Linux Enterprise 12 SP4

Sybase ASE version : Sybase ASEv 16

java version "1.8.0_91"

I'm executing this connection like below :

javac -cp .:jconn4d.jar GetSybaseConnection.java

java -cp .:jconn4d.jar GetSybaseConnection

Enter Sybase Database UserName : xxxx

Enter Sybase Database Password : xxxx

where I got this below Stack trace while connecting to Sybase driver from code :

Exception in thread "main" java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings chained to this exception for the reason(s).

 at com.sybase.jdbc4.jdbc.ErrorMessage.raiseError(ErrorMessage.java:766) 
at com.sybase.jdbc4.tds.Tds.processLoginAckToken(Tds.java:5261) 
at com.sybase.jdbc4.tds.Tds.doLogin(Tds.java:724) 
at com.sybase.jdbc4.tds.Tds.login(Tds.java:578) 
at com.sybase.jdbc4.jdbc.SybConnection.tryLogin(SybConnection.java:415)
at com.sybase.jdbc4.jdbc.SybConnection.handleHAFailover(SybConnection.java:3226) 
at com.sybase.jdbc4.jdbc.SybConnection.<init>(SybConnection.java:341) 
at com.sybase.jdbc4.jdbc.SybConnection.<init>(SybConnection.java:248) 
at com.sybase.jdbc4.jdbc.SybDriver.connect(SybDriver.java:233) 
at java.sql.DriverManager.getConnection(DriverManager.java:664) 
at java.sql.DriverManager.getConnection(DriverManager.java:247) 
at GetSybaseConnection.main(GetSybaseConnection.java:26)

I'm very sure about Hostname , port , username and password .

I tried this connection using DbVisualizer tool but there also it didn't work and throws below error An error occurred while establishing the connection:

An error occurred while establishing the connection:
Long Message:
JZ00L: Login failed. Examine the SQLWarnings chained to this exception for the reason(s).

Details:
Type: java.sql.SQLException
SQL State: JZ00L
ERROR WITH DRIVER JTDS
An error occurred while establishing the connection:
Long Message:
Adaptive Server requires encryption of the login password on the network.
Details:
Type: java.sql.SQLException
Error Code: 1640
SQL State: S1000

1) Nested Exception:
Long Message:
Login failed

Details:
Type: java.sql.SQLException
Error Code: 4002
SQL State: S1000

2) Nested Exception:
Long Message:
Login failed.

Details:
Type: java.sql.SQLException
Error Code: 4002
SQL State: S1000

One strange thing is that using isql tool I'm able to connect to Sybase Database using below command .

isql -S SERVERNAME -U USER -P xxxxxxx -X

I'm suspecting that is there any configuration we have perform from Sybase database configuration side ?

Do you see any reason regarding this weird connection behavior? Please let me know, if you need further information.

Please find attached Java Programme. sybase.png

Accepted Solutions (0)

Answers (1)

Answers (1)

c_baker
Employee
Employee

Your error message says it: "Adaptive Server requires encryption of the login password on the network."

You are telling 'isql' to encrypt the password by using '-X' but you need to add the same to your code.

Add the following as part of your URL (after "code/master") -> "?ENCRYPT_PASSWORD=true".

The URL for your connection should now be: "jdbc:sybase:Tds:hostname:port/master?ENCRYPT_PASSWORD=true"

Chris