This is specifically for jtopenlite.
- JDBCConnection.java:201 - this
getConnection
method makes a call toDatabaseaConnection.getConnection
- DatabaseConnection.java:150 - there are two important calls here. It looks like it is actually making two sockets.
- The first connection is to authenticate the user. From this we can get the server level/version and also the password level - this is needed for later.
- This calls SignonConnection.Java:230 (
getConnection
) which then calls another overload at line line 242. - From here it then creates a new instance of
SignonConnection
, calls theauthenticate
method (like 45), passing in the user/password - returning the connection. - The authentication method is actually what is used to determine the system CCSID, which is then used for future connections (including future database connections)
- Then at DatabaseConnection.java:150 will call another overload method. But notice how it is passing in the
conn.getInfo()
returning object as a parameter. That object (SystemInfo, from SignonConnection:120) contains info like password level, ccsid and other things. - The overload method,
getConnection
at DatabaseConnection.java:176, creates yet another socket (line 184).- The library also uses its own class called
HostInputStream
to read and write to streams.
- The library also uses its own class called
- At DatabaseConnection.java:199 is where it calls the
connect
method. SinceDatabaseConnection
inheritsHostServerConnection
, the method can be found at HostServerConnection.java:198.- It first does some enchanting of seeds/bytes before actually encoding the username and password, using their own retrospective methods:
getUserBytes
andgetPasswordBytes
(note that the password level is passed in!) - Note that both the username and password are both passed in to the server as 37 if the password level is less than two - otherwise unicode. See Conv.java for all that code.
- Note that the password is also encoded as either SHA or DES. If the password level is 2 or more, DES is used.
- After that, all the info is sent over the socket. We then check for errors using the
getReturnCodeMessage
function and also grab the job name before returning the job name.
- It first does some enchanting of seeds/bytes before actually encoding the username and password, using their own retrospective methods:
- Back in JDBCConnection.java:206, we then set some attributes in a new instead of the class
DatabaseServerAttributes
, which in return callsDatabaseConnection.setServerAttributes
- We now have successfully created a socket connection to Db2 for i.