Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

drivers

 
Rahul Shilpakar
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
exactly , when to use java thin driver for connectivity? i mean to say how it differs from jdbc odbc? thanks
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm guessing you are talking about Oracle's thin driver?

Sun's JDBC-ODBC bridge is a type 1 driver. All the driver does is provides a connection to ODBC functionality supplied by the client machine the driver is installed on. As such it requires ODBC software is installed on the client machine. It also only supports a sub-set of the JDBC API functionality.

Oracle's thin driver is a type 4 driver. This type of driver talks directly to the database via some protocol (e.g. TCP/IP). As such it doesn't require anything else be installed on the client machine.

Have a look at the JDBC guide supplied by Sun.
[ September 08, 2006: Message edited by: Paul Sturrock ]
 
Rahul Shilpakar
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.

can we say jdbc odbc a third party driver
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not really. The vast majority of drivers were not written by Sun, so they are almost all third party drivers. Better to call it a "type 1" driver, since that is the term used in the JDBC specification, so is the term most likely to be understood by others.
 
Nelson Nadal
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,
Does this mean that connection from client/server application is really quite different from web based application?

Is that why in client/server(J2SE) they only used the 'DriverManager' class (though I know its also used in J2EE)
while in web based (J2EE) they used the 'DataSource' for connection pooling?

Forgive me, if my question is a little confusing. I just dont know WHEN and WHERE to use the second one 'DataSource.. InitialContext..'

Thanks.
 
emm raha
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nelson:

You should use the JDBC/ODBC bridge when multiple connections are not required. Multiple instances of your application can create and close connections using the bridge, but this is far less efficient than using a connection pool.

The third party database drivers (e.g. Oracle, MySQL) adhere to the JDBC spec provided by Sun, which enables them to abide by a single contract across multi-vendor application servers (e.g. JBoss, Websphere). If your J2SE application enabled pooling as per the JDBC spec, it too could use Oracle's thin driver.

If your (web) application is hosted on a application server, you can retreive the datasource using the JNDI initial context (thereby leaving the pooling work up to the app server).

HTH
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic