Re: creating a second database connection
Re: creating a second database connection
- Subject: Re: creating a second database connection
- From: Tim Worman <email@hidden>
- Date: Thu, 23 Aug 2012 16:51:26 -0700
I have connection settings for all of my databases in properties. They all work. When a Wonder app starts, it logs out all properties being used by the application. You won't even need to try and use the app - if they aren't there, they weren't discovered. If your app is a Wonder app, ERXConfiguationManager will discover all the properties.
At launch, if your props are being improperly overwritten then you need to do a file search in your project for where they are being overridden. You cannot use any global settings if you are using more than one database since globals will be applied to every db connection.
your individual database properties will be named as such:
MyModel.URL = jdbc:urlForDatabaseConnection
MyModel.DBDriver = com.openbase.jdbc.ObDriver (whatever)
MyModel.DBPlugin = OpenBasePlugIn (whatever)
MyModel.DBUser = user
MyModel.DBPassword = password
Where your EOModel is named "MyModel.eomodeld." It will work if you're not accidentally overriding the properties elsewhere.
T
On Aug 23, 2012, at 3:47 PM, Theodore Petrosky <email@hidden> wrote:
>
> Well, no variation of working with the properties file did anything with the postgresql connection. it constantly said the dictionary was empty. finally, I put the connection string into EntityModeler and it works.
>
> the oracle side had no problem.
>
> I must have read the wonder docs 16 times: ERXConfigurationManager
> and it didn't help.
>
> Ted
>
>
>
>
>
> --- On Thu, 8/23/12, Chuck Hill <email@hidden> wrote:
>
>> From: Chuck Hill <email@hidden>
>> Subject: Re: creating a second database connection
>> To: "Theodore Petrosky" <email@hidden>
>> Cc: "Henrique Gomes" <email@hidden>, "WebObjects Development" <email@hidden>
>> Date: Thursday, August 23, 2012, 5:08 PM
>> See ERXConfigurationManager
>>
>> ASFreelanceUsage.dbConnectURL=jdbc:postgresql://localhost/asfreelancedb?capitalizeTypenames=true&zeroDateTimeBehavior=convertToNull
>>
>>
>> On 2012-08-23, at 1:53 PM, Theodore Petrosky wrote:
>>
>>> Is there an issue with the number of characters?
>> because this is not working:
>>>
>>> # Connection Dictionary
>>> dbConnectURLModel=ASFreelanceUsageModel
>>>
>> dbConnectURLASFreelanceUsageModel=jdbc:postgresql://localhost/asfreelancedb?capitalizeTypenames=true&zeroDateTimeBehavior=convertToNull
>>> dbConnectUserASFreelanceUsageModel=admin
>>> dbConnectPasswordASFreelanceUsageModel=4004
>>> dbConnectPluginASFreelanceUsageModel=PostgresqlPlugIn
>>>
>> dbConnectDriverASFreelanceUsageModel=org.postgresql.Driver
>>>
>>> I have tried this value (ASFreelanceUsageModel) to be
>> the name of the model or the name of the framework.
>>>
>>> do the name of the model and the name of the framework
>> have to agree?
>>>
>>>
>>> Aug 23 16:47:24 ASFreelanceWorkD2W[50829] INFO
>> er.transaction.adaptor.ConnectionAnalyzer - Either
>>> (a) the plugin is missing from your classpath or
>>> (b) the connection dictionary has a misspelled 'plugin'
>> key or
>>> (c) the plug-in name specified under the 'plugin' key
>> is incorrect or
>>> (d) the class name for the JDBC driver under the key
>> 'driver' is missing from the connection dictionary or
>>> (e)the connection dictionary has a misspelled 'driver'
>> key
>>>
>>>
>>>
>>> but this worked fine:
>>>
>>> # Connection Dictionary
>>> dbConnectURLModel=SPAccessModel;
>>>
>> dbConnectURLSPAccessModel=jdbc:oracle:thin:@10.1.3.250:1521/XE?capitalizeTypenames=true&zeroDateTimeBehavior=convertToNull
>>> dbConnectUserSPAccessModel=spartner
>>> dbConnectPasswordSPAccessModel=as4004
>>> dbConnectPluginSPAccessModel=OraclePlugIn
>>>
>>>
>>> Or I am misunderstanding how to use this.
>>>
>>> Ted
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --- On Thu, 8/23/12, Henrique Gomes <email@hidden>
>> wrote:
>>>
>>>> From: Henrique Gomes <email@hidden>
>>>> Subject: Re: creating a second database connection
>>>> To: "Theodore Petrosky" <email@hidden>
>>>> Cc: "WebObjects Development" <email@hidden>
>>>> Date: Thursday, August 23, 2012, 3:44 PM
>>>>
>>>> On 23/08/2012, at 20:37, Theodore Petrosky wrote:
>>>>
>>>>> so i am having a problem.
>>>>>
>>>>> db1 is a postgresql db on machine1
>>>>> db2 is an oracle db on machine2
>>>>>
>>>>> I have a framework for each model and I am
>> importing
>>>> the frameworks into a newly created D2W wonder
>> app.
>>>>>
>>>>> If I start the app with either framework, I get
>> a
>>>> 'good' app that can query the database in question.
>>
>>>>>
>>>>> However, if I have both frameworks the app
>> starts but
>>>> if I try to access the oracle data it blows up.
>>>>>
>>>>> it look like (from the logs) that with both
>> frameworks
>>>> in the path, postgresqlplugin is being used. Hence
>> oracle
>>>> bites the dust.
>>>>>
>>>>> what should the property file look like for
>> these
>>>> frameworks?
>>>>>
>>>>> connection dict from the property file of db1
>>>> (postgresql)
>>>>> # Connection Dictionary
>>>>>
>>>>
>> dbConnectURLGLOBAL=jdbc:postgresql://localhost/asfreelancedb?capitalizeTypenames=true&zeroDateTimeBehavior=convertToNull
>>>>> dbConnectUserGLOBAL=admin
>>>>> dbConnectPasswordGLOBAL=4004
>>>>> dbConnectPluginGLOBAL=PostgresqlPlugIn
>>>>> # dbConnectDriverGLOBAL=org.postgresql.Driver
>>>>>
>> dbEOPrototypesEntityGLOBAL=EOJDBCPostgresqlPrototypes
>>>>>
>>>>> connection dict from the property file of db2
>> (oracle)
>>>>> # Connection Dictionary
>>>>>
>>>>
>> dbConnectURLGLOBAL=jdbc:oracle:thin:@10.1.3.250:1521/XE
>>>>> dbConnectUserGLOBAL=user
>>>>> dbConnectPasswordGLOBAL=as4004
>>>>>
>>>>> Interesting on the home tab search all I see
>> all the
>>>> correct columns in the search all popups. But if I
>> click the
>>>> "find" button on a table that lives in the oracle
>> db it
>>>> blows up with:
>>>>>
>>>>> NFO
>> er.transaction.adaptor.Exceptions -
>>>> Database Exception occured: ERROR: relation "job"
>> does not
>>>> exist
>>>>> Position: 1240at
>>>>
>> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
>>>>>
>>>>> postgresql???
>>>>>
>>>>> I am sure I am missing something simple.
>>>>>
>>>>> Ted
>>>>>
>>>>
>>>>
>>>> Yes you are :-)
>>>> The GLOBAL properties are just that: GLOBAL. Like
>> for ALL
>>>> models. The last one loaded wins. You must replace
>> the
>>>> 'GLOBAL' by the model name in each.
>>>>
>>>> dbConnectURLModel =
>>>>
>>>> HG
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be
>> ignored.
>>> Webobjects-dev mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>> --
>> Chuck Hill
>> Senior Consultant / VP Development
>>
>> Practical WebObjects - for developers who want to increase
>> their overall knowledge of WebObjects or who are trying to
>> solve specific problems.
>> http://www.global-village.net/gvc/practical_webobjects
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden