Hi Calven,

Are you trying to connect to both at the same time from the same instance?  Or 
are these two different apps?

How do you set the Oracle connection dictionary?  If you are using Wonder or 
GVC stuff, this will get set on this line:
> modelGroup.addModelWithPathURL(msaiqModelURL);
due to notifications.  The solution depends on the answers to the question 
above.

See also EODatabaseContext
public static EODatabaseContext forceConnectionWithModel(EOModel model,
                        NSDictionary overrides, EOEditingContext editingContext)


Chuck


On 2011-06-27, at 12:25 PM, Calven Eggert wrote:

> Hi, All
> 
> I've modified a JavaApplication that connects to an Oracle database to also 
> get records from a MSSQLServer database.  I've added my additional model and 
> I can't seem to connect to the MSSQLServer database.  I've searched the 
> archives and I can't find the basic information needed to connect to a 
> MSSQLServer.
> 
> I've done this:
>         adaptor1 = new JDBCAdaptor("JavaJDBCAdaptor");
>         database1 = new EODatabase(adaptor1);
>         dbContext1 = new EODatabaseContext(database1);
>         java.net.URL msaiqModelURL = new 
> java.net.URL(modelPath+"/MosaiqModel.eomodeld"); 
>         EOModel model1 = modelGroup.addModelWithPathURL(msaiqModelURL);
>         adaptor1.setConnectionDictionary(model1.connectionDictionary());
>         database1.addModel(model1);
> 
> In the eomodel:
> URL=jdbc:microsoft:sqlserver://x.x.x.x:1433;
> User=user
> Password= Password
> Driver=com.microsoft.jdbc.sqlserver.SQLServerDriver
> 
> 
> I've also added the driver to the project:
> sqljdbc4.jar
> 
> 
> when I do this:
> EOFetchSpecification spec = new EOFetchSpecification("MyTable", null, null);
> return ec.objectsWithFetchSpecification(spec);
> 
> I get the msg:
> java.lang.IllegalStateException: _obtainOpenChannel -- 
> com.webobjects.eoaccess.EODatabaseContext 
> com.webobjects.eoaccess.EODatabaseContext@194835fb: failed to open database 
> channel.  Check your connection dictionary, and ensure your database is 
> correctly configured.
> 
> When I look at adaptor1, from above, the values are all related to oracle.  
> (Oracle JDBC Driver, etc) Hmmm,  I removed the sqljdbc4.jar from the project 
> and I get the same error, so that tells me that it's still trying to connect 
> via the oracle driver.  what can i do to get it to use the MSSQLServer driver?
> 
> Calven
> 
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
> 
> This email sent to [email protected]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to