Trying to get a compiled test program to work but i get this in the output pane... com.mysql.jdbc.Driver Press any key to continue.
I think that means my driver is not setup right. I can access the database in the mysql Command Line Cleint all right. this is under system props\Environment Variables at the bottem (WinXP) System Variables... under Variable is this... database under Value is this... .;C\mysql\mysql-connector-java-3.1.11-bin.jar
I think you are reading a little much into the output. It says press any key to continue. Is there any mention of an error?
rob armstrong
Ranch Hand
Joined: Jul 25, 2005
Posts: 77
posted
0
OK I see what you are saying but than it doesn't do anything. Does my values look right? Could it be the url, user or password? roba
Maximilian Xavier Stocker
Ranch Hand
Joined: Sep 20, 2005
Posts: 381
posted
0
Originally posted by rob armstrong: OK I see what you are saying but than it doesn't do anything. Does my values look right? Could it be the url, user or password? roba
You haven't given any samples of code, error messages, or your URL. What does your test program do? What is it supposed to do?
You are asking an unanswerable question based on the information provided
Maximilian Xavier Stocker
Ranch Hand
Joined: Sep 20, 2005
Posts: 381
posted
0
Rob along with this thread you hijacked two other threads with this request.
You say you are having a problem yet you have provided almost no information whatsoever. Post your test code. Post the results. If all you say is you don't think it works because it doesn't do anything that is meaningless. Maybe it isn't supposed to do anything. Maybe you aren't actually running the program. Maybe it is actually hanging/crashing/etc and you haven't noticed or who knows what.
Nobody can guess. So please stop posting requests in mulitiple threads and focus on delivering INFORMATION in this thread that could actually make your question answerable.
So please if want help there are many experts here who can help you but you need to post ALL your code along with an explanation of what it does or doesn't do.
private static Movie getMovie(ResultSet movies) { try { String title=movies.getString("Title"); int year=movies.getInt("Year"); double price=movies.getDouble("Price"); return new Movie (title, year, price); } catch (SQLException e) { System.out.println(e.getMessage()); } return null; } private static class Movie { public String title; public int year; public double price;
public Movie(String title, int year, double price) { this.title=title; this.year=year; this.price=price;
} } } Sorry for not posting anything very direct. This is a COMPILED code that i can't get to work. I have a active database on my computer right now as well. when i run the code the black box pops up and gives me this...
com.mysql.jdbc.Driver Press any key to Continue....
I think my driver is setup wrong and if so I would like to ask help with that part of it. Or I am entering the wrond URL or something Thank You roba
Ideally u shud not put any jar file inside ur jdk/lib.. ,unless the jar name contains the word java. comming back to ur problem..try following , Extract the mysql.jar inside web-inf\classes of ur appication and try executing the ur class.
Aarati appears to have a problem with typing (we prefer real words and not abbreviations, please) but I agree. While you could put the jar there, it is not the best place for it. For one thing it would prevent you writing code for more than one MySQL version at a time, and if you forgot you placed the jar there you'd have an awful time trying to work out what was wrong.
Maximilian Xavier Stocker
Ranch Hand
Joined: Sep 20, 2005
Posts: 381
posted
0
com.mysql.jdbc.Driver Press any key to Continue....
I think my driver is setup wrong and if so I would like to ask help with that part of it. Or I am entering the wrond URL or something Thank You roba
You sill have not identified that there is even a problem. The code you posted does not under any circumstances produce that output. Perhaps you running in an IDE with breakpoints or something I do not know and could only guess at.
Then elsewhere you say it is the compiled version which produces this message. So I am beginning to suspect that the real issue is that you don't know anything about Java.
Roba, many people are willing to help you but you have to help us help you. Please post a SIMPLE piece of code that demonstrates an actual connection to and disconnecting from a MySQL server. Then please run that code and tell us the output if any.
Others may wish to play 21,000 questions as to what might be wrong with your classpath but as up to this point I see nothing that actually says ClassNotFound I am not convinced that that will ever be helpful.
rob armstrong
Ranch Hand
Joined: Jul 25, 2005
Posts: 77
posted
0
sorry Max this is the only output i get when i execute the code. There really isn't much more to say other than i do not understand how to setup the drivers properly. I can execute queries on mysql client on that database and it works fine doing things that way so i could only assume I did not setup the classpath properly so it wont connect. roba
rob armstrong
Ranch Hand
Joined: Jul 25, 2005
Posts: 77
posted
0
I dont think i have the mysql.java file or the path that it should go in for that matter. Am I missing something? roba
Maximilian Xavier Stocker
Ranch Hand
Joined: Sep 20, 2005
Posts: 381
posted
0
Are you running this code in your IDE? How are you running this code? The code posted WILL NOT produce the output you say on it's own so something else is saying press any key to continue.
You may well have a problem with your classpath. But even if you do we are stuck until we know how you are running it anyway because you aren't invoking java directly. There is some middle layer of some sort... probably an IDE.
rob armstrong
Ranch Hand
Joined: Jul 25, 2005
Posts: 77
posted
0
ok here is something i found out.... catch (ClassNotFoundException e) this is where it is getting the output from. it throws this and puts the output. Why is it not finding it? roba
Maximilian Xavier Stocker
Ranch Hand
Joined: Sep 20, 2005
Posts: 381
posted
0
Originally posted by rob armstrong: ok here is something i found out.... catch (ClassNotFoundException e) this is where it is getting the output from. it throws this and puts the output. Why is it not finding it? roba
The jar with the driver is not in your classpath. How you need to fix this depends on how you are running.
rob armstrong
Ranch Hand
Joined: Jul 25, 2005
Posts: 77
posted
0
After reding the tutorial and a couple books with some brief stuff I still can't figure it out. Ill try and to the odbc way and see if i can get that way to work Thanks roba