Skip to main content

glassfish 4 and DB2

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
2 replies [Last post]
yakridge
Offline
Joined: 2011-07-09

Has anyone been successful with creating DB2 JDBC resources? I've followed all the directions (I think) but I'm getting errors.

For starters the the classes of the resources are:
Connecton: com.sun.gjc.spi.jdbc40.ConnectionWrapper40
Statement: com.sun.gjc.spi.jdbc40.StatmentWrapper40
Should the classes be com.ibm.db2 ??? or the Sun wrappers?

Secondly, pressing the "flush" button gives a response that it cannot be flushed because it has not been initialized (this after referencing the datasource in an EJB).

Thirdly, when an EJB references the injected datasource the exception is that the schema does not exist.

So following the directions clearly does not result in a usable resource.

If you've successfully connected to a DB2 resource definition, please share how to create the resource so that an injection point of @Resource works.

Much thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
yakridge
Offline
Joined: 2011-07-09

By reading the content of the following thread:

What are GF requirements for creating JDBC connection pool with MySQL?

I was able to figure out how to get er done! I was putting the driver in the wrong directory. Glassfish 4 with DB2 10.5 is now working splendidly with websockets to a Netbeans Application client!!!!!

yakridge
Offline
Joined: 2011-07-09

Turns out I spoke too soon!

By what accident it started working is beyond me except that everything is set right. Unfortunately, however, whatever I did is not reproducible. I have tried the same exact settings on two other machines with no luck. For some reason GF will not talk to the database. It creates a datasource but the datasource is the wrong classes (connection wrapper and statement wrapper). The machine that is working returns a connectionHolder and an IBM statement object.

I have tried every combination of where to put the driver jar. I have set every variable mentioned in any of the several Google results on the subject (including the admin guide).

Please, if somebody knows, point me to the missing link between GF and DB2!

Thanks.