sponsor Vim development Vim logo Vim Book Ad

sql_tool_swb : run sql statements using sql workbench/j

 script karma  Rating 0/0, Downloaded by 170  Comments, bugs, improvements  Vim wiki

created by
leo du
 
script type
utility
 
description
This plugin run your SQL statements and show results in a split window.
Works on both Linux and Windows.

Requires SQL Workbench/J (http://www.sql-workbench.net/)

It works with any DBMS supported by SQL Workbench/J (PostgreSQL, Oracle, SQLite, MySQL, SQL Server etc.).
See the complete list here: http://www.sql-workbench.net/databases.html.

Usage:

use this key sequence to select/change sql connection: \swl

use this mapped key sequence to run sql: \se
In normal mode, this runs the line where cursor is on;
In visual mode, this will run sql that was selected;

Prepend block:
sometimes it is convenient to prepend your sql with some static statment.
It can be done by starting your sql file with a block:  /* PRE: <some statements> */

In addition, a Sql Workbench/j connection profile can also be specified with WbProfile=<profile_name>; on the first line.

below is an example file:
1 /* PRE: WbProfile=ConnProfile1;
2     USE EmployeeDB;
3     WbVarDef EID=250;
4  */
5
6 Select * From Employees Where EmployeeID=$[EID];
7
8 Update Employees Set Sal=Sal*1.5 Where EmployeeID=$[EID];
 
install details
Requirement: Install SQL Workbench/J (http://www.sql-workbench.net/), and have some working connections.

Install:Standard Vimball install, or just unzip and copy the vim script to your plugin folder.

Vim Setup:
Set these two values in _vimrc:

"path to java bin
let g:sqlwbc_java_bin = '/usr/bin/java'
"path to sql workbench/j jar file
let g:sqlwbc_swb_jarfile = '~/sqlworkbench/sqlworkbench.jar'

 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
sql_tool_swb-1.3.1.vmb 1.3.1 2020-07-03 7.0 leo du added help file, and optional global config var;
sql_tool_swb-1.3.vmb 1.3 2020-06-26 7.0 leo du added default profile;
sql_tool_swb-1.2.vmb 1.2 2020-05-23 7.0 leo du added profile choice menu; added prepend sql block support;
sql_tool_swb-1.1.vmb 1.1 2020-04-19 7.0 leo du added <leader>swa mapping
sql_tool_swb.vmb 1.0 2020-04-01 7.0 leo du Initial upload
ip used for rating: 18.204.55.168

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
OSDN.net Logo