-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
git-svn-id: svn://svn.rforge.net/RJDBC/trunk@11 4a7c0e7c-d491-4dbe-a893-edef5ccece86
- Loading branch information
There are no files selected for viewing
1 comment
on commit c6a0907
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method "dbConnect" creates two connections, 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.
This line should be as follows...
if (is.jnull(jc) && !is.jnull(drv@jdrv)) {