• 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

Problem of my java code with mysql database.Thanks~

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks in a million times for your kind help. i am really exhausted by this problem
And this is a simple java code running on linux and i just try to connect it with mysql database.
when i insert a new record, it is ok and i can find the new row in the right table in the database.
but when i write like this "select id from employees" or rs.getString("id"); then the error says that no column name like "id" exists or he cannot find "name". but in mysql database, the exactly same column name does exist.
so i try to use index instead of column name, like rs.getString(1). when running this code i can only see some empty rows as result. Looks like
i can only input(or insert) but cannot output the data.
Anything wrong with my linux OS or mysql or whatever?
i really appreciatee ur help.
thx
 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This may or may not be cause for your problem, but as a general practise, try not to use column names like 'id', 'name' for database columns, you might get some weird results (with commercial products as well)
But if that is the problem here try using a "select * from employees" and then get rs.getString(1) and check out if that solves your problem.
 
Author
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
its is very unlikely to be yuor linux or mysql - can we see the code you are using please?
 
If you were a tree, what sort of tree would you be? This tiny ad is a poop beast.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic