web stats
Using two Oracle database connectors - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-16-2010, 04:33 AM
josealmeida josealmeida is offline
OBX.1 Kenobi
 
Join Date: Dec 2009
Location: Portugal
Posts: 28
josealmeida is on a distinguished road
Default Using two Oracle database connectors

I have two channels, each connecting to a different Oracle database. These databases use different and incompatible versions of the oracle jar.
I don't think it's possible to use two oracle jars in the /Mirth/lib/custom without problems.
What would you suggest? Is there a configuration parameter or JavaScript instruction that would let me use both??

Thanks in advance.
Reply With Quote
  #2  
Old 07-16-2010, 05:49 AM
jbartels jbartels is offline
Mirth Guru
 
Join Date: Oct 2006
Posts: 722
jbartels is on a distinguished road
Default

Is it possible to address the Oracle JAR incompatibility? Is it known that version X of the JAR will not work with version Y of the DB?

Is there a non-Oracle driver (check Sourceforge) that will let you chatter to either Oracle DB?

Can you post more about what your Mirth installation is doing? There may be a better way to structure your channels or move your data around that would avoid this issue.
__________________
Jon Bartels

Zen is hiring!!!!
http://consultzen.com/careers/
Talented healthcare IT professionals wanted. Engineers to sales to management.
Good benefits, great working environment, genuinely interesting work.
Reply With Quote
  #3  
Old 07-16-2010, 06:48 AM
asulis asulis is offline
Mirth Guru
 
Join Date: Dec 2006
Location: Cagliari, Sardinia, Italy
Posts: 210
asulis is an unknown quantity at this point
Default

Hi JosŤ,
I had the same problem about two years ago. In the same mirth channel I had to communicate with both Oracle 10 and Oracle 7 istances. I solved copying both jars (with different names) inside custom/lib. Then, I wrote a java custom connector class that instanced the connection, via javascript, by taking as input the correct jar file (and obviously the other parameters).
This works only via javascript (connection was made inside a transformer, if I remember well), I have no experience with the default Database Oracle Connection Mirth source.
Reply With Quote
  #4  
Old 07-16-2010, 07:28 AM
josealmeida josealmeida is offline
OBX.1 Kenobi
 
Join Date: Dec 2009
Location: Portugal
Posts: 28
josealmeida is on a distinguished road
Default

Thank you both for your swift responses!

The older jar would be used in one channel to connect to an Oracle 7 database, query data and send messages constructed from that data.

The jar included in Mirth (ojdbc14.jar) is currently connecting successfully to an Oracle 9 database, reading and writing data.
I would guess that the driver included in Mirth is JDBC 10.2.0 (as the connection template indicates Oracle 10g R2)

Quote:
Originally Posted by jbartels
Is it possible to address the Oracle JAR incompatibility?
Maybe if I substitute the jar that comes with mirth with an older one that is forward compatible, but this change may not be desirable.

Quote:
Originally Posted by jbartels
Is it known that version X of the JAR will not work with version Y of the DB?
One coworker has unsuccessfully tried to use the newer jar to connect to the Oracle 7 database.

Quote:
Originally Posted by jbartels
Is there a non-Oracle driver (check Sourceforge) that will let you chatter to either Oracle DB?
It would be preferable to use the official jars.



Quote:
Originally Posted by asulis View Post
Hi JosŤ,
I had the same problem about two years ago. In the same mirth channel I had to communicate with both Oracle 10 and Oracle 7 instances. I solved copying both jars (with different names) inside custom/lib. Then, I wrote a java custom connector class that instanced the connection, via javascript, by taking as input the correct jar file (and obviously the other parameters).
This works only via javascript (connection was made inside a transformer, if I remember well), I have no experience with the default Database Oracle Connection Mirth source.
That is similar to my situation. Maybe that will be a possible solution. Write a java class that selects the older or newer jar and using javascript to use the class like so: var selectedDB = new Packages.xyz.OracleDbSelector() and have it return the connection.

I though that maybe someone had experienced this and had a more straightforward solution, but this seems a nice way to go.

Thank you both!
Reply With Quote
  #5  
Old 06-20-2012, 03:28 AM
santosam santosam is offline
OBX.2 Kenobi
 
Join Date: May 2012
Location: Portugal
Posts: 62
santosam is on a distinguished road
Default

I've been trying to use this approach as I'm also using two Oracle databases, one 7.3.4 and another 10 XE.
I tried this solution http://www.kfu.com/~nsayer/Java/dyn-jdbc.html and it worked on Netbeans. I then tried on Mirth but with no luck.
The problem is that only the connections implemented with DatabaseConnectionFactory can be used to build a message later on. On the source I have this:
Code:
var dbConn = Packages.DriverShim.getConn("jdbc : oracle:thin:@host:1521:sid", "username", "password");
var stmt = dbConn.createStatement();

var sql = "SELECT * FROM table";

var result = stmt.executeQuery(sql);
while (result.next()) {
    logger.error(result.getString(0x1));
}

dbConn.close();

return result;
On the Dashboard I get the values as expected but then I have this error: ERROR (com.mirth.connect.connectors.jdbc.JdbcMessageRece iver:247): Got a result of: oracle.jdbc.driver.OracleResultSetImpl@1bbb559

I have a Transformer that reads the value from the result variable and it must be expecting something that is not an Object...

Any solutions for this?

TYA

P.S. I figured out that the result variable must be a valid XML and not an Object...

Last edited by santosam; 06-20-2012 at 06:04 AM. Reason: CODE Tags
Reply With Quote
  #6  
Old 06-20-2012, 06:03 AM
santosam santosam is offline
OBX.2 Kenobi
 
Join Date: May 2012
Location: Portugal
Posts: 62
santosam is on a distinguished road
Default [solved]

After reading the source code of the class DatabaseConnection.java, I figured out where was my error: I had to populate a variable of type CachedRowSet. The code is now:

Code:
var result = stmt.executeQuery(sql);

var crs = new Packages.com.sun.rowset.CachedRowSetImpl();

crs.populate(result);

dbConn.close();

return crs;
Reply With Quote
  #7  
Old 08-27-2012, 10:02 AM
RIMrules RIMrules is offline
Mirth Newb
 
Join Date: Jan 2011
Location: Boston, MA
Posts: 14
RIMrules is on a distinguished road
Default Load another JDBC driver...

Hi,

I'm trying to do the same thing for MySQL, but the Driver is not reconized in JavaScript, perhaps missing something simple.

Can you show howo DriverShim was loaded prior to the call?

Thank you so much for the lead...
Reply With Quote
Reply

Tags
database, oracle

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 12:41 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation