• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ODBC and JDBC!!!

 
Brian Smith
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i also have the same problem understanding the situation.pls someone explain this.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Brian Smith
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ahamed
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic