aspose file tools*
The moose likes JDBC and the fly likes ODBC and JDBC!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ODBC and JDBC!!!" Watch "ODBC and JDBC!!!" New topic
Author

ODBC and JDBC!!!

Brian Smith
Ranch Hand

Joined: Oct 26, 2002
Posts: 232
hi folks,
i saw that i can connect to a database with ODBC(ie manking DSN) and also with JDBC.but what i can't see is that what circumstance requires to choose one over the other. could you please educate me with this?
thanks.
[ August 30, 2003: Message edited by: Namaste Sathi ]
T Rai
Greenhorn

Joined: Apr 16, 2002
Posts: 20
i also have the same problem understanding the situation.pls someone explain this.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

JDBC is for connecting to databases from Java; it requires a JDBC driver. If you're going to use Java, you need to use JDBC.
ODBC is for connecting to databases from other languages.
If a particular database supports ODBC, then to use it from Java, you've got to use an adapter or "bridge" -- a driver that translates JDBC calls into ODBC calls. There's a standard JDBC-ODBC bridge, and there are other commercial versions, as well.
There's never a point at which you need to choose between the two.


[Jess in Action][AskingGoodQuestions]
Brian Smith
Ranch Hand

Joined: Oct 26, 2002
Posts: 232
Thanks Ernest. I have a question though. could you please guide me how can i make a jdbc connection with MS-Access Database?
thanks.
Ghulam Rasool
Greenhorn

Joined: Aug 30, 2003
Posts: 4
If you are using pure JDBC u ll like to use the Type 4 drivers which are classes provided with the Db vendor( like e.g Oracle) U need to check out that wether the Access database have some drivers for that, as far as I know there arent any
Hope this helps please let me know about this
Guy A. Buyle
Greenhorn

Joined: Nov 07, 2002
Posts: 14
Hello,
You need first do the following :
Setting up your MSAccess driver (if you don't know how to):
>Control Panel
>Administrative tools
>Data Sources (ODBC)
>then push the <<Add>> button
>select Microsoft Access Driver (*.mdb) from the list, push the <<Finish>> button
>name the data source << ms_access >> without the <<>> obviously
>then in the Database section press the first button to the left (it's either called <<Find>> or <<Choose>>
>search your way to the folder where you unpacked (or created) your msaccess database file and you'll see it pop up in the window on the left of the folder window
>select it and it should then appear in the text field above called <<Database name>>
>click all the OK buttons until you're out of there.
salamath ahamed
Greenhorn

Joined: Aug 11, 2003
Posts: 7
hi
i think there is no need to create any dsn from control panel u can use the dsn-less connection as follows but u need to know the location of the database file in you system.just think that i am having my database file as "hello.mdb" in "c:\hello" folder then the connection string for this would be
Connection con = DriverManager.getConnection(jdbc dbc river={Microsoft Access Driver (*.mdb)}DBQ=c:\hello\hello.mdb);
but make sure that u give all the spaces correctly and the space between the word "Driver" and "(*.mdb)" is important.
hope u enjoy the code
bye


salamath
salamath ahamed
Greenhorn

Joined: Aug 11, 2003
Posts: 7
hi
i think there is no need to create any dsn from control panel u can use the dsn-less connection as follows but u need to know the location of the database file in you system.just think that i am having my database file as "hello.mdb" in "c:\hello" folder then the connection string for this would be
Connection con = DriverManager.getConnection(jdbc dbc river={Microsoft Access Driver (*.mdb)}DBQ=c:\hello\hello.mdb); but make sure that u give all the spaces correctly and the space between the word "Driver" and "(*.mdb)" is important.
hope u enjoy the code
bye
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ODBC and JDBC!!!
 
Similar Threads
what is JDBC???
SCEA mock question from Whizlabs
regarding JDBC-ODBC Bridge Driver
Direct Me To ODBC Driver Source
regarding JDBC ODBC bridge(native client code)