Hi All,
I have a java application which uses jdbc-odbc bridge. Now I have two options for deploying that application on a linux machine:-
1. Modify the source to use JDBC driver to connect to MSSQL server.
2. Configure ODBC DSN on linux machine.
Which method is better ? I tried configuring ODBC DSN but couldn't succeed.
One more doubt. If I modify the source to use JDBC driver (freetds-java) then is it sufficient to modify only Class.forName() statement ?
regards
hi pankaj,
dunno if this will help u. but last time i was working with ODBC on Linux, i used the ODBC-ODBC bridge also known as OOB. Configuration of that was pretty well documented.
I would suggest 2nd alternative to u. Its better than limiting ur application code to particular DB's only.
Hth, Shailesh
--- Pankaj Jangid pankaj_jangid@yahoo.com wrote:
Hi All,
I have a java application which uses jdbc-odbc bridge. Now I have two options for deploying that application on a linux machine:-
- Modify the source to use JDBC driver to connect to
MSSQL server.
- Configure ODBC DSN on linux machine.
Which method is better ? I tried configuring ODBC DSN but couldn't succeed.
One more doubt. If I modify the source to use JDBC driver (freetds-java) then is it sufficient to modify only Class.forName() statement ?
regards
-- Pankaj Jangid National Centre for Software Technology
Yahoo-msnger : pankaj_jangid GPG Public Key : http://ashoka.ncst.ernet.in/~pankaj/gpg.txt
ATTACHMENT part 2 application/pgp-signature
__________________________________________________ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com
Well, I also had the same problem earlier for my Java project when I tried porting it to Linux.
The best(??) and the simplest soln could be to get your hands on Sun JDK 1.2 onwards - in case if you wanna use JDBC.
As far as JDBC-ODBC Bridge drivers are concerned, all the drivers available with any SQL server for Linux (includind MySQL & PostgreSQL) are very poorly written. And this is where the major problem lies. So even if you configure your ODBC DSN properly, your java program won't connect to the DB.
After you have a very well written JDBC-ODBC Bridge, you can configure your ODBC DSN to use any database - be it on MSSQL or Linux.
You don't need to change your Class.forName() statement in any case - unless you're using some other driver and not coded it here. Class.forName() will just instanciate the class specified as a "String classname" parameter to it. ------------------
I'll tear thee open make you gone No longer will you hurt anyone And the hate still shapes me So hold me until it sleeps
Metallica - Until It Sleeps
----- Original Message ----- From: "Pankaj Jangid" pankaj_jangid@yahoo.com To: "Linux Users Mumbai" linuxers@mm.ilug-bom.org.in Sent: Thursday, February 21, 2002 8:00 PM Subject: [ILUG-BOM] ODBC DSN Configuration
_________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
On Sat, Feb 23, 2002 at 12:01:55AM +0530, Kunal Gangakhedkar wrote:
You don't need to change your Class.forName() statement in any case - unless you're using some other driver and not coded it here. Class.forName() will just instanciate the class specified as a "String classname" parameter to it.
In case I want to use JDBC instead of JDBC-ODBC bridge then I have to change the parameter i.e. the string to the call Class.forName().
Now my next query is do I need to change some more statements or the above change will suffice ?
regards
Well, As far as I know, once you initialize your driver with Class.forName(), you use DriverManager.getConnection() to establish/activate the connection with the DB, passing the URL of the DB as a string to getConnection(). In that case, you don't need to change any other statements as this is a generic way of establishing connections.
What the documentation says is : "When the method getConnection is called, the DriverManager will attempt to locate a suitable driver from amongst those loaded at initialization and those loaded explicitly using the same classloader as the current applet or application. "
There are two more ways of connecting to the DB given in the documentation of DriverManager class. Check them out for more details.
But still, the JDBC-ODBC Bridge provides much more flexibility (at a price, though), hence, I prefer the Bridge drivers.
Kunal
PS : One sincere request : Pls. don't send mails as attachments, rather send them as inline text. ------------------
My eyes seek reality My fingers seek my veins Theres a dog at your back step He must come in from the rain I fall cause I let go The net below has rott away So my eyes seek reality And my fingers seek my veins
Metallica - Low Man's Lyric
----- Original Message ----- From: "Pankaj Jangid" pankaj_jangid@yahoo.com To: linuxers@mm.ilug-bom.org.in Sent: Saturday, February 23, 2002 9:57 AM Subject: Re: [ILUG-BOM] ODBC DSN Configuration
_________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com