users@glassfish.java.net

RE: Wrong XAState: 0

From: Martin Gainty <mgainty_at_hotmail.com>
Date: Fri, 20 Feb 2009 21:54:24 -0500

where is the driver name specified?

Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.




> Date: Fri, 20 Feb 2009 17:55:19 -0800
> From: glassfish_at_javadesktop.org
> To: users_at_glassfish.dev.java.net
> Subject: Re: Wrong XAState: 0
>
> I don't know what you exactly mean. Here my code for jdbc lookup and creation of a database connection:
> [code]
> // --------------------------------------------------------------------------------------------------------------------------------------------------
> public class DbManager {
>
> @Resource(name = "jdbc/Postgres")
> private DataSource db = null;
> private LogManager log = null;
> private Utils utils = null;
> private static DbManager instance = null;
> private String defaultDate = "2222-12-12 12:12:12.1"; //have to use this instead of NULL due to data base restrictions
>
> /** Creates a new instance of DbManager */
> protected DbManager() {
> log = new LogManager();
> log.traceMethodeDetails();
>
> utils = new Utils();
>
> Context c;
> try {
> c = new InitialContext();
> db = (DataSource) c.lookup("jdbc/Postgres");
> log.debug("COSTO: lookup of datasource jdbc/Postgres successful");
> } catch (NamingException ex) {
> log.debug("Could not lookup JNDI name...("+ex.getMessage()+")");
> }
> }
>
> public static DbManager getInstance() {
> if(instance == null) {
> instance = new DbManager();
> }
> return instance;
> }
>
> // ---- reserves a connection from db connection pool and returns it
> private Connection getConnection()
> {
> Connection con = null;
> try {
> con = db.getConnection();
> con.setAutoCommit(true);
> } catch (SQLException ex) {
> log.internalError("Could not get database connection... ("+ex.getMessage()+")");
> }
>
> return con;
> }
>
> // ---- releases a previous requested connection from the connection pool
> void releaseConnection(Connection con) {
> try{
> if ((con != null) && (con.isClosed() == false)){
> con.close();
> con = null;
> }
> } catch (SQLException ex) {
> log.internalError("Could not close database connection... ("+ex.getMessage()+")");
> }
> }
> [/code]
>
> Thanks
> [Message sent by forum member 'glassfox' (glassfox)]
>
> http://forums.java.net/jive/thread.jspa?messageID=333207
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>

_________________________________________________________________
It’s the same Hotmail®. If by “same” you mean up to 70% faster.
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_AE_Same_022009