From: Lew on
Joel Ross wrote:
>>> JDBC Driver: mysql-connector-java-2.0.14-bin.jar
>>> JAVA: j2sdk1.4.2_10

markspace wrote:
>> These two are very old. Can you upgrade? Java in on version 6 now, 4
>> is no longer supported, and 5 is past EOL for free (unpaid) customers.
>> A 2.0 Connector appears to be ancient. 5 is the current version, 3 is
>> the earliest still available on MySQL's website.

jross wrote:
> Unfortunately these two version are what we are using I have tried
> mysql-connector 3 and I still have the same issues. We are looking into
> updating java in the future but at the moment it's too much work because
> of all the new changes.

They aren't that new. Nearly six years in dog years is over four decades in
human years. And there aren't that many changes: get rid of "enum" in your
code and hope you aren't using the commons-lang version of that, and voilĂ .

That said, I also was just on a project that still uses 1.4. To their credit,
they're finally now upgrading (gradually) to the (also now obsolescent) Java 5.

The actual conversion took about a week for roughly a million lines of code.
Upgrading from Rational Application Developer 6 to version 7 took them another
two months.

--
Lew
From: markspace on
Joel Ross wrote:
> markspace wrote:
>> jross wrote:
>>
>>> JDBC Driver: mysql-connector-java-2.0.14-bin.jar
>>> JAVA: j2sdk1.4.2_10
>>
>>
>> These two are very old. Can you upgrade? Java in on version 6 now, 4
>> is no longer supported, and 5 is past EOL for free (unpaid) customers.
>> A 2.0 Connector appears to be ancient. 5 is the current version, 3 is
>> the earliest still available on MySQL's website.
>>
>
> Unfortunately these two version are what we are using I have tried
> mysql-connector 3 and I still have the same issues. We are looking into
> updating java in the future but at the moment it's too much work because
> of all the new changes.


OK, fair enough. I don't have either of those versions on my system
here, so any testing I do of your program is going to use a different
runtime and a different Connect/J. If I find no issues... well, it
won't mean that much for you, will it.

Other idea: what version of MySQL are you connecting to?

OK, I notice a couple of things. One, when I first tried your program,
I was surprised that it ran, because I didn't add my own password and
user name yet. Then I noticed that you're printing only the
getMessage() of the exception, which is easy to miss, and rarely set to
anything useful. Please modify your Java program to print the entire
exception and stack trace. I made those changes below, I think you
could be missing an error trace from the Java program, just like I did.

Also, what happens if you don't run the Perl program, just the Java? If
it's Perl that causes the problem, I'd guess that the problem is in
Perl, not Java. Please try to get the Java program to fail by itself.

Test program with better error reporting below:


package mysqltest;

import java.sql.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintWriter;

class test
{

Connection conn;

public static void main( String[] args ) throws Exception
{

new test();
}

public test() throws Exception
{
PrintWriter result = null;
// File logFile = new File( "/tmp/socket/debug.log" );
result =
// new PrintWriter( new FileOutputStream(
//logFile.getName() ) );
new PrintWriter( System.out );
DriverManager.setLogWriter( result );
Class.forName( "com.mysql.jdbc.Driver" ).newInstance();
String url =

"jdbc:mysql://127.0.0.1/pos?autoReconnect=true&socketTimeout=120";
conn = DriverManager.getConnection( url, "user", "passwd" );

doSelectTest();
conn.close();

}

private void doSelectTest() throws Exception
{
System.out.println( "[OUTPUT FROM SELECT]" );
String query = "SELECT * FROM Table;";
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery( query );
while( rs.next() )
{
String s = rs.getString( "column" );
System.out.println( s );
}
}
}


From: jross on
markspace wrote:
>
> Other idea: what version of MySQL are you connecting to?
>

I'm using an old version of MySQL 4.0 ( Where living in the past =) )

> Also, what happens if you don't run the Perl program, just the Java? If
> it's Perl that causes the problem, I'd guess that the problem is in
> Perl, not Java. Please try to get the Java program to fail by itself.
>

The java app runs fine without perl. I might write a script in a
different language other then perl and see what it does, it could be perl

From: jross on
Roedy Green wrote:

> It is possibly all that is happening is you have MySQL so busy it
> can't attend to Java's request.

I have increased the MAX Connection variable in MySQL and it made no
difference

> Why do you need to run the Perl script so often?

I don't need to run it that often it normally happens over 24/48 hour
period. I'm just running it that many times for testing purpose because
it cause the same error to occur.

Cheers
From: jross on
jross wrote:

> The java app runs fine without perl. I might write a script in a
> different language other then perl and see what it does, it could be perl
>

Running this command also caused the same error.

while [ 0=0 ];do nc -vvvz 127.0.0.1 3306;done

First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4
Prev: Hashcode and Equal
Next: Exception Handling