File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Can we use 2 jdbc drivers for same app? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Can we use 2 jdbc drivers for same app?" Watch "Can we use 2 jdbc drivers for same app?" New topic

Can we use 2 jdbc drivers for same app?

Luke Zechariah
Ranch Hand

Joined: Sep 27, 2005
Posts: 128

I am having a web application which is using struts. The database I have is Sql Server 6.5.
We are having an propriety software for xml binder. This software unmarshalls the xml properly if we use only a sun.jdbc.odbc.JdbcOdbcDriver driver but its run very slowly for the web application. So then we chose another jdbc driver jtds1.2. But this driver does not unmarshall with that propriety software.

So here is my question in the same web application can we have 2 jbdc drivers? One is sun.jdbc.odbc.JdbcOdbcDriver to unmarshall xmls and the other is jtds for the web application screens?

Thank you very much for your reply in advance.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
You can have any number of drivers accessing any number of databases. No problem.

But it sounds strange to me that the JDBC/ODBC bridge should be able to do something that jTDS can't. In all circumstances I have encountered, jTDS stands head and shoulders above the bridge in all regards. Have you pointed out this problem on the jTDS mailing list? I'm certain the developers would want to fix it pretty quickly if it is an actual bug. (And as a side note, you should not use the bridge driver, ever, for a number of reasons.)
Luke Zechariah
Ranch Hand

Joined: Sep 27, 2005
Posts: 128
Hello Ulf Dittmer,

Thanks for the reply. What you say is correct. But I am using an xml binder tool and I am getting this exception:

com.hitsw.xml.databinding.XMLDatabindingException: ExecuteQuery SQL for retrieve autoIncremental-key failed (EXECQUERY_RETRIEVEKEY)
Invalid value "null" for the autoicremental key of the table backupcasemsbesql.dbo.Claim
[1/13/06 21:34:24:548 CST] 3b468c9 SystemOut O com.hitsw.xml.databinding.XMLDatabindingException: Transaction commit/rollback failed: transaction not started (TRANSNOTSTARTED_ERROR)

I will ask it in the jtds forums too. Thanks for the suggestion. Anyone who knows why the above problem is occuring pls let me know.

Thanks in advance.
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
This seems like a bug in com.hitsw.xml.databinding
I agree. Here's the link:
subject: Can we use 2 jdbc drivers for same app?
It's not a secret anymore!