Help coderanch get a
new server
by contributing to the fundraiser

Nathanael Ulrick

Greenhorn
+ Follow
since Jul 17, 2001
Merit badge: grant badges
For More
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 Nathanael Ulrick

Not sure how to access a session EJB which has been deployed in a separate JAR file from a WAR.
My files look like this:

(Where the jndi-name MyJNDI is that of the bean in the JAR.)
This results in

during the deployment of the WAR. No difference even if I wrap the JAR and the WAR in an EAR file.

Removing the <ejb-ref> tag in web.xml allows the deployment to go ahead, but then the context lookup to java:comp/env/ejb/MyEJB fails. ejb not bound, it says.

I've tried to do a context lookup on the JNDI name of the bean directly. This works, but only on startup of JBoss. Any subsequent redeploy results in a ClassCastException on lookup, such as:
Couldn't cast class $Proxy62 into interface foo.bar.MyEJBHome
Despite the fact that subsequent tests reveal that what is returned is indeed a foo.bar.MyEJBHome.

So this leads me to suspect that I'm not supposed to be doing a direct lookup anyway.

Using JBoss 3.0.4. Any help appreciated.
N
createStatement() can take two extra arguments: resultSetType and resultSetConcurrency.
It's probably because the default values differ between 1.1.8 and 1.3, and 1.3 is trying to create some fancy ResultSet which is scrollable etc, which the ODBC driver doesn't support.
Try specifying the arguments to something you know will be safe, e.g. TYPE_FORWARD_ONLY and CONCUR_READ_ONLY.
I don't think there's a quick and easy way to do this.
You'll just have to create a custom TableModel of some sort which will take 2 TableModels and pretend that it's one big one. Still relatively painless, probably < 100 lines.
22 years ago
Let's see your query, and the relevant section of code where this is happening.
Since you'll be running a servlet, the net driver would probably be the most appropriate....
db2java.zip should already be on the server, in sqllib/java
I would copy this file to the client. It should work even if the two machines are different types. Include this file in your classpath.
Also, you have to execute db2jstrt on the server. If you do not specify any arguments, this will open port 6789.
Connect with the net driver using a url which should look something like this:
jdbc:db2:yourserver:6789/yourschema
To use the net driver, you need to have db2jstrt running on the host machine. The default port then would be 6789, although you can specify a different port. I've read somewhere that you'd need db2jstrt running on the client with the same port as well -- I doubt this is the case, but try it if you get stuck. Also, the copy of db2java.zip has to be the same as the one on the server.
If you use the app driver, the client config assistant needs to know about the server, and the port that you'd use won't be the same as the above (usually 50000, if you've only got one instance of db2.)
By the way, the JDBC drivers on 6 and 7 are buggy, so get the latest fixpack (and don't forget to keep db2java.zip in sync.)
You might find a 3rd party driver, eg from HiT Software much simpler to use.
I noticed you're trying to get the connection without using a username or password. What happens if you specify the username and password as arbitrary String fields?
I'm running JBuilder4, but assuming that the two versions are similar:
You'll need to add the new driver as a library. Then indicate that this library is needed by your current application.
You can do all this under Project Properties -> Paths -> Required Libraries.
I've been able to do this successfully... what did the instructions in the book say?
Sure, but you'd need to implement your own custom TableModel, which passes data to and from the JTable and the appropriate model. Whenever you change the view, firing an appropriate TableModelEvent will cause the JTable to update.
22 years ago
I liked this book by Steve Gutz:
Up To Speed with Swing
I'd recommend it to someone who's familiar with Java and picks things up without too much redundancy, but who knows relatively little about Swing.
22 years ago
I'm trying to connect an application from a Win2000 machine to a DB2 server on a Solaris box.
I seem to be able to connect just fine etc except that I need JDBC 2.0 functionality. This is where I've run into the same problem as in this post.
However, the server is running DB2 V6.1 and I don't happen to see java12/usejdbc2 on it.
Is this normal? What can I do?
Assuming the Objects are actually Floats you would need a nested loop which copies the values one by one.
22 years ago
The problem is that JTable only updates its TableModel when editing is finished, as specified in CellEditorListener.
I imagine what you would need to do is to add your own listener to the Component retrieved from getEditorComponent() whenever a new cell is being edited.
22 years ago
JTable.setColumnSelectionAllowed(boolean) toggles exactly what it says.
Then it's simply a matter of adding a mouse listener to the table header which figures out which column header was clicked and selecting the appropriate column.
The TableSorter example from the Java tutorial gives an example of listening to a table header.
23 years ago