Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!

Jason Steele

Ranch Hand
+ Follow
since Apr 25, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jason Steele

agreed, storing them in an ArrayList would work fine.
15 years ago
Yaroslav,

Thanks, this sounds good. I will try it.
Thanks for the prompt reply...and your critism is well taken. I will try that.
Howdy,


After searching, and maybe just not understanding, I have finally decided to appeal to the masses. Here is my problem:

1. I have one class that implements runnable - MainClass
2. Then I have two seperate thread classes InitThread, ListenerThread
(MainClass is a Client)

In MainClass I read in properties for network settings

After reading properties and setting initialization vars, I call connect() which looks as follows:


Now, InitThread does do what it is supposed to do...but then I get this:

java.lang.IllegalMonitorStateException: current thread not owner
at java.lang.Object.wait(Native Method)



I have found a lot on the exception, but I do not know how to fix it...What I want is for the listenerThread to wait until the initThread is done...any suggestions would be appreciated.


"java.sql.SQLException: Driver not found for URL: jdbc:mysql://localhost:3306/listas/" (the databases listas exist!!)


This error means that your url is not formed in a manner that coincides with a registered driver.
the url for mysql should look like this:

I think your error is with your trailing "/" after listas. Try removing it.
hmmm...post some code? What's the problem?
15 years ago
you do not need to use a prepared statement for an Oracle internal function like sysdate.


String query = insert into myTable (my_date) values (?);
PreparedStatement ps = con.prepareStatement(query);
//insert code here to bind the variable in the prep stat
ps.executeUpdate;


That preparedStatement is waiting for a parameter.
You could use:

But then you might as well just forget the prepared statement...unless this is something happening often.
Haven't tried it but shouldn't it be:
Oops...do not put InventoryManager in your code. Should be:
15 years ago
This is what I use. It also works in an executable jar:
15 years ago
Gregg,
I only use JDialogs for preference boxes, login boxes, etc. The main reason I use them is for their automatic blocking. Of course, for them to block, you have to set them modal.
Good Luck!
15 years ago
Another example:
if(textBox.getText().trim().length() == 0) { // do stuff }
15 years ago


Cause = java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.


A couple of things are probably happening:
1. The server is not running (Hopefully it is!)
2. SQL Server does not have TCP/IP enabled - Check this in the network utility
3. Ping the IP address - Does it return?
4. The URL - IP address / Servername is incorrect.
These would be a good place to start. It would not be a database, username, or password problem because you could not even connect to the server... It is not a driver problem because your driver is recognized. I would say that most likely, it is your URL or connection string... Could you post an example of the connection string you are using?
Just iterate through the ResultSet and add them to your TableModel.


real generic...and REAL basic...but when you get the hang of this, then move on to bigger and better things.

Good Luck!
15 years ago
I believe this is what you want:

if(frame.getExtendedState() == frame.ICONIFIED) { // do stuff }
if(frame.getExtendedState() == frame.MAXIMIZED_BOTH) { // do stuff }
15 years ago