Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347315 - PostgreSQL : changing connection in SQL Editor with connection comboboxes does not work
Summary: PostgreSQL : changing connection in SQL Editor with connection comboboxes doe...
Status: RESOLVED FIXED
Alias: None
Product: Data Tools
Classification: Tools
Component: SQL Editor Framework (show other bugs)
Version: 1.9   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: 1.10   Edit
Assignee: Brian Payton CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-26 09:27 EDT by DUPREZ CLA
Modified: 2012-05-31 17:07 EDT (History)
2 users (show)

See Also:


Attachments
scrapbook connection patch (8.42 KB, patch)
2011-08-09 18:22 EDT, Pierre Queinnec CLA
no flags Details | Diff
Patch in EGit default format (7.56 KB, patch)
2011-10-05 03:52 EDT, Pierre Queinnec CLA
bpayton: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description DUPREZ CLA 2011-05-26 09:27:26 EDT
Build Identifier: M20110210-1200

In SQL Editor (or event in SQL Scrapbook), when a connection is already defined, connecting to a new defined connexion with the combos does not work.
In reality, the SQL Editor remains connected to the first connection.

This also happens even if you force disconnection to the first connection in the data source explorer and just keep the second connection. SQL Editor still remains connected to the first connection.

Tested with PostgreSQL JDBC connections.

The only solution I have found is to restart Eclipse and connect to the second server.

Reproducible: Always

Steps to Reproduce:
1. Create a connection to a server A in data source explorer
2. Create a connection to a server B in data source explorer
3. Create a new SQL file and connect to server A. Then execute the SQL code
4. Connect the same SQL file to server B (using combos) and execute the SQL code. The connection remains on server A
5. In the data source explorer, disconnect from server A and execute the SQL code. The connection still remains on server A
Comment 1 DUPREZ CLA 2011-06-10 04:02:30 EDT
Hi,

With the last 1.9.0 RC4 version of DTP, the bug seems to be fixed.

Sorry for the disturbance.

Regards,

C. Duprez
Comment 2 DUPREZ CLA 2011-06-10 05:19:05 EDT
Sorry, but the bug remains on DTP 1.9.0 RC4...
Comment 3 DUPREZ CLA 2011-06-24 11:18:20 EDT
The problem only occurs for manual commit.
With auto-commit, the connection is correctly closed, but with manual commit, it remains opened.
Comment 4 Pierre Queinnec CLA 2011-08-09 18:21:07 EDT
Actually the bug will happen whatever database system is used (Postgres, etc). Here's a patch that hopefully could fix this.
Comment 5 Pierre Queinnec CLA 2011-08-09 18:22:00 EDT
Created attachment 201197 [details]
scrapbook connection patch
Comment 6 DUPREZ CLA 2011-08-29 06:37:14 EDT
Hi, 

Thanks. I have just installed the last milestone version of DTP (1.9.1 RC2) and the bug is now corrected.

Regard,

C. Duprez
Comment 7 Pierre Queinnec CLA 2011-09-11 14:17:10 EDT
Hi,

I don't see any commit related to the patch in DTP_1_9_1_RC2_201108270500 , are you sure you didn't revert to auto-commit? It might completely be an oversight on my part, so sorry if that's the case.

Cheers,
-- Pierre
Comment 8 Pierre Queinnec CLA 2011-10-05 03:52:18 EDT
Created attachment 204569 [details]
Patch in EGit default format

Patch exported without checking Git format in EGit.
Comment 9 Pierre Queinnec CLA 2012-05-16 14:57:24 EDT
Hi guys, can an sqltools committer have a look at the patch? Thank you!
Comment 10 Brian Payton CLA 2012-05-16 21:51:33 EDT
OK, I done some basic testing on the fix and it looks like it works OK, in that I was able to switch connections in the SQLScrapbookEditor without problems.  I've committed the fix.  Here's the Git commit record:

http://git.eclipse.org/c/datatools/org.eclipse.datatools.sqltools.git/commit/?id=6b8d926f524dbe205e9fd31ac27c1ba4bfa050e0