Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbConnect creates two connections, one of which is orphaned #1

Closed
amarek96 opened this issue Dec 3, 2013 · 0 comments
Closed

dbConnect creates two connections, one of which is orphaned #1

amarek96 opened this issue Dec 3, 2013 · 0 comments

Comments

@amarek96
Copy link

amarek96 commented Dec 3, 2013

Method "dbConnect" creates two connection, one of which is orphaned. The method first invokes java.sql.DriverManager.getConnection(), which creates the first connection. The following if-statement checks if jc is null OR drv@jdrv is not null. Instead of OR it should be AND, i.e. if (is.jnull(jc) && !is.jnull(drv@jdrv)).

The OR incorrectly lets dbConnect enter the if-statement if drv is not null and thus create a second (duplicate) connection with java.sql.Driver.connect(). For example:

drv = JDBC("com.teradata.jdbc.TeraDriver","c:\terajdbc\terajdbc4.jar;c:\terajdbc\tdgssconfig.jar")
con = dbConnect(drv,"jdbc:teradata://system","user","password")
dbDisconnect(con)

The dbDisconnect will only close one of the two connections created by dbConnect.

@s-u s-u closed this as completed in 1db799d Dec 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant