• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Telnet Disconnecting from Client app when executing query.

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm doing a project in NetBeans using the persistence API and a MySQL Database. I have already created a persistence unit with the proper connection information and an entity class for the table I am doing.

My main program is a server and I can request to add, remove, modify, or list the items in that table. I have no problem entering adding or removing data, but the problem is when I request "list" through telnet. The thread starts and executes this piece of code

<blockquote>code:
<pre name="code" class="core">
private void printUsers(PrintWriter p)
{
EntityManagerFactory emf = Persistence.createEntityManagerFactory("User_Database_TesterPU");
EntityManager em = emf.createEntityManager();

Query q = em.createQuery("SELECT p FROM users p");
List<Users> users = q.getResultList();

for(Users u : users)
{
p.println(u.toString());
p.flush();
}
}
</pre>
</blockquote>

There are 1000 elements in that table, but before it finishes printing, I get a "Connection to host lost".

Is this a problem with telnet or a problem with the way I'm using sockets and printwriter.

Also on a side note, why do I not see my input(on telnet) when connected to this application?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic