Start a new topic

Command Line Issue

[This topic is migrated from our old forums. The original author name has been removed]

I searched the forum and found some information for running a sql script from the command line and I tried but it will not open the DB Connection. I have tried with and without the -driver and nothing works. I have DbVisualizer 7.0.1. It successfully loads the script then stops. "C:\Program Files\DbVisualizer\dbvis.exe" -driver -alias "UG401" -sqlfile "H:\My Documents\CPP\CPP Monoline Merge\1Tools\SQL for Comparison.sql" -execute -invisible

[This reply is migrated from our old forums. The original author name has been removed]

Re: Command Line Issue
Got it/
[This reply is migrated from our old forums.]

Re: Command Line Issue
Alan, Just to inform that it is now (version 7.0.3) possible to launch the bat scripts while being located in any directory and not only the installation directory. Best Regards Roger
[This reply is migrated from our old forums.]

Re: Command Line Issue
Hi Alan, You can pass in values via DbVisualizer variables. For instance, if your script (myscript.sql in this example) has a variable for the table name, like this: select * from ${mytable} you can give it a value by calling the command with the -sql option like this: ? -sql "@echo ${mytable||Test}$; @run myscript.sql" The @echo statement declares the variable and gives it a value, which is then used for the variable in the script. Best Regards, Hans
[This reply is migrated from our old forums. The original author name has been removed]

Re: Command Line Issue
To get it to work without setting the working directory to DBVisualizer I changed the "set DBVIS_HOME=." to set DBVIS_HOME="C:\PROGRAM FILES\DBVISUALIZER" and that works as well
[This reply is migrated from our old forums. The original author name has been removed]

Re: Command Line Issue
Isn't that the way it usually works.. just posted reply then realized I had a typo in the sql script file name. It ran except now is there a way to pass in parameters? I want to pass in a TABLE Name into the script.
[This reply is migrated from our old forums. The original author name has been removed]

Re: Command Line Issue
I did find something this morning. If I "CD C:\program files\dbvisualizer" then run it I no longer get the class error, however now it cannot find my script. R:\VanDocs\CPP Monoline Merge\1Tools>"c:\program files\dbvisualizer\dbviscmd.BAT " -connection "UG401" -sqlfile "SQL for Deletes One Time.sql" Exception in thread "main" java.lang.NoClassDefFoundError: com/onseven/dbvis/DbV isualizerCmd Caused by: java.lang.ClassNotFoundException: com.onseven.dbvis.DbVisualizerCmd at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) Could not find the main class: com.onseven.dbvis.DbVisualizerCmd. Program will exit. R:\VanDocs\CPP Monoline Merge\1Tools>c: C:\>cd program files C:\Program Files>cd dbvisualizer C:\Program Files\DbVisualizer>dbviscmd.BAT -connection "UG401" -sqlfile "R:\VanD ocs\CPP Monoline Merge\1Tools\SQL for Deletes One Time.sql" DbVisualizerCmd - ExecError: Reading the script: R:\VanDocs\CPP Monoline Merge\1 Tools\SQL for Deletes One Time.sql (The system cannot find the file specified) C:\Program Files\DbVisualizer>
[This reply is migrated from our old forums.]

Re: Command Line Issue
Alan, Thanks! This is really strange... The scripts used to launch both the GUI (dbvisgui.bat) and the CMD interface (dbviscmd.bat) are identical up to what class being invoked. May I ask you to enable trace also in the dbvisgui.bat file and run it? Best Regards Roger
[This reply is migrated from our old forums. The original author name has been removed]

Re: Command Line Issue
***Used #1 Windows (setup Installer)*** H:\>"C:\Program Files\DbVisualizer\dbviscmd.BAT" -connection "UG401" -sqlfile "S QL for Deletes One Time.sql" H:\>rem Script to launch the command line interface for DbVisualizer H:\>set DBVIS_HOME=. H:\>set JAVA_EXEC=java H:\>set CP=.\resources H:\>set CP=.\resources;.\lib\alloy.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar;.\ lib\jai-imageio.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar;.\ lib\jai-imageio.jar;.\lib\jcchart.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar;.\ lib\jai-imageio.jar;.\lib\jcchart.jar;.\lib\jdom.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar;.\ lib\jai-imageio.jar;.\lib\jcchart.jar;.\lib\jdom.jar;.\lib\jide.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar;.\ lib\jai-imageio.jar;.\lib\jcchart.jar;.\lib\jdom.jar;.\lib\jide.jar;.\lib\log4j. jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar;.\ lib\jai-imageio.jar;.\lib\jcchart.jar;.\lib\jdom.jar;.\lib\jide.jar;.\lib\log4j. jar;.\lib\nb-editor.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar;.\ lib\jai-imageio.jar;.\lib\jcchart.jar;.\lib\jdom.jar;.\lib\jide.jar;.\lib\log4j. jar;.\lib\nb-editor.jar;.\lib\ognl.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar;.\ lib\jai-imageio.jar;.\lib\jcchart.jar;.\lib\jdom.jar;.\lib\jide.jar;.\lib\log4j. jar;.\lib\nb-editor.jar;.\lib\ognl.jar;.\lib\openide-util.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar;.\ lib\jai-imageio.jar;.\lib\jcchart.jar;.\lib\jdom.jar;.\lib\jide.jar;.\lib\log4j. jar;.\lib\nb-editor.jar;.\lib\ognl.jar;.\lib\openide-util.jar;.\lib\poi.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar;.\ lib\jai-imageio.jar;.\lib\jcchart.jar;.\lib\jdom.jar;.\lib\jide.jar;.\lib\log4j. jar;.\lib\nb-editor.jar;.\lib\ognl.jar;.\lib\openide-util.jar;.\lib\poi.jar;.\li b\vectorgraphics.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar;.\ lib\jai-imageio.jar;.\lib\jcchart.jar;.\lib\jdom.jar;.\lib\jide.jar;.\lib\log4j. jar;.\lib\nb-editor.jar;.\lib\ognl.jar;.\lib\openide-util.jar;.\lib\poi.jar;.\li b\vectorgraphics.jar;.\lib\yexport.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar;.\ lib\jai-imageio.jar;.\lib\jcchart.jar;.\lib\jdom.jar;.\lib\jide.jar;.\lib\log4j. jar;.\lib\nb-editor.jar;.\lib\ognl.jar;.\lib\openide-util.jar;.\lib\poi.jar;.\li b\vectorgraphics.jar;.\lib\yexport.jar;.\lib\yFiles.jar H:\>set CP=.\resources;.\lib\alloy.jar;.\lib\AppleJavaExtensions.jar;.\lib\batik .jar;.\lib\commons-lang.jar;.\lib\dbvis.jar;.\lib\forms.jar;.\lib\graphml.jar;.\ lib\jai-imageio.jar;.\lib\jcchart.jar;.\lib\jdom.jar;.\lib\jide.jar;.\lib\log4j. jar;.\lib\nb-editor.jar;.\lib\ognl.jar;.\lib\openide-util.jar;.\lib\poi.jar;.\li b\vectorgraphics.jar;.\lib\yexport.jar;.\lib\yFiles.jar;.\lib\ysvg.jar H:\>java -Xmx768M -Djava.awt.headless=true -cp .\resources;.\lib\alloy.jar;.\lib \AppleJavaExtensions.jar;.\lib\batik.jar;.\lib\commons-lang.jar;.\lib\dbvis.jar; .\lib\forms.jar;.\lib\graphml.jar;.\lib\jai-imageio.jar;.\lib\jcchart.jar;.\lib\ jdom.jar;.\lib\jide.jar;.\lib\log4j.jar;.\lib\nb-editor.jar;.\lib\ognl.jar;.\lib \openide-util.jar;.\lib\poi.jar;.\lib\vectorgraphics.jar;.\lib\yexport.jar;.\lib \yFiles.jar;.\lib\ysvg.jar -Ddbvis.home=. com.onseven.dbvis.DbVisualizerCmd -con nection "UG401" -sqlfile "SQL for Deletes One Time.sql" Exception in thread "main" java.lang.NoClassDefFoundError: com/onseven/dbvis/DbV isualizerCmd Caused by: java.lang.ClassNotFoundException: com.onseven.dbvis.DbVisualizerCmd at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) Could not find the main class: com.onseven.dbvis.DbVisualizerCmd. Program will exit. H:\>
[This reply is migrated from our old forums.]

Re: Command Line Issue
Alan, Which installation package did you install? 1) Windows (setup installer) 2) Windows x64 (setup installer) 3) Windows (zip archive) Did the installer include Java? Try modify the dbviscmd.bat file and change: @echo off to: @echo on Post or email the complete output when you then run dbviscmd.bat Regards Roger support@dbvis.com
[This reply is migrated from our old forums. The original author name has been removed]

Re: Command Line Issue
I am on DBV 7.02 Nothing new, changed or removed from the DBV installation directory dbvgui.bat runs fine.
[This reply is migrated from our old forums.]

Re: Command Line Issue
Alan, Thanks for your post. What DbVisualizer version are you using? Is the installation directory intact as it looked when DbVIsualizer was installed i.e. I assume you haven't moved any files in there? What happen if you run: dbvisgui.bat Best Regards Roger
[This reply is migrated from our old forums. The original author name has been removed]

Re: Command Line Issue
I am not getting the following error: H:\>"C:\Program Files\DbVisualizer\dbviscmd.BAT" -connection "UG401" -sqlfile "S QL for Deletes One Time.sql" Exception in thread "main" java.lang.NoClassDefFoundError: com/onseven/dbvis/DbV isualizerCmd Caused by: java.lang.ClassNotFoundException: com.onseven.dbvis.DbVisualizerCmd at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) Could not find the main class: com.onseven.dbvis.DbVisualizerCmd. Program will exit. H:\>
[This reply is migrated from our old forums.]

Re: Command Line Issue
Hi Alan, DbVisualizer 7.0 introduced a new command line interface for DbVisualizer: dbviscmd. At the same time, all options for the GUI related to script execution (e.g. -execute and -invisible) were dropped. Please see the Users Guide for how to use the command line interface: [http://www.dbvis.com/products/dbvis/doc/main/doc/ug/gettingStarted/gettingStarted.html#mozTocId246198] (NOTE! Due to a formatting bug with the forum software, the URL above may contain "%20" character sequences that should not be there. Please remove them from the URL manually. We are aware of this problem and will upgrade the forum software). Best Regards, Hans --- Hans Bergsten DbVisualizer Team DbVis Software AB