MSSQL + Cayenne -> connection problem

From: nirwan (nirwan8..mail.com)
Date: Thu May 29 2008 - 07:13:57 EDT

  • Next message: Garcia Corral, Josep: "RE: MSSQL + Cayenne -> connection problem"

    Hello,

    I'm trying to use Cayenne with MSSQL Server 2005. I downloaded the fresh
    jdbc driver, created the database, set up new user with password. After
    designing the tables in the Cayenne Modeler i generate database and
    everything goes fast. I checked manualy if the database exists and so on
    (with the mssql management tools) and everything seems to be fine.Then I
    generate classes, write some simple query and here the problem starts. It
    takes great amounts of time for application to connect to the database. It
    can take up to 20s when im running first query:
    (...)
    2008-05-29 12:29:04 org.apache.cayenne.map.EntityResolver
    applyObjectLayerDefaults
    INFO: added runtime complimentary ObjRelationship from Klient to Placowka
    2008-05-29 12:29:04 org.apache.cayenne.map.EntityResolver
    applyObjectLayerDefaults
    INFO: added runtime complimentary ObjRelationship from DaneOsobowe to
    Wlasciciel
    2008-05-29 12:29:04 org.apache.cayenne.conf.RuntimeLoadDelegate
    finishedLoading
    INFO: finished configuration loading in 719 ms.
    2008-05-29 12:29:04 org.apache.cayenne.access.QueryLogger logConnect
    INFO: Opening connection:
    jdbc:sqlserver://localhost:1433;database=bazac;SelectMethod=cursor
            Login: michal
            Password: *******
    2008-05-29 12:29:05 org.apache.cayenne.access.QueryLogger logConnectSuccess
    INFO: +++ Connecting: SUCCESS.
    2008-05-29 12:29:05 org.apache.cayenne.access.QueryLogger
    logBeginTransaction
    INFO: --- transaction started.
    2008-05-29 12:29:05 org.apache.cayenne.access.QueryLogger log
    INFO: Detected and installed adapter:
    org.apache.cayenne.dba.sqlserver.SQLServerAdapter
    2008-05-29 12:29:25 org.apache.cayenne.access.QueryLogger logQueryStart
    <-----------look at the times
    INFO: --- will run 1 query.
    2008-05-29 12:29:25 org.apache.cayenne.access.QueryLogger
    logBeginTransaction
    INFO: --- transaction started.
    2008-05-29 12:29:25 org.apache.cayenne.access.QueryLogger logQuery
    INFO: SELECT t0.numerPlacowki, t0.miasto, t0.id FROM Placowka t0
    (...)

    Aplication freezes on NFO: Detected and installed adapter:
    org.apache.cayenne.dba.sqlserver.SQLServerAdapter line.
    Next one is: 2008-05-29 12:29:25 org.apache.cayenne.access.QueryLogger
    logQueryStart...
    Sometimes i even get exception:

    INFO: Detected and installed adapter:
    org.apache.cayenne.dba.sqlserver.SQLServerAdapter
    Exception in thread "main" org.apache.cayenne.CayenneRuntimeException:
    [v.3.0M3 Jan 27 2008 20:12:33] Commit Exception
            at
    org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1207)
            at
    org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1088)
            at tools.Testy.test1(Testy.java:27)
            at mainFiles.Main.main(Main.java:22)
    Caused by: java.sql.SQLException: Can't obtain connection. Request timed
    out. Total used connections: 1
            at
    org.apache.cayenne.conn.PoolManager.uncheckPooledConnection(PoolManager.java:422)
            at
    org.apache.cayenne.conn.PoolManager.getConnection(PoolManager.java:351)
            at
    org.apache.cayenne.conn.PoolManager.getConnection(PoolManager.java:344)
            at
    org.apache.cayenne.access.DataNode$TransactionDataSource.getConnection(DataNode.java:331)
            at
    org.apache.cayenne.dba.sybase.SybasePkGenerator.longPkFromDatabase(SybasePkGenerator.java:168)
            at
    org.apache.cayenne.dba.JdbcPkGenerator.generatePk(JdbcPkGenerator.java:254)
            at
    org.apache.cayenne.access.DataDomainInsertBucket.createPermIds(DataDomainInsertBucket.java:165)
            at
    org.apache.cayenne.access.DataDomainInsertBucket.appendQueriesInternal(DataDomainInsertBucket.java:76)
            at
    org.apache.cayenne.access.DataDomainSyncBucket.appendQueries(DataDomainSyncBucket.java:80)
            at
    org.apache.cayenne.access.DataDomainFlushAction.preprocess(DataDomainFlushAction.java:183)
            at
    org.apache.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:135)
            at
    org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:821)
            at
    org.apache.cayenne.access.DataDomain$2.transform(DataDomain.java:788)
            at
    org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:847)
            at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:785)
            at
    org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1175)
            ... 3 more
    Java Result: 1

    It doesn't matter what query (insert,update,select) im trying to run. Always
    stops at the same place and if there is an exception (usually there is) it
    looks like the one i posted. I think that its about commitChanges() but i
    dont know what is causing he problem. Would love to hear your advices :)

    Thank you for all your help and im sorry for my poor english :)

    Mike

    -- 
    View this message in context: http://www.nabble.com/MSSQL-%2B-Cayenne--%3E-connection-problem-tp17532439p17532439.html
    Sent from the Cayenne - User mailing list archive at Nabble.com.
    



    This archive was generated by hypermail 2.0.0 : Thu May 29 2008 - 07:14:31 EDT