Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: markspace Newsgroups: comp.lang.java.programmer Subject: Re: Bash script not working as commandline MySQL JDBC Date: Sun, 17 Nov 2013 08:56:03 -0800 Organization: A noiseless patient Spider Lines: 30 Message-ID: References: <7f1a4290-6ce6-4673-a411-62dbb326ef99@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 17 Nov 2013 16:56:06 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="9358cda03e1e0dfd3c4b757daa608707"; logging-data="9879"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qWBXHkeMa1ZEkYDxrTa4ln5bH20KObYs=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 In-Reply-To: <7f1a4290-6ce6-4673-a411-62dbb326ef99@googlegroups.com> Cancel-Lock: sha1:x5H83P09xtsbYKQyUSqzrV4pM6s= Xref: csiph.com comp.lang.java.programmer:26526 On 11/17/2013 8:40 AM, RVic wrote: > I'm quite at a loss here.I'm using JDBC to connect to a MySQL > database. If I type the command in from the command line (passing it > the parameters for db name and user / password) it runs fine: > > exec java -classpath > .:$CLASSPATH:/home/user/ggrip/upserver/mysql-connector-java-5.1.26-bin.jar:/home/user/ggrip/upserver/GGUser.jar > GG.GGServer "127.0.0.1:3306" ggripserver1 ggripv2 root root > > However, if I create a bash file of the identical command and execute > it, I'm getting: user@Mint15-32 ~/ggrip/upserver $ echo $SHELL > /bin/bash user@Mint15-32 ~/ggrip/upserver $ ./ggrip.sh > java.sql.SQLException: Access denied for user 'root'@'localhost' > (using password: YES)Error creating connection pool! > java.sql.SQLException: Can't connect with: com.mysql.jdbc.Driver to > jdbc:mysql://127.0.0.1:3306/ggripv2 root root > > I just don't get it? > My guesses are 1) you have a typo, since you didn't show us the actual script, or 2) you there's a shell or variable expansion that's tripping you up. Look up bash shell debugging, try a few things there, and let us know when you've found a few things more. Make sure the command is executing exactly as you expect, not some close but different facsimile.