Hi Ken, Ken Hu wrote: > well, I've tested the connection privilege before I post my question. > I can use 'mysql' to connect to my database running on another machine. > > The major problem is that OJB seems doesn't use the username and > password which I set in build.properties to make the db connection. It's > weired and I don't know why . >
If you build the files as described in getting started doc (with all steps) you can check the generated repository.xml file (separated in sub files). The most important file is build/resources/repository_database.xml: <jdbc-connection-descriptor jcd-alias="default" default-connection="true" platform="MySQL" jdbc-level="3.0" driver="com.mysql.jdbc.Driver" protocol="jdbc" subprotocol="mysql" dbalias="//localhost/productmanager" username="steve" password="secret" eager-release="false" batch-mode="false" useAutoCommit="1" ignoreAutoCommitExceptions="false" > ... If this file contains the wrong settings you can try correct the settings by hand and run the app again. regards, Armin > Ken > > 於 四,2007-01-11 於 10:09 +0200,zkn 提到: >> I suppose you have problem with privileges: >> >> Caused by: java.sql.SQLException: Access denied for user: >> '[EMAIL PROTECTED]' (Using password: NO) >> >> Try to connect to the database using plain JDBC to see if your >> connection parameters are OK. >> >> Ozkan >> >> Ken Hu wrote: >>> Dear All: >>> >>> I am a newbie to Apache OJB. >>> I dowload the binary package and some tutorials then I start to give it >>> a try. >>> Extract the contents from Tutorial2 and then put them to >>> ojb-blank/src/java, the build is fine. >>> >>> The database information stored in build.properties are: >>> >>> jcdAlias=default >>> databaseName=test >>> databaseUser=ctu >>> databasePassword=ta1hs1ung >>> ............ >>> ........... >>> # For MySQL this would look like: >>> dbmsName=MySQL >>> jdbcLevel=3.0 >>> jdbcRuntimeDriver=com.mysql.jdbc.Driver >>> urlProtocol=jdbc >>> urlSubprotocol=mysql >>> urlDbalias=//192.168.2.202/${databaseName} >>> >>> When I execute the Application.class , I got : >>> >>> Welcome to the OJB ODMG tutorial application >>> >>> >>> [0] List all product entries >>> [1] Enter a new product >>> [2] Edit a product entry >>> [3] Delete a product entry >>> [4] Quit Application >>> type in number to select a use case >>> >>> Then I input 0 to list all stored prodcuts , but I got the folowing >>> errors: >>> >>> ================================================================================================ >>> Could not borrow connection from pool. Active/Idle instances in >>> pool=0/0. org.apache.ojb.broker.metadata.JdbcConnectionDescriptor: >>> [EMAIL PROTECTED] >>> jcd-alias=default >>> default-connection=false >>> dbms=MySQL >>> jdbc-level=3.0 >>> driver=com.mysql.jdbc.Driver >>> protocol=jdbc >>> sub-protocol=mysql >>> db-alias=//192.168.2.202/test >>> user=sa >>> password=***** >>> eager-release=false >>> ConnectionPoolDescriptor={removeAbandonedTimeout=300, >>> testWhileIdle=false, logAbandoned=false, testOnReturn=false, >>> timeBetweenEvictionRunsMillis=-1, minIdle=0, numTestsPerEvictionRun=10, >>> removeAbandoned=false, maxIdle=-1, fetchSize=0, whenExhaustedAction=0, >>> minEvictableIdleTimeMillis=600000, testOnBorrow=true, maxActive=30, >>> maxWait=10000} >>> batchMode=false >>> useAutoCommit=AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE >>> ignoreAutoCommitExceptions=false >>> >>> [EMAIL PROTECTED] >>> sequenceManagerClass=class >>> org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl >>> Properties={grabSize=20, autoNaming=true, seq.start=200000} >>> . >>> >>> ] >>> at >>> org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl.checkOutJdbcConnection(Unknown >>> Source) >>> at >>> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupConnection(Unknown >>> Source) >>> at >>> org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection(Unknown >>> Source) >>> ... 16 more >>> Caused by: org.apache.ojb.broker.accesslayer.LookupException: Error >>> getting Connection from DriverManager with url >>> (jdbc:mysql://192.168.2.202/test) and driver (com.mysql.jdbc.Driver) >>> at >>> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConnectionFromDriverManager(Unknown >>> Source) >>> at org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl >>> $ConPoolFactory.makeObject(Unknown Source) >>> at >>> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:771) >>> ... 19 more >>> Caused by: java.sql.SQLException: Access denied for user: >>> '[EMAIL PROTECTED]' (Using password: NO) >>> ================================================================================================ >>> >>> Well , I think I have speicified the correct username and password in >>> build.properties, I don't know why it still use [EMAIL PROTECTED] as >>> username to get a connection . >>> Does anyone have the similar experience with me ? >>> Please give me some help , thanks ! >>> >>> Ken >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]