You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Joe Baldwin <jf...@earthlink.net> on 2015/08/07 09:40:30 UTC

DataSourceInfo

Problem: I am having problems with MySQL connections being disabled improperly on the production server (the development server does not show the same error).  This happens only after an idle period (and only on the production server).

java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
	com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3143)

My theory is that there is some problem with the JDBC connector(s).  So I am trying to track down two separate issues
	1. my development MySQL DBMS version is 5.6 while the production version is 5.5 (this may be the problem)
	2. my webhost gives me only incremental access to tomcat, so I am attempting to verify the JDBC connector (I installed per their directions - webhost imposed).

It is #2 that is what I want to start with, but it is difficult to verify.  I used to be able to accomplish #2 with Cayenne DataSourceInfo.  However, 

	getJdbcDriver() now returns null
	getUserName() now returns null
and
	getMaxConnections() now returns the wrong number

This used to work a few versions back - so this is confusing. So,  I cannot tell at this point whether the DataSourceInfo is incorrect, or whether the dbcp.properties file (I am using DHCP) is not being read correctly, or some other problem.

So, I believe my first step is to get DataSourceInfo working again so that I can verify the correct JDBC driver is being used (there are two - as I said).

Question:
1. is DataSourceInfo still a reliable way to get JDBC info?
2. if so, could you please show me a few lines of example code (because my code is failing) ? 

Thanks
Joe




Re: DataSourceInfo

Posted by Andrus Adamchik <an...@objectstyle.org>.
> On Aug 8, 2015, at 5:49 PM, Joe Baldwin <jf...@earthlink.net> wrote:
> 
> OK, let me ask again:
> 
>>> 1. is DataSourceInfo still a reliable way to get JDBC info?
> 
> is DataSourceInfo broken? 

No, it is not broken. DataSourceInfo is just a class that holds some information with no behavior of its own. So how do you initialize it?

But anyways, I am with John on this. From the info that you gave us, this is a simple timeout that happens with MySQL connections. So use DBCP validationQuery and you should be good.

Andrus

Re: DataSourceInfo

Posted by Joe Baldwin <jf...@earthlink.net>.
OK, let me ask again:

>> 1. is DataSourceInfo still a reliable way to get JDBC info?

is DataSourceInfo broken?  The JDBC info is returning nulls.

Re: DataSourceInfo

Posted by Joe Baldwin <jf...@earthlink.net>.

I am using DHCP (and have been for years).  This only started happening when I had my webhost upgrade to Tomcat 8 (and I converted to Cayenne 4).   The connection mismanagement DOES NOT happen on my development server.

This is why I am starting with verifying the JDBC version via Cayenne.  However, (as I said) DataSiourceInfo returns nulls.




> On Aug 7, 2015, at 10:30 AM, John Huss <jo...@gmail.com> wrote:
> 
> I think this is a "feature" of MySQL.  It closes idle connections
> eventually.  You can add a validationQuery to keep the connection active.
> 
> On Fri, Aug 7, 2015 at 2:40 AM Joe Baldwin <jf...@earthlink.net> wrote:
> 
>> Problem: I am having problems with MySQL connections being disabled
>> improperly on the production server (the development server does not show
>> the same error).  This happens only after an idle period (and only on the
>> production server).
>> 
>> java.io.EOFException: Can not read response from server. Expected to read
>> 4 bytes, read 0 bytes before connection was unexpectedly lost.
>>        com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3143)
>> 
>> My theory is that there is some problem with the JDBC connector(s).  So I
>> am trying to track down two separate issues
>>        1. my development MySQL DBMS version is 5.6 while the production
>> version is 5.5 (this may be the problem)
>>        2. my webhost gives me only incremental access to tomcat, so I am
>> attempting to verify the JDBC connector (I installed per their directions -
>> webhost imposed).
>> 
>> It is #2 that is what I want to start with, but it is difficult to
>> verify.  I used to be able to accomplish #2 with Cayenne DataSourceInfo.
>> However,
>> 
>>        getJdbcDriver() now returns null
>>        getUserName() now returns null
>> and
>>        getMaxConnections() now returns the wrong number
>> 
>> This used to work a few versions back - so this is confusing. So,  I
>> cannot tell at this point whether the DataSourceInfo is incorrect, or
>> whether the dbcp.properties file (I am using DHCP) is not being read
>> correctly, or some other problem.
>> 
>> So, I believe my first step is to get DataSourceInfo working again so that
>> I can verify the correct JDBC driver is being used (there are two - as I
>> said).
>> 
>> Question:
>> 1. is DataSourceInfo still a reliable way to get JDBC info?
>> 2. if so, could you please show me a few lines of example code (because my
>> code is failing) ?
>> 
>> Thanks
>> Joe
>> 
>> 
>> 
>> 


Re: DataSourceInfo

Posted by John Huss <jo...@gmail.com>.
I think this is a "feature" of MySQL.  It closes idle connections
eventually.  You can add a validationQuery to keep the connection active.

On Fri, Aug 7, 2015 at 2:40 AM Joe Baldwin <jf...@earthlink.net> wrote:

> Problem: I am having problems with MySQL connections being disabled
> improperly on the production server (the development server does not show
> the same error).  This happens only after an idle period (and only on the
> production server).
>
> java.io.EOFException: Can not read response from server. Expected to read
> 4 bytes, read 0 bytes before connection was unexpectedly lost.
>         com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3143)
>
> My theory is that there is some problem with the JDBC connector(s).  So I
> am trying to track down two separate issues
>         1. my development MySQL DBMS version is 5.6 while the production
> version is 5.5 (this may be the problem)
>         2. my webhost gives me only incremental access to tomcat, so I am
> attempting to verify the JDBC connector (I installed per their directions -
> webhost imposed).
>
> It is #2 that is what I want to start with, but it is difficult to
> verify.  I used to be able to accomplish #2 with Cayenne DataSourceInfo.
> However,
>
>         getJdbcDriver() now returns null
>         getUserName() now returns null
> and
>         getMaxConnections() now returns the wrong number
>
> This used to work a few versions back - so this is confusing. So,  I
> cannot tell at this point whether the DataSourceInfo is incorrect, or
> whether the dbcp.properties file (I am using DHCP) is not being read
> correctly, or some other problem.
>
> So, I believe my first step is to get DataSourceInfo working again so that
> I can verify the correct JDBC driver is being used (there are two - as I
> said).
>
> Question:
> 1. is DataSourceInfo still a reliable way to get JDBC info?
> 2. if so, could you please show me a few lines of example code (because my
> code is failing) ?
>
> Thanks
> Joe
>
>
>
>