Top Banner
Documentation
49

Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Jul 01, 2018

Download

Documents

trinhtuong
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Documentation

Page 2: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

TableofcontentsUserTableofContents

InstallationApplicationWindowOverview(ApplicationWindowOverview)Views

DatabaseNavigator(DatabaseNavigator)FilterDatabaseObjects(FilterDatabaseObjects)ConfigureFilters(ConfigureFilters)

ProjectsProjectExplorer(ProjectExplorer)

DatabaseConnections(DatabaseConnections)ConnectingtoDatabases(ConnectingtoDatabases)EditingConnections(EditingConnections)

DatabaseObjectEditor(DatabaseObjectEditor)PropertiesTab(PropertiesTab)DataTab(DataTab)ERDiagramTab(ERDiagramTab)

DataeditorFilters(Data-filter)WorkingwithXML(WorkingwithXML)

SQLEditorClientsidecommands(Client-side-scripting)SQLTemplates(SQL-Editor-Templates)

Databasedrivers(Databasedrivers)SQLdatabasesNoSQLdatabases

MongoDB

Page 3: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Cassandra(NoSQL-Cassandra)Redis(NoSQL-Redis)

OptionalextensionsOfficeSVGformat

MiscellaneousDiagrams(ERD)QueryManagerDatatransfer(export/import)(Data-transfer)Data/metadatasearch(Database-Search)Databasecompare(Database-compare)

Command-LineEnterpriseEdition(EnterpriseEdition)ProjectsManagement

AdminGuide

ManagingconnectionsManagingdrivers

Development

DevelopinEclipseFeaturesstructure

Troubleshooting

ResetworkspacePostingissuesLogfilesThreaddump

Page 4: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

TheinstallationprocessdependsonthedistributiontypeandyourOperationalSystem-seehttps://dbeaver.jkiss.org/download/(https://dbeaver.jkiss.org/download/)

TheinstallerdistributionistherecommendedwaytoinstallDBeaveronWindowsandMacOSX.ItisthemostlightweightduetoanadvancedarchivingtechnologythatisusesandthatisnotavailableinthecaseoftheZIParchive.Besidesthis,theinstallerautomaticallyupgradesDBeavertothenewversion,ifapreviousversionisalreadyinstalled.ToinstallDBeaver,runtheinstallerexecutableandfollowtheinstructionsinitsscreens.

NOTE:

TheinstallerdoesnotchangeanysystemsettingsortheJavainstallation.

TheIncludedJREwillbeaccessibleonlyforDBeaver.

WheninstallingDBeavermanually,withoutusinganinstaller:

1. InstallJava1.8(http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html)asaseparatestep.

2. Extractthecontentsofthearchive.NOTE:DonotunzipthearchiveoverapreviousDBeaverversion.IfyoualreadyhaveanyversionofDBeaverextractedinthesamelocation-removeitbeforeunzippingthenew

Installation

Windows/MacOSInstaller

ZIPArchive

Page 5: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

version.NOTE:Allconfigurations,scriptsandothernecessarydataarestoredinaseparatelocation(usuallyintheuser`shomedirectory)sotheprogramdeinstallationwillnotaffectthem.

3. Runthedbeaverexecutable.

ToinstallDBeaverusingaDebianpackage:

1. Run sudodpkg-idbeaver-<version>.deb .

2. Execute dbeaver& .

ToinstallDBeaverusinganRPMpackage:

1. Run sudorpm-ivhdbeaver-<version>.rpm .

2. Execute dbeaver& .

NOTE:ToupgradeDBeavertothenextversion,use sudorpm-Uvhdbeaver-<version>.rpm parameter.

YoucouldtryDMGorZIParchiveifyoucan'tusePKGinstallerforsomereason.ToinstallDBeaveronMacOS,justdrag-and-droptheDMGarchivetoyourdisk.NOTE:DBeaverrequiresJava1.8tobeinstalled,soyouneedtoinstallJDK1.8+(http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)priortoinstallingDBeaver.

DebianPackage

RPMPackage

MacOSDMG

Page 6: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Youcanalsousebrew(http://macappstore.org/dbeaver-community/):

brewinstallCaskroom/cask/java

Page 7: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Viewsarewindowswithintheworkspacethatprovidepresentationsandwaystonavigatetheinformation.ThemainviewsinDBeaverare:DatabaseNavigator(https://github.com/serge-rider/dbeaver/wiki/Database-Navigator),Projects(https://github.com/serge-rider/dbeaver/wiki/Projects)andProjectExplorer(https://github.com/serge-rider/dbeaver/wiki/Project-Explorer).

Toopenaview:

OntheWindowmenu,clickShowViewandthen,onthesubmenu,clickthenameoftheview.ClickOtheriftheviewisnotvisibleonthesubmenu.

ForDatabaseNavigator,Projects,andProjectExplorerviews,ontheWindowmenu,justclickthenameoftheview.

Someviewsopenondemand,forexampletheSearchviewopenstoshowsearchresults.

Viewsprovidetheirowntoolbarandmenu:

Views

Page 8: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Toopentheviewmenu,clicktheViewMenubuttonintheupper-rightcorneroftheview`stitlebar,nexttotheMinimizebutton.

Thetoolbarcontainsbuttonsapplicabletotheobjectsdisplayedintheview.Thesetofenabledanddisabledbuttonsdependsontheobjectinfocus.

Viewsalsoprovidecontextmenusforobjectstheydisplay.Toopenacontextmenuforanobject,right-clicktheobject.

Page 9: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Youmightneedtoclassifyandgroupdatabaseconnectionsintoprojects.Projectsstoreobjectsrelatednottoaparticulardatabasebuttoalldatabaseconnections.Theseareusuallyfilesstoredonthefilesystem.

TheProjectsviewdisplaysallprojectscreatedinthesystemandprovidestoolstomanagethem.ToopentheProjectsview,ontheWindowmenu,clickProjects(oruse ALT+W+P shortcut).

ProjectsProjects

Page 10: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Forinformationonhowtochangetheviewlayout,pleaseseetheApplicationWindowOverview(https://github.com/serge-rider/dbeaver/wiki/Application-Window-Overview)article.

Theprojectsareorganizedintoatreeandallhavethesamehigh-levelstructure:

Page 11: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Connections–repeatthecontentoftheDatabaseNavigatorviewforthisproject.YoucanperformthesameactionsovertheobjectsofthedatabasesasinDatabaseNavigator.

Bookmarks–containsbookmarks–shortcutstodatabaseobjects,see…

ERDiagrams-containsERdiagramsthatyoucandrag-and-dropherefromotherfolders

Scripts–containsscriptsthatyoucandrag-and-dropherefromotherfolders

TheProjectsviewprovidesatoolbarandViewmenuwhichcontaingenericitems.Eachobjectinthetreehasitsowncontextmenu.

ToopentheviewmenuoftheProjectsview,clicktheViewMenubutton( )intheupper-rightcornerofthewindow.Theviewmenucontainsthefollowingitems:

Icon Item Description

CreateProject OpenstheCreateProjectwizard

RefreshProjects

Refreshestheprojectstreetodisplaychangescausedbycreatingmodifyingordeletingprojects

CollapseAll Collapsesthetreetotherootlevel

Linkwitheditor

-Enabledwhenatleastoneeditorisopen,otherwisedisabled-Highlightstheobjectinthetreethat

Page 12: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

hasitseditoropen

Thetoolbarislocatedinthetitlebarofthewindow,itsbuttonsduplicatetheviewmenuitemsexceptfortheRefreshProjectsone.

Toopenthecontextmenuforanobjectinthetree,right-clicktheobject.ForinformationaboutcontextmenuitemsofallobjectsundertheConnectionsnodeofthetree,pleaseseeDatabaseNavigator(https://github.com/serge-rider/dbeaver/wiki/Database-Navigator).Thecontextmenusofothernodesinthetreecontainsomebasicitemsforcopy-pasting,renaming,deletingobjects,managingtheirproperties,creatingfolders,etc.

TheSetActiveProjectmenuitem(foraprojectrootnode)makestheprojectactive,thatisvisibleintheDatabaseNavigator.

TheLinkFile(SQLScript)andLinkFoldermenuitemsallowcreatinglinkstofilesandfoldersinthefilesystem.

TheProjectsviewallowscreatingnewprojectsaswellasrenaminganddeletingprojectsthatarenotactive.NOTE:Youcannotrenameordeleteaprojectthatissetasactive.

Tocreateaproject,intheProjectsview,inthetoolbar,clickCreateProject( ).TheProjectCreateWizardopens.

ManagingProjects

CreatingProject

Page 13: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

TBA

Todeleteaproject,intheProjectsview,right-clickitsnameinthetreeandclickDeleteonthecontextmenu.Twoconfirmationdialogboxesappearoneafteranother:

1. Deleteobjectdialogboxistoconfirmthedeletionoftheprojectitself.ClickYesifyouaresureyouwanttodeleteit.Otherwise,clickNo.

2. Deleteprojectdialogboxistoconfirmthedeletionoftheproject`scontents:thesearethedatastoredinthefilesystem,databaseconnectionsarenotaffected.ClickYesif

DeletingProject

Page 14: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

youwantthecontentstobedeletedaswell.Tokeepthecontents,clickNo.

NOTE:Ifyouhavedeletedaprojectandthenre-createitwiththesamename,thenewprojectpicksupallthedatabaseconnectionsofthedeletedproject.

Bookmarksarequickaccesslinkstoobjectsofadatabase.TheyappearintheprojecttreeinsidetheProjectsorProjectExplorerviews.

Tocreateabookmark:

1. IntheDatabaseNavigatororunderConnectionsnodeoftheProjectsview,clickthedatabaseobjectofinteresttosetfocusonit.

2. Press CTRL+d .TheBookmarkNamedialogboxappears.

3. IntheBookmarkNamefield,enterthebookmarkname,thenintheBookmarkfolderfield,clickthefolder,andthenclickOK.Thebookmarkappearsintheselectedfolderoftherelatedproject.

Toopenanobjectusingitsbookmark,double-clickthebookmarkorright-clickitandclickOpenBookmarkonthecontextmenu.Youcanrenameanddeletebookmarksusingthecontextmenuaswell.

ManagingBookmarks

Page 15: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

TheDataeditorappears:

AstheDatataboftheDatabaseObjectEditor(https://github.com/serge-rider/dbeaver/wiki/Database-Object-Editor)availableonlyfortablesandviews.

AstheResultstabwhenyourunacustomSQLqueryinSQLEditor(https://github.com/serge-rider/dbeaver/wiki/SQL-Editor)

TheDataeditorallowsviewingandeditingthedataofadatabasetableorview.ThecentralpartoftheDataeditoristhedatatable.Theeditoralsoprovidestwotoolbarsandafilterfield:

Everycellinthedatatablehasacontextmenu–right-clickthecelltoopenthemenu.Thecontextmenuprovidesthefollowingitems:

MenuItem Description

Cutsthecontentofthecurrentcellor

Dataeditor

Page 16: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Cut columntotheclipboard

Copy Copiesthecontentofthecurrentcellorcolumntotheclipboard

AdvancedCopy

Opensadvancedcopysubmenuthatallowscopyingdatawithpresetformattingparameters

Paste Pastesthecopiedcontenttothecellsinfocus

AdvancedPaste

Pastesseveralvaluesdelimitedwithatabulationorlinebreak

Delete

DeletestherowthathasthecellinfocusNOTE:Infact,whenusersclickDelete,thesystemonlyhighlightstherowredwhiletheactualdeletionhappenswhenusersclickSave.

Editcell

-ForCLOB/BLOBdataformat,opensthecontentsofthecellinanewtab-ForallformatsexceptCLOB/BLOB,opensapropertieswindowforthecell

Inlineedit -Sameasdouble-clickonacell-Makesthecelleditable

SettoNULL SetsthevalueofselectedcellstoNULL

HidecolumnHidesthecolumncurrentlyinfocus,seetheManagingDisplayofColumnsinDataTablesectionfurtherinthisarticle

Page 17: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Savetofile…

-AppearsonlyforcolumnswithBLOB/CLOBdata-OpensthestandardSaveAswindowthatallowssavingdatacontainedinthecelltoafile

Loadfromfile…

-AppearsonlyforcolumnswithBLOB/CLOBdata-Opensastandardwindowforopeningfiles

Order/Filter

Displaysasubmenuthatallowsselectingfiltercriteriaforthedata.Thesubmenucontainsthemostcommonfiltersthatcanbeappliedtothecellinfocus–seedetailsin…Bydefault,DBeaverfiltersdatabysendingarequesttotheserver(theServer-sideresultsorderingcheckboxselected).TofilterdataontheclientsideusingDBeaver`sinternalalgorithm,clearthecheckbox.

View/FormatOpensasubmenuthatprovidestoolsforformattingandmodifyingtheviewofdata,see…

Navigate Opensasubmenuthathelpsusersnavigatethroughoutthedatatable,see…

Layout Changesthelayoutofdata,see…

Export

OpenstheDataTransferwizardthatguidesyouthroughthestepstoselectaformatandexportdataNOTE:Thesystemexportsthewholeresult

Page 18: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Resultset… setincludingrecordsthatarenotvisibleinthescreenandpreservesallapplieddatafiltersandordering.

GenerateSQL

OpensasubmenuonwhichyoucanselectthetypeofSQLquerytogenerate

Refresh Refreshesthewholeresultssetincludingallitemsthatarenotvisibleinthescreen

Page 19: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

YoucancreatemultipleSQLscriptsforasingleconnection.EveryscriptopensinitsownSQLeditor.ToopenanSQLeditorforsomeconnection:

ClickthisconnectionintheDatabaseNavigator(https://github.com/serge-rider/dbeaver/wiki/Database-Navigator)viewandpress F3 orclickSQLEditor->SQLEditoronthemainmenu.Alternatively,youclickSQLEditoronthecontextmenuofthisconnection.DBeaveropenstheChooseSQLscriptwindowwithsavedSQLscriptslinkedtothisconnection.CLicktheSQLscripttoopenitinaseparatetab.

ClickRecentSQLEditoronthecontextmenuforthisconnectionoronthemainmenu(SQLEditor->RecentSQLEditor).ThisopensthelatestusedSQLeditor.YoucanalsoopenthemostrecentSQLeditorusing Ctrl+EntershortcutintheDatabaseNavigatorview.

IfyouneedtocreateanewSQLscript,onthemainmenu,clickSQLEditor->NewSQLEditororpress F3 andthenclickNewScriptintheChooseSQLScriptwindow.

DBeaverusesSQLsyntaxhighlightingwhichdependsonthedatabaseassociatedwiththescript.Differentdatabaseshavedifferentsetsofreservedkeywordsandsystemfunctions.

NOTE:SQLEditorforaconnectionisdifferentfromSQLconsoleforatableorview(right-clickthetableandclickReaddatainSQLconsole)inthat,unliketheconsole,itcansavescriptsandchangestothem.

SQLEditor

Page 20: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

YoucanseeallyoursavedSQLscriptsintheProjectExplorer(https://github.com/serge-rider/dbeaver/wiki/Project-Explorer)viewintheScriptsfolder.

TheSQLeditorincludesthescriptpaneatthetopandresultspaneatthebottom:

Theresultspanedisplaystabswithresultsinvariousformats.ThetabsresultingfromscriptexecutionrepresentinstancesoftheDataEditor(https://github.com/serge-rider/dbeaver/wiki/Data-Editor).Youcancreate,editandexecuteSQLscriptsinthescriptpaneandthenseetheresultsintheresulttabs.

Totoggle(hide/show)theresultspane,press F6 .

Tomaximizetheresultspane,press Shift+F6 ordouble-clicktheresultstabname.

ResultsPane

Page 21: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Toswitchbetweenthescriptpaneandtheresultspane,pressAlt+F6 .

TheresultspaneprovidesOutputandLogviewsofresults.

TheexecutionLogtabcontainsallqueriesexecutedinthecurrentSQLeditor:

TheOutputtabcontainsallserver-sidedatabasemessages/warningsgeneratedbyadatabasewhenyouexecutequeries.Thisfeatureissupportedonlybyafewdatabaseengines(Oracle,SQLServerandsomeotherones).

Youcanpress Ctrl andmovemouseoverSQLtext.IfDBeaverrecognizessomeidentifierasatable/viewnamethenitpresentsitasahyperlinkwhichwillnavigatetothisobject`seditor.

TochangetheconnectionassociatedwiththecurrentSQLeditororchangetheactivedatabase/schema,usethecomboboxesinthemaintoolbar:

Hyperlinks

ActiveDatabase/SchemaSelection

Page 22: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Youcantoggleauto-commitmodeandtransactionsisolationlevelontheDatabasemenuorinthemaintoolbar:

TransactionsManagement

Page 23: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Note:MongoDBextensionisavailableonlyinEnterprise-Editionversion.

Youcanview/editMongocollectionscontentasstandardrelationaltables(grid/plaintextpresentations)orasJSONdocuments.PresentationcanbeswitchedintheResultsViewertoolbar.IngridDBeaverwilltrytounifyalldocumentsinsomeparticularcollection(astheyhavethesamestructure/thesamesetofproperties).

JSstatementscanbeexecutedinSQLeditorasusual.Mongoscriptingreference(https://docs.mongodb.com/v3.0/administration/scripting/)Followingexamplecreatesauserinthecurrentdatabase.

db.createUser({user:"testuser",pwd:"test",roles:[]})

Thisexamplereturnsalldocumentsincollection'test_col':

db.test_col.find().toArray()

MongoDB

BrowsingMongocollections

ExecutingJS

Page 24: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Note:scriptwillbeexecutedinthecurrentdatabase.Youcannotsetexplicitdatabasenameinyourquery.CurrentdatabasecanbechangedinSQLEditortoolbarorinDatabaseNavigator.

YoucanusestandardSQLstatements(SELECT,INSERT,UPDATE,DELETE)tomanipulateMongodata.

SELECT*FROMtest_colWHEREpropName.subProp='value';

UPDATEFROMtest_colSETpropsName.val1=123WHEREpropName.subProp='value'

NestedJSONpropertiescanbedividedbydot.

ExecutingSQL

Page 25: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

ThisextensionsupportsdataexportinOfficeformats(XLS).

ItisincludedinEEversion.

1. Mainmenu Help->InstallNewSoftware

2. InstallOfficeextension.YoucandothisfromonlineEclipseMarketplace(https://marketplace.eclipse.org/content/dbeaver-office-integration(https://marketplace.eclipse.org/content/dbeaver-office-integration)).Oryoucandothismanually:

Paste https://dbeaver.jkiss.org/update/office/latest/ intoWorkwith fieldandpress Enter

Check DBeaverExtension->DBeaverOfficeExtension item

3. ClickNext->Finish.RestartDBeaver.

Note:thisworksonlyifDBeaverversionmatchesOfficeextensionversion(e.g.latest).

Office

InstallationinCEversion:

Page 26: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

ThisextensionsupportsdataexportinOfficeformats(XLS).

ItisincludedinEEversion.

1. Mainmenu Help->InstallNewSoftware

2. InstallOfficeextension.YoucandothisfromonlineEclipseMarketplace(https://marketplace.eclipse.org/content/dbeaver-svg-support(https://marketplace.eclipse.org/content/dbeaver-svg-support)).Oryoucandothismanually:

Paste https://dbeaver.jkiss.org/update/svg/latest/ into Workwith fieldandpress Enter

Check DBeaverExtension->DBeaverOfficeExtension item

3. ClickNext->Finish.RestartDBeaver.

Note:thisworksonlyifDBeaverversionmatchesOfficeextensionversion(e.g.latest).

SVGformat

InstallationinCEversion:

Page 27: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

EntityRelationDiagrams(ERD)aregraphicpresentationsofdatabaseentitiesandrelationsbetweenthem.DBeaverallowsviewingdiagramsofexistingtablesandwholedatabaseschemas,seeDatabaseStructureDiagrams(https://github.com/serge-rider/dbeaver/wiki/Database-Structure-Diagrams),aswellascreatecustomdiagrams,seeCustomDiagrams(https://github.com/serge-rider/dbeaver/wiki/Custom-Diagrams)

Bothtypesofdiagramsprovidethesametoolstoadjusttheirviewandstructure.Theycanbeprintedandexportedtoimagefileformats.

NOTE:Allchangestoexistingdatabaseschemascannotbesavedandareintendedforexplorationpurposesonly.Youcandothefollowingstructurechangesindiagrams.

Addnewtablestoadiagrambydrag-n-droppingthemontothediagramfieldfromtheDatabaseNavigator(https://github.com/serge-rider/dbeaver/wiki/Database-Navigator).

Rearrangetablesinthediagrambydraggingthemalloverthespace.Youcanselectseveraltablesanddragthemtoanewlocation.

Auto-arrangetablesintoacompactviewaftermanualrearrangements:clicktheArrangeDiagram( )inthetoolbaroronthecontextmenu(right-clickanywhereonthediagramtab).

Diagrams(ERD)

StructureAdjustment

Page 28: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

(AvailableforCustomDiagrams(https://github.com/serge-rider/dbeaver/wiki/Custom-Diagrams)only)-connecttableswithaconnector:clicktheShowPalettebutton( )intheupper-leftcornerofthediagramtabandthen,inthePalettepanel,clickConnection.Nowclickthetablesthatyouwanttoconnectwitheachotherinturnonebyone,andthentostoptheconnectionlinedouble-clickingthelasttable.

(AvailableforCustomDiagrams(https://github.com/serge-rider/dbeaver/wiki/Custom-Diagrams)only)-removetables:right-clickthetableandclickDeleteonthecontextmenu.

Youcanadjusttheviewofanydiagraminthefollowingways:

Enable/disablethediagramgrid:ClickToggleGrid( )inthetoolbar.

Modifyattributesvisibility:Right-clickthediagramand,onthecontextmenu,clickShowAttributesandthenoneoftheoptions:

All-allattributes

Anykeys-primaryandforeignkeys

Primarykey-onlyprimarykeys

None-noattributes

Modifyattributespresentation:Right-clickthediagramand,onthecontextmenu,clickAttributeStylesandthenoneoftheoptions:

ViewAdjustment

Page 29: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

ShowIcons

ShowDataTypes

ShowNullability

ShowComments

Changethecolorofentities/notes:Right-clicktheheaderoftheentityorcommentandthenclickSetcoloronthecontextmenu.ThenyoucanselectthecolorandclickOK.

Forelementslocatedinfrontof/behindothers,bringanelementtofrontorsendtoback:Right-clicktheelementandthenclickBringtofront/Sendtobackonthecontextmenu.

Zoomthediagramin/out:ClicktheZoomIn/ZoomOutbuttonsorchoosethescalingvalueinthedropdownlistinthetoolbar:

Toseechangesmadetothedatabaseschemabyotherusers,youmightneedtorefreshthediagram:clickRefreshDiagram( )inthetoolbar.

YoucancreatenotesonlyinCustomDiagrams(https://github.com/serge-rider/dbeaver/wiki/Custom-Diagrams).Tocreateanote,clicktheShowPalettebutton( )intheupper-

Refresh

NotesCreation

Page 30: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

leftcornerofthediagramtab,then,inthePalettepanel,clickNoteandthenclickanywhereinthediagramtab.Nowyoucandouble-clickNoteboxtoenterthenotetext.

Tosearchamongentitiesofadiagram,clicktheSearchitemsbutton( )inthetoolbar,thentypeinthesearchcombination.Theentitiesthatcontainthesearchcombinationarehighlightedinthediagram.Toremovethefilter,clickthecrossiconnexttothesearchfield.

Youcanexport(save)adiagramasanimage(PNG,GIF,BMPformats)orasafileinGraphMLformat.Toexportadiagram,clickSavediagraminexternalformat( )inthetoolbar.

Toprintadiagram,press CTRL+P orclickPrintDiagram( )inthetoolbar.

Tomodifythediagramsettings,clickConfiguration( )inthetoolbar.

SearchinDiagramEntities

DiagramExport

DiagramPrinting

Settings

Page 31: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

IntheQueryManagerviewyoucanseeallSQLqueriesDBeaverexecutes.

DBeaverlogseveryqueryyouexecute.Youcanseeallpreviouslyexecutedqueriesinthespecialview“QueryManager”.Youcanopenitthroughmainmenu“Window->ShowView”.

Youcanseequeryexecutionstatistics(executiontime,numberoffetched/updatedrows,errors,etc).

EEversionpersistsallexecutedqueriesintheinternaldatabasesoexecutionhistoryisavailableafterprogramrestart.

BydefaultQMshowsonlyqueriesexplicitlyexecutedbyuser(inSQLeditororinDataEditor).Youcanconfigurelogsvisibility,monitormetadatareadingqueries,utilitySQL,etc.QMconfigurationavailableinglobalpreferences.

QueryManager

Page 32: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Commandlineparametersmightbepasseddirectlytodbeaver[.exe]executable.OnWindowsyoualsocanuse dbeaver-cli.exe executable(itdoesn'tspawnnewwindowsoyoucanseeoutputmessages).

Name Value Example

-help Printshelpmessage

-stop QuitsDBeaver

-dump PrintsDBeaverthreaddump

-f OpensfileinDBeaverUI-fc:\some-

path\some-

file.sql

-con OpensdatabaseconnectioninDBeaverUI

Seeconnectionparameterstable

-closeTabs Closesallopeneditortabs

-disconnectAll Closesallopenconnections

Forcereuseofsingle

Command-LineCommandlineparameters

DBeavercontrol

Page 33: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

-reuseWorkspace

workspacebymultipleDBeaverinstances

-newInstance

ForcenewDBeaverinstancecreation(donottrytoreusealreadyrunningone)

Name Value Example

-nl Locale en_US

-data Workspacepath c:\ProgramData\MyWorkspace

-nosplash

Omitssplashscreen true

-clean

ClearsallEclipsecaches.UseitifDBeaverfailstostartafterversionupgrade.

-vmargs VMparameters SeeVMargumentstable

Systemparameters

VMarguments

Page 34: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

YoucanpassanyadvancedJavaparameterssupportedbyyourlocalJVM(Oracle,OpenJDK,IBM,etc).ParameterssupportedbyOracleJVM(1.8):https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html(https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html)

ParameterssupportedbyallJVMs:

Name Value Example

-Xms SetsinitialmemoryavailableforDBeaver

-

Xmx1000m

-Xmx SetsmaximummemoryavailableforDBeaver

-

Xmx4000m

Allconnectionparametersmustbesuppliedasasinglecommandlineargument,parametersaredividedbypipe( | ).Parameternameandvaluearedividedby = .Example:-condriver=sqlite|database=C:\db\SQLite\Chinook.db|name=SQLiteChin|openConsole=true|folder=SQLite

Name Value Example

name Connectionname Testconnection

driver DrivernameorID driver=sqlite , driver=mysql ,etc

ConnectionURL.Optional

Connectionparameters

Page 35: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

url(JDBCURLmaybeconstructedbydriverfromotherparameters)

url=jdbc:sqlite:C:\db\SQLite\Chinook.db

hostDatabasehostname(optional)

host=localhost

port

Databaseportnumber(optional)

port=1534

server

Databaseservername(optional)

server=myserver

database

Databasenameorpath(optional)

database=db-name

user Username(optional) user=root

passwordUserpassword(optional)

password=mysecret

Donotaskuse

Page 36: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

savePassword passwordonconnect

savePassword=true

connectConnecttothisdatabase

connect=false

openConsole

OpenSQLconsoleforthisdatabase(setsconnect totrue)

openConsole=true

folderPutnewconnectioninafolder

folder=FolderName

autoCommit

Setsconnectionautocommitflag(defaultvaluedependsondriver)

autoCommit=true

prop.propName

Advancedconnectionparameters(dependondriver)

prop.connectTimeout=30

Page 37: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Thisguidedescribeshowtomanage/secureDBeaverdatabaseconnections.ItisdesignedforSystemadministrators.Regularusersshouldcheckthisguide.

DBeaverkeepsinformationaboutprojectconnectionsinfile.dbeaver-data-sources.xml .Youcanfinditinprojectfolder(bydefaultallprojectsresideinworkspace,defaultworkspacelocationis %HOMEPATH%\.dbeaver4 (or ${HOME}/.dbeaver4 ).Defaultprojectfolderis %HOMEPATH%\.dbeaver4\General .

DBeavercanloadmultipleconnectionfiles.Anyfilesinprojectfoldermatching .dbeaver-data-sources*.xml patternwillbeloadedonstartup.Soyoucancreateafile,say, .dbeaver-data-sources-2.xml intheprojectfolderandDBeaverwillseeit.

YoucanimportconnectionfromCSVorXMLfiles.

CSVfilemusthaveaheaderrow(firstlineoffile)withcolumnnames(seelistofsupportedcolumnsbelow).XMLfileshouldcontaintop-levelelementandasetofnestedelements.Connectionsconfigmustbespecifiedinattributesofnestedelements.AttributenamesarethesameasCSVcolumnnames.

Name Meaning

name Connectionname

Managingconnections

Providepredefinedconnections

ImportingconnectionsfromCSV/XML

Supportednames:

Page 38: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

url JDBCURL

host Databaseserverhostname

port Databaseserverport

database Database/schemaname

user Username

password Userpassword

YoucanspecifyjustURLorsethost/port/etcsetting.Username/passwordareoptions.

name,host,port,server,database,url,user,password,typePostgreImportXML1,localhost,5432,,postgres,jdbc:postgresql://localhost:5432/postgres,postgres,postgres,devPostgreImportXML2,localhost,5432,,postgres2,jdbc:postgresql://localhost:5432/postgres2,postgres2,postgres2,prod

<connections><connectionname="PostgreImportXML1"host="localhost"port="5432"server=""database="postgres"url="jdbc:postgresql://localhost:5432/postgres"user="postgres"password="postgres"type="dev"/><connectionname="PostgreImportXML2"host="localhost"port="5432"server=""database="postgres"url="jdbc:postgresql://localhost:5432/postgres2"user="postgres2"password="postgres2"type="prod"/></connections>

SampleCSV

SampleXML

Secureconnectionsfromediting

Page 39: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Itispossibletomakeconnectionsettingsread-only(protectedbypassword)

GenerateMD5hashofyourpassword.YoucandoitfromcommandlineusingLinuxutilitymd5sum( md5sum<<<"yourpassword" )oryoucandoitonline-justgoogle"MD5hashonline".

Addattribute lockPassword inconnectiondescriptor(in.dbeaver-data-sources.xml filein <dataSource> tag.Soitwilllooklikethis:

<data-sourceid="postgresql-1294077257514--1782558860"provider="postgresql"driver="postgres-jdbc"name="Postgre-sample"create-date="1294077257524"update-date="1468749632751"login-date="1469021247956"save-password="true"show-system-objects="true"read-only="false"lockPassword="2ba81a47c5512d9e23c435c1f29373cb">

Nowifuserwilltrytochangeconnectionsettingshe/shewillbeaskedforpassword

Page 40: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Youcancustomizedriversconfigurationin${HOME}/.dbeaver4/.metadata/.plugins/org.jkiss.dbeaver.core/drivers.xml

file.Ifyouhavesomepre-installedjarfilesyoucanreferencethemindrivers.xml.Example:

<librarytype="jar"path="absolute-jar-folder-path\driver-jar.jar"custom="true"/>

Alsoindrivers.xmlyoucanusefollowingvariablestospecifyrelativepaths:

Variable Meaning

drivers_home StandardDBeaverdriverslocation( ${HOME}/.dbeaver-drivers bydefault)

dbeaver_home DBeaverinstallationfolder

home Userhomefolder

workspace DBeaverworkspacepath( ${HOME}/.dbeaver4 bydefault)

Forinstance:

<librarytype="jar"path="${dbeaver_home}\drivers\my-driver.jar"custom="true"/>

ManagingdriversConfiguredriverswithpre-installedjars

Page 41: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

DBeaverisanEclipseRCP(https://wiki.eclipse.org/Rich_Client_Platform)application.ItconsistsfromasetofEclipseplugins,featuresandproducts.

docs -somedocumentations(mostlyoutdated)

features -featuredescriptors.Doesn'tcontainanysourcecode.Usedtostructurizeproductplugins/dependencies.

bundles -verybaseplugins(likeutils)

plugins -mainsourceslocation

org.jkiss.dbeaver.model -modelAPIandbaseclasses.Doesn'tcontainanyUIdependencies,justpuredatamodel.

org.jkiss.dbeaver.core -mainDBeavermodule.MostofbaseUIclassesarehere.

org.jkiss.dbeaver.core.application -relativelysmallmodulewhichconfiguresstandaloneDBeaverapplication.

org.jkiss.dbeaver.core.eclipse -mainEclipseplugin.Addssomeextramenus/viewstostandardEclipseIDE.

org.jkiss.dbeaver.ext.* -DBeaverextensions

product -finalproducts(standaloneandEclipseplugin)configuration.

DevelopinEclipse

Sourcesstructure:

OpeningworkspaceinEclipse

Page 42: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Youwillneedtosetup"EclipseforRCPandRAPdevelopers(https://www.eclipse.org/downloads/packages/eclipse-rcp-and-rap-developers/oxygen1a)".CurrentlydefaultEclipseversionisOxygen(4.7).Buildmayfailonnewerorolderversions.ThenyouwillneedtoinstallafewadditionalEclipsepluginswhichDBeaverdependson(andwhicharenotincludedinthestandardEclipsedistribution):

OpenmainmenuHelp->InstallNewSoftware

Copy http://dbeaver.jkiss.org/eclipse-repo/ into"Workwith"fieldandpressenterimages/eclipse-deps-install.png

Checkallpluginsandfinishtheinstallationprocess

NowyouneedtocheckoutDBeaverrepositorywith gitclonehttps://github.com/serge-rider/dbeaver.git command.InEclipsecreateanewworkspaceandrunImportwizard.Choose"General->ExistingprojectsintoWorkspace".SelectDBeavercheckoutdirectoryasrootadirectory.CheckallpluginsandfeaturesEclipsewillfindandfinishthewizard.

NowyoucanbuildDBeaver( Ctrl+B ).Torunthestandaloneversionfindfile DBeaver.product (itislocatedin product/standalonedirectory).Openitandclickon"LaunchanEclipseapplication"or"LaunchanEclipseapplicationinDebugmode".

Ifproductwon'tstartwith Noapplicationidhasbeenfound errortrythisworkaround:https://stackoverflow.com/questions/13575695/eclipse-rcp-no-application-id-has-been-found(https://stackoverflow.com/questions/13575695/eclipse-rcp-no-application-id-has-been-found)

Page 43: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

WhatyouneedtodoisgotoyourRunConfigurations(Run->RunConfigurations).SelectthePlug-instabandthenhit"AddRequiredPlug-ins".Apply,thenRun,anditshouldworknow.

That'sit.

EverythingabovecoversCommunityEditionversion.

Notes:

Page 44: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

TheDBeaverfeaturesarestructuredtosupportboth"IDE"and"RCA"mode

(https://github.com/serge-rider/dbeaver/wiki/images/development/DBeaver-CE-Features.png)/images/development/DBeaver-CE-Features.png

FeaturesstructureFeaturesStructure

Page 45: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Sometimes(especiallyaftermultipleDBeaverversionsupgrade)workspacebecomemessy.Somekeyboardshortcutsmaystopworking,toolbarslayoutmaybebroken,etc,etc.ToresetallUIsettings(thisincludesmenus,shortcuts,viewandtoolbarlayouts):

1. ShutdownDBeaver

2. Gotodirectoryto%HOMEPATH%\.dbeaver\.metadata\.plugins\org.eclipse.e4.workbench\

Windows: Win+R ,enter%HOMEPATH%\.dbeaver\.metadata\.plugins\org.eclipse.e4.workbench\

Linux: cd$HOME/.dbeaver/.metadata/.plugins/org.eclipse.e4.workbench/

3. Deletefile workbench.xmi

4. StartDBeaver

Ifthatdoesn'thelpthenyoucantrytoremove%HOMEPATH%\.dbeaver\.metadata\ folder.ThiswilleraseallyourUIsettingsandSQLscriptsconfigurations(butallconnectionsandscriptswillremain).Doitonlyifnothingelsehelps!

That'sit.

Resetworkspace

Page 46: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Afewtips.

Checkexistingissuesforyourissue(includingclosedones).Duplicatinganissueisslowerforbothpartiessosearchthroughopenandclosedissuestoseeifwhatyou’rerunningintohasbeenaddressedalready.

Beclearaboutwhatyourproblemis:whatwastheexpectedoutcome,whathappenedinstead?Detailhowsomeoneelsecanrecreatetheproblem.

Ifyoupostingabugreportcheck"ErrorLog"view.Ifthereareanyerrorsrelatedtoyourbugthenpostacompletestacktrace.SometimestherearenoerrorsinErrorLog-thentrytofindtheminlogfiles.

Ifyourissueisrelatedtoadatabasedataormetadatamanagement-checktheQueryManagerview.ItcontainsinformationaboutallqueriesDBeaverexecutes(explicitlyorimplicitly).ToseemoredetailedinformationyoucanconfigureQueryManagerinPreferences.images/qm-view.png

Dependingonthenatureofyourbugreportprovideinformationabout:

Operatingsystem

Windowmanager(forLinux)

Database(nameandversion)

Databasedriver(nameandversion)

Postingissues

Page 47: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Donotwriteissuetypeintheissuetitle(likeFeatureRequest:,Bug:etc).We'llreviewyourissueandassignacorrespondinglabel.

Page 48: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

DBeaverwritesdifferentlogfiles.MostofthemareEclipselogs.Usuallylogfilesresidesintheworkspace.Defaultworkspacelocationis ${HOME}/.dbeaver ( ${HOME}/.dbeaver4forDBeaver4.x+).

Twostandardlogfiles:

<workspace-path>/.metadata/.log -allwarningsanderrorswhichhappensduringnormalwork

<workspace-path>/.metadata/dbeaver-debug.log -thesameas .logplusdebuginformation

Inspecialcaseslogfilescanwritteninotherdirectories.SpecialcaseisanemergencysituationwhenDBeavercan'tstartandthereisnoworkspace.Twotypicalplacestofindemergencylogs:

<install-path>/configuration

${HOME}/.eclipse/org.jkiss.dbeaver.product_<dbeaver-version>

Ifyouarereportingaboutsomeerrorpleaseattachlogs(notcompletefilebutvaluablepartofit).Logsareveryuseful,bignumberoferrorscan'tbereproduced/fixedwithoutfullerrorstacktrace.

Logfiles

Page 49: Documentation - DBeaver Enterprise Edition | … Diagram Tab (ER Diagram Tab) Data editor Filters (Data-filter) Working with XML (Working with XML) SQL Editor Client side commands

Sometimes(duetosomebug)DBeaverUIhangs,freezesorworksincorrectly.Usuallyitisimpossibletofindthereasonofsuchproblemwithoutthreaddump.ThreaddumpistheinformationaboutinternalexecutionstateofJavaprogram.Togetthreaddump:

Runthefollowingonyourterminal:

jstack$(psaux|grep-m1dbeaver|awk'{print$2}')>thread-dump.txt

Justopentaskmanager(CTRL+Escape),findDBeaverintheprocesslistandcopyprocessIDvalue.OnWindows8+youneedtoswitchto"Details"tab.Run

jstack<PID>>thead-dump.txt

inCommandPrompt.

Nowyoucanattachthread-dump.txttotheGitHubissue.

Threaddump

MacandLinux

Windows