File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Problem of my java code with mysql database.Thanks~ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem of my java code with mysql database.Thanks~" Watch "Problem of my java code with mysql database.Thanks~" New topic

Problem of my java code with mysql database.Thanks~

Jerry Du

Joined: Feb 27, 2003
Posts: 2
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.
Bhushan Jawle
Ranch Hand

Joined: Nov 22, 2001
Posts: 249
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.
chanoch wiggers
Ranch Hand

Joined: May 24, 2001
Posts: 245
its is very unlikely to be yuor linux or mysql - can we see the code you are using please?

chanoch<p><a href="" target="_blank" rel="nofollow">Author of Professional Apache Tomcat</a></p>
I agree. Here's the link:
subject: Problem of my java code with mysql database.Thanks~
It's not a secret anymore!