db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <tfisc...@apache.org>
Subject Re: no DataSourceFactory configured
Date Mon, 22 Jan 2007 21:31:28 GMT
a) I do not believe that the torque.properties needs to be in the 
classpath. The tutorial example code loads it from the file system, as far 
as I know.
b) in your torque.properties, you have set 
torque.dsfactory.BddPortalCCG.connection.user =
which means that there is no user set for your connnection. Try setting 
the correct db user name there. Same goes for the 
torque.database.user
in the build.properties.

       Thomas

On Mon, 22 Jan 2007, Pierre-Alain Branger wrote:

> Hi everybody,
>
> I follow your suggestions but I still can not execute my program properly.
> Following, the different things I did:
>
> - I added torque.properties, actually it was not in it:
> export CLASSPATH=/home/pbranger/BddPortalCCG/src/conf
> By the way the tutorial don't mention this step.
>
> - I also added torque.properties to the default source package in Net beans.
>
> - My database is properly started
>
> - Connection url, password and username are right in the configuration file.
> I just borrow user and password in the mail I sent.
> Thomas, what do you mean by "I am sure whethet mysql accepts connections
> without specifying a database user (as you did)"?
> I can connect to mysql by mysql -u user -p but if I don't specify user I
> obviously can not connect.
>
> Thanks again for your help,
>
> Pierre
>
>> This usually means that connecting to the database failed. Possible
>> reasons
>> are
>> - the database is not started
>> - the connection url, password or username are wrong in the configuration
>> file
>> Loking at your configuration, I am sure whethet mysql accepts connections
>> without specifying a database user (as you did)
>>
>>      Thomas
>>
>> "Pierre-Alain Branger" <pbranger@ccg.unam.mx> schrieb am 20.01.2007
>> 02:04:11:
>>
>>> Hi everybody,
>>>
>>> I follow the tutorial and could generate my mysql database and the
>>> corresponding java access classes. I made a jar and add it to a java
>>> project that compiled well. But when I launch my application I obtain
>>> the
>>> following message:
>>>
>>> java.lang.NullPointerException: There was no DataSourceFactory
>>> configured
>>> for the connection BddPortalCCG
>>>         at
>>> org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:711)
>>>         at org.apache.torque.Torque.getConnection(Torque.java:268)
>>>         at
>>> org.apache.torque.util.Transaction.beginOptional(Transaction.java:80)
>>>         at org.apache.torque.util.Transaction.begin(Transaction.java:62)
>>>         at
>>> mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:361)
>>>         at
>>> mx.unam.ccg.BddPortal.BaseApplication.save(BaseApplication.java:343)
>>>         at testbddportalccg.Main.main(Main.java:36)
>>>
>>> I hope soƱeone could help, me. Here are the different configuring files
>>> I
>>> use:
>>>
>>> ------------- torque.properties ----------------
>>>
>>> torque.database.default = BddPortalCCG
>>> torque.database.BddPortalCCG.adapter = mysql
>>>
>>> # Using commons-dbcp
>>> torque.dsfactory.BddPortalCCG.factory =
>>> org.apache.torque.dsfactory.SharedPoolDataSourceFactory
>>> torque.dsfactory.BddPortalCCG.connection.driver =
>>> org.gjt.mm.mysql.Driver
>>> torque.dsfactory.BddPortalCCG.connection.url =
>>> jdbc:mysql://localhost:3306/BddPortalCCG
>>> torque.dsfactory.BddPortalCCG.connection.user =
>>> torque.dsfactory.BddPortalCCG.connection.password =
>>>
>>>
>>> ------------- project.properties ----------------
>>> # The name of the project Torque will generate code for.
>>> torque.project=BddPortalCCG
>>>
>>> # The target database platform.
>>> torque.database=mysql
>>>
>>> # The target package to put the generated classes in.
>>> torque.targetPackage=mx.unam.ccg.BddPortal
>>>
>>> # The JDBC URL that Torque can use to create and
>>> # drop databases if instructed to do so.
>>> torque.database.createUrl=jdbc:mysql://localhost/mysql
>>>
>>> # The JDBC URL that will be used to create tables in your database.
>>> torque.database.buildUrl=jdbc:mysql://localhost/BddPortalCCG
>>>
>>> # The JDBC URL that will be used to access your database.
>>> torque.database.url=jdbc:mysql://localhost/BddPortalCCG
>>>
>>> # The JDBC database driver to use when connecting to your database.
>>> torque.database.driver=org.gjt.mm.mysql.Driver
>>>
>>> # The administrative username that has sufficient privileges to create
>>> # and drop databases and tables that Torque executes at generation time.
>>> torque.database.user=
>>>
>>> # The administrative password for the supplied username.
>>> torque.database.password=
>>>
>>> # The hostname or IP address of your database server.
>>> torque.database.host=localhost
>>>
>>> # The location of the your *-schema.xml files (see below).
>>> torque.schema.dir=./schema
>>>
>>>
>>> ------------- schema.xml ----------------
>>> <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
>>> <!DOCTYPE database SYSTEM
>>>  "http://db.apache.org/torque/dtd/database_3_1.dtd">
>>>
>>> <database
>>>   name="BddPortalCCG">
>>>
>>>   <table name="application" description="Book Table">
>>>     <column
>>>       name="idApp"
>>>       required="true"
>>>       primaryKey="true"
>>>       type="INTEGER"
>>>       description="Application Id"/>
>>>     <column
>>>       name="nameApp"
>>>       required="true"
>>>       type="VARCHAR"
>>>       size="255"
>>>       description="Application Name"/>
>>>     <column
>>>       name="pathApp"
>>>       required="true"
>>>       type="VARCHAR"
>>>       size="255"
>>>       description="Application Path"/>
>>>   </table>
>>> </database>
>>>
>>> Thanks for your help,
>>>
>>> Pierre-Alain Branger
>>> Program of Computational Genomics
>>> Campus Morelos
>>> Tel. +52 777 13 100 24
>>> pbranger@ccg.unam.mx
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: torque-user-help@db.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: torque-user-help@db.apache.org
>>
>>
>>
>
>
> Pierre-Alain Branger
> Program of Computational Genomics
> Campus Morelos
> Tel. +52 777 13 100 24
> pbranger@ccg.unam.mx
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>

Mime
View raw message