Issue with sql task accessing MySql

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with sql task accessing MySql

Eric Fetzer-2
The MySql server I'm accessing upgraded to version 8.0.17:

 mysql> select version();+-----------+| version() |+-----------+| 8.0.17    |+-----------+1 row in set (0.00 sec)


So, accordingly, I downloaded the proper driver and linked to it in my task:
        <sql driver="com.mysql.jdbc.Driver"          url="jdbc:mysql://myServerName.myDomain:3306/myDB"          userid="myUser" password="myPassword">          <classpath>            <pathelement path="c:/apache-ant-1.7.0/lib/mysql-connector-java-8.0.17.jar"/>          </classpath>          CALL sp_setBuildStatus('${pk_build}','${full.buildnumber}-${build-time}','${result}');        </sql>
Seems I did the right thing, but still getting the error when I attempt to call this Stored Procedure:

$ ant -f test.xmlBuildfile: test.xml
main:
BUILD FAILEDc:\BuildDeployScripts\test.xml:22: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Client does not support authentication protocol requested by server; consider upgrading MySQL client
Total time: 1 second

Anyone have any idea what I'm running into here?
Thanks,Eric
Reply | Threaded
Open this post in threaded view
|

Re: Issue with sql task accessing MySql

Stefan Bodewig
On 2019-08-28, Eric Fetzer wrote:

> The MySql server I'm accessing upgraded to version 8.0.17:

> So, accordingly, I downloaded the proper driver and linked to it in my task:

> <pathelement path="c:/apache-ant-1.7.0/lib/mysql-connector-java-8.0.17.jar"/>

> BUILD FAILEDc:\BuildDeployScripts\test.xml:22: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Client does not support authentication protocol requested by server; consider upgrading MySQL client

Anything in c:/apache-ant-1.7.0/lib is probably on your CLASSPATH
anyway. Is it possible there is an older version of the mysql connector
inside of that folder as well? If so, remove it.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Issue with sql task accessing MySql

Eric Fetzer-2
 Thanks Stefan, a bit better:
$ ant -f test.xmlBuildfile: test.xml
main:
BUILD FAILEDc:\BuildDeployScripts\test.xml:22: java.lang.UnsupportedClassVersionError: (com/mysql/jdbc/Driver) bad major version at offset=6
Total time: 0 seconds

    On Wednesday, August 28, 2019, 10:49:54 AM MDT, Stefan Bodewig <[hidden email]> wrote:  
 
 On 2019-08-28, Eric Fetzer wrote:

> The MySql server I'm accessing upgraded to version 8.0.17:

> So, accordingly, I downloaded the proper driver and linked to it in my task:

> <pathelement path="c:/apache-ant-1.7.0/lib/mysql-connector-java-8.0.17.jar"/>

> BUILD FAILEDc:\BuildDeployScripts\test.xml:22: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Client does not support authentication protocol requested by server; consider upgrading MySQL client

Anything in c:/apache-ant-1.7.0/lib is probably on your CLASSPATH
anyway. Is it possible there is an older version of the mysql connector
inside of that folder as well? If so, remove it.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

 
Reply | Threaded
Open this post in threaded view
|

Re: Issue with sql task accessing MySql

Stefan Bodewig
On 2019-08-28, Eric Fetzer wrote:

>  Thanks Stefan, a bit better:
> $ ant -f test.xmlBuildfile: test.xml
> main:
> BUILD FAILEDc:\BuildDeployScripts\test.xml:22: java.lang.UnsupportedClassVersionError: (com/mysql/jdbc/Driver) bad major version at offset=6
> Total time: 0 seconds

You are running a version of Java that cannot use the new driver as it
has been compiled for a newer version.

Unless the driver provides a version for an older version of Java
(unlikely but not completely impossible) there is no other options than
updrading the version of Java you use.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Issue with sql task accessing MySql

Eric Fetzer-2
 Is there a way to set that version JUST for this call?  We're building a legacy application here that CANNOT upgrade to a newer version of Java...  Thanks!
    On Wednesday, August 28, 2019, 12:28:55 PM MDT, Stefan Bodewig <[hidden email]> wrote:  
 
 On 2019-08-28, Eric Fetzer wrote:

>  Thanks Stefan, a bit better:
> $ ant -f test.xmlBuildfile: test.xml
> main:
> BUILD FAILEDc:\BuildDeployScripts\test.xml:22: java.lang.UnsupportedClassVersionError: (com/mysql/jdbc/Driver) bad major version at offset=6
> Total time: 0 seconds

You are running a version of Java that cannot use the new driver as it
has been compiled for a newer version.

Unless the driver provides a version for an older version of Java
(unlikely but not completely impossible) there is no other options than
updrading the version of Java you use.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

 
Reply | Threaded
Open this post in threaded view
|

Re: Issue with sql task accessing MySql

Eric Fetzer-2
 Also, any clue what version of Java do I need to use with this?  1.8?
    On Wednesday, August 28, 2019, 12:57:34 PM MDT, Eric Fetzer <[hidden email]> wrote:  
 
  Is there a way to set that version JUST for this call?  We're building a legacy application here that CANNOT upgrade to a newer version of Java...  Thanks!
    On Wednesday, August 28, 2019, 12:28:55 PM MDT, Stefan Bodewig <[hidden email]> wrote: 
 
 On 2019-08-28, Eric Fetzer wrote:

>  Thanks Stefan, a bit better:
> $ ant -f test.xmlBuildfile: test.xml
> main:
> BUILD FAILEDc:\BuildDeployScripts\test.xml:22: java.lang.UnsupportedClassVersionError: (com/mysql/jdbc/Driver) bad major version at offset=6
> Total time: 0 seconds

You are running a version of Java that cannot use the new driver as it
has been compiled for a newer version.

Unless the driver provides a version for an older version of Java
(unlikely but not completely impossible) there is no other options than
updrading the version of Java you use.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

   
Reply | Threaded
Open this post in threaded view
|

Re: Issue with sql task accessing MySql

Stefan Bodewig
In reply to this post by Eric Fetzer-2
On 2019-08-28, Eric Fetzer wrote:

>  Is there a way to set that version JUST for this call?

I'm afraid there is no way to run the <sql> task in a different JVM than
the rest of Ant.

Judging from
https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-versions.html
your MySQL Connector requires Java8 as a minimum.

But then again the same page also claims the Connector version 5.1 -
which only requires Java 5 - would work with the latest MySQL server
(except for using certain ciphers in TLS).

By no means am I a MySQL expert.

>    We're building a legacy application here that CANNOT upgrade to a
>  newer version of Java...

Understood.

You could try to move the sql part to a different build file and only
run that in a different JVM (via <exec>, <ant> will not fork a new
VM). Or you could try to build with Java8 and tell all your <javac>
tasks to use the compiler of Java7.

In either case this sounds like quite a bit of work. I'm sorry I haven't
got any better news. Maybe anybody with more MySQL experience than I has
has more ideas.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Issue with sql task accessing MySql

Eric Fetzer-2
 Thanks Stefan!  Took the easy path and outsourced the update to a simple bash script that ssh's to the MySql Server and runs the SProc there.  Thanks for all your help!
    On Wednesday, August 28, 2019, 04:02:17 PM EDT, Stefan Bodewig <[hidden email]> wrote:  
 
 On 2019-08-28, Eric Fetzer wrote:

>  Is there a way to set that version JUST for this call?

I'm afraid there is no way to run the <sql> task in a different JVM than
the rest of Ant.

Judging from
https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-versions.html
your MySQL Connector requires Java8 as a minimum.

But then again the same page also claims the Connector version 5.1 -
which only requires Java 5 - would work with the latest MySQL server
(except for using certain ciphers in TLS).

By no means am I a MySQL expert.

>    We're building a legacy application here that CANNOT upgrade to a
>  newer version of Java...

Understood.

You could try to move the sql part to a different build file and only
run that in a different JVM (via <exec>, <ant> will not fork a new
VM). Or you could try to build with Java8 and tell all your <javac>
tasks to use the compiler of Java7.

In either case this sounds like quite a bit of work. I'm sorry I haven't
got any better news. Maybe anybody with more MySQL experience than I has
has more ideas.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
 
Reply | Threaded
Open this post in threaded view
|

Re: Issue with sql task accessing MySql

Eric Fetzer-2
 Just to get the solution documented this thread, here's what I did.  This is a winders 7 machine running ant in cygwin.  The ant call:

        <exec executable="c:\cygwin\bin\bash.exe">          <arg value="update_build_table.sh"/>          <arg value="${pk_build}"/>          <arg value="${full.buildnumber}-${build-time}"/>          <arg value="${result}"/>        </exec>
The bash script:

#!/usr/bin/bash#

ssh myUser@myMachine "mysql -u mySqlUser -pmySqlPassword mySqlDB -e \"CALL sp_setBuildStatus('$1','$2','$3')\""if [ $? -eq 0 ]then     echo "The build table has been updated with the status $3"else     echo "Build table was not updated"     exit 1fi

Of course passwordless ssh needs to be established from build machine to mySql machine...    On Thursday, August 29, 2019, 09:48:01 AM EDT, Eric Fetzer <[hidden email]> wrote:  
 
  Thanks Stefan!  Took the easy path and outsourced the update to a simple bash script that ssh's to the MySql Server and runs the SProc there.  Thanks for all your help!
    On Wednesday, August 28, 2019, 04:02:17 PM EDT, Stefan Bodewig <[hidden email]> wrote: 
 
 On 2019-08-28, Eric Fetzer wrote:

>  Is there a way to set that version JUST for this call?

I'm afraid there is no way to run the <sql> task in a different JVM than
the rest of Ant.

Judging from
https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-versions.html
your MySQL Connector requires Java8 as a minimum.

But then again the same page also claims the Connector version 5.1 -
which only requires Java 5 - would work with the latest MySQL server
(except for using certain ciphers in TLS).

By no means am I a MySQL expert.

>    We're building a legacy application here that CANNOT upgrade to a
>  newer version of Java...

Understood.

You could try to move the sql part to a different build file and only
run that in a different JVM (via <exec>, <ant> will not fork a new
VM). Or you could try to build with Java8 and tell all your <javac>
tasks to use the compiler of Java7.

In either case this sounds like quite a bit of work. I'm sorry I haven't
got any better news. Maybe anybody with more MySQL experience than I has
has more ideas.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
   
Reply | Threaded
Open this post in threaded view
|

AW: Issue with sql task accessing MySql

Jan Matèrne (jhm)
Just for beautifying the log: you could specify a 'taskname'
  <exec taskname="update-db-tables" .../>

So you get a
  [update-db-tables] ...
instead of
  [exec] ...


Jan


> -----Ursprüngliche Nachricht-----
> Von: Eric Fetzer [mailto:[hidden email]]
> Gesendet: Donnerstag, 29. August 2019 16:04
> An: [hidden email]
> Betreff: Re: Issue with sql task accessing MySql
>
>  Just to get the solution documented this thread, here's what I did.
> This is a winders 7 machine running ant in cygwin.  The ant call:
>
>         <exec executable="c:\cygwin\bin\bash.exe">          <arg
> value="update_build_table.sh"/>          <arg value="${pk_build}"/>
>     <arg value="${full.buildnumber}-${build-time}"/>          <arg
> value="${result}"/>        </exec> The bash script:
>
> #!/usr/bin/bash#
>
> ssh myUser@myMachine "mysql -u mySqlUser -pmySqlPassword mySqlDB -e
> \"CALL sp_setBuildStatus('$1','$2','$3')\""if [ $? -eq 0 ]then     echo
> "The build table has been updated with the status $3"else     echo
> "Build table was not updated"     exit 1fi
>
> Of course passwordless ssh needs to be established from build machine to
> mySql machine...    On Thursday, August 29, 2019, 09:48:01 AM EDT, Eric
> Fetzer <[hidden email]> wrote:
>
>   Thanks Stefan!  Took the easy path and outsourced the update to a
> simple bash script that ssh's to the MySql Server and runs the SProc
> there.  Thanks for all your help!
>     On Wednesday, August 28, 2019, 04:02:17 PM EDT, Stefan Bodewig
> <[hidden email]> wrote:
>
>  On 2019-08-28, Eric Fetzer wrote:
>
> >  Is there a way to set that version JUST for this call?
>
> I'm afraid there is no way to run the <sql> task in a different JVM than
> the rest of Ant.
>
> Judging from
> https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-versions.html
> your MySQL Connector requires Java8 as a minimum.
>
> But then again the same page also claims the Connector version 5.1 -
> which only requires Java 5 - would work with the latest MySQL server
> (except for using certain ciphers in TLS).
>
> By no means am I a MySQL expert.
>
> >    We're building a legacy application here that CANNOT upgrade to a
> >  newer version of Java...
>
> Understood.
>
> You could try to move the sql part to a different build file and only
> run that in a different JVM (via <exec>, <ant> will not fork a new VM).
> Or you could try to build with Java8 and tell all your <javac> tasks to
> use the compiler of Java7.
>
> In either case this sounds like quite a bit of work. I'm sorry I haven't
> got any better news. Maybe anybody with more MySQL experience than I has
> has more ideas.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email] For additional
> commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]