Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException:insufficient data while reading from network error while creating DB ineclipse

 
vikas gunti
Greenhorn
Posts: 19
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.sql.SQLException:insufficient data while reading from network expected min of 6 bytes but received only 0 bytes

<p> I want to create a database with in eclipse using tomcat server 7.0 and derby client.jar , I configured Tomcat server to 1527 port and trying to create a database on the same port over server , but it is showing the above mentioned error while testing the connection help me to solve this problem and I am attaching the screen shots of eclipse . </p>
<p> Thanks in advance </p>

2.JPG
[Thumbnail for 2.JPG]
3.JPG
[Thumbnail for 3.JPG]
4.JPG
[Thumbnail for 4.JPG]
 
Claude Moore
Ranch Hand
Posts: 829
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I understand from your screenshot, you are trying to bind on port 1527 both Tomcat (at least for http requests) and Derby server on same address. A TCP endpoint (address + port) must be uniquely specified. Try to start http service on a different port, for example; or change Derby listening port to another one.
 
vikas gunti
Greenhorn
Posts: 19
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1521 with message Connection refused: connect.

Dear Claude Moore,
Thank you for your response.
I tried to create database on the different port 1521 as my tomcat server is running on 1527 it is showing above error ,as far as I know we have to create the database on the same port on which server is running , because when we create a oracle sql database the oracle server runs on the port 1521 and it opens and it accepts the connection , and in net beans when we create a derby database using tomcat server the tomcat server is running on the port 1527 and so it accepts connection on that port . I am trying to create a database inside eclipse, with the reference of this document " http://www.eclipse.org/articles/article.php?file=Article-EclipseDbWebapps/index.html".
 
Claude Moore
Ranch Hand
Posts: 829
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I gave a quick read to documentation at the web page you provided.... we have to distinguish between:

- Tomcat Http server listener --> which address:port you bound it to ?
- Derby server listener --> which address:port you bound it to ?
- JDBC Datasource --> Connection url you provide must match address:port Derby is listening on.

So for example you may configurate Tomcat to accept Http request on port 8080, you may leave Derby server listening on default port (1521 ?) and remember in your datasource to use 1521 as target port for derby connections, no matter on which port Tomcat is working on.
 
vikas gunti
Greenhorn
Posts: 19
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
moore,
I done it in the same way as you said in your last post...
tomcat is bound to port 1527;
derby is bound to 1521;
and my connection url is :jdbc:derby://localhost:1521/sample;create=true
still giving the same

error.java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1521 with message Connection refused: connect.
 
Claude Moore
Ranch Hand
Posts: 829
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you start Derby database? I am not an expert on Derby, but error you reported clearly states that there is nothing listening on port 1521. A simple, but usually effective way to check this, is to execute a telnet to the (supposed) listening program. In your case, issue a telnet localhost 1521 and press enter. What happens? If anything is listening, you should get an answer from the service. Kind of answer may vary (from getting your dos command window blanked to some unreadable characters).
 
vikas gunti
Greenhorn
Posts: 19
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi moore ,

actually what happens here is if use port number 1527 , when tomcat is running on 1527, it is accepting connections and giving the insufficient data received error, if we put the different port number like tomcat on 1527 and derby on 1521, as 1521 was not listening it is refusing connections, the only thing we can do is we have to run the derby database also on the port 1527 , and there is no thing like starting of derby database, we have to start the server and have to crate a DB on that server .I already checked the telnet command , and I checked which are open on my system using "netstat -an" command and attaching the screen shots for reference. I google for the insufficient data received on network error , but I did't find any thing, it is still unresolved bug in tomcat .Reference link https://issues.apache.org/jira/browse/DERBY-5411
6.JPG
[Thumbnail for 6.JPG]
when using telnet command
7.JPG
[Thumbnail for 7.JPG]
when using netstat -an command
 
Dave Tolls
Ranch Hand
Posts: 2110
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"there is no thing like starting of derby database"

So where is the Derby database then?

How is it started up?
 
vikas gunti
Greenhorn
Posts: 19
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi tolls,
I am trying to create a database in a manner which is described in the following document

http://www.eclipse.org/articles/article.php?file=Article-EclipseDbWebapps/index.html check this once and give me some solution
 
Dave Tolls
Ranch Hand
Posts: 2110
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No where in that does it say (as far as I can see) to configure the Tomcat server to port 1527.
It's only the Derby DB that should sit on that port.

Did you manage to set up the derby server and test it, forgetting about the Tomcat instance entirely?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic