File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to connect Oracle with Java

 
Daniel William
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am completely new to Oracle with basic sql plus knowledge. I have installed Oracle 10g Release 2 and java 1.6 .
All i want to do is to connect Oracle with Java so that i can send queries and retrieve results. I found that we need a jdbc driver
and a odbc driver for connecting. How can i get them and how to install ? Or should i use another type of driver ?
Does Oracle have a server ?if yes , should I use it for accessing the database?

Can someone explain?

Thanks in advance.

 
Fatih Keles
Ranch Hand
Posts: 182
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daniel William wrote:I found that we need a jdbc driver
and a odbc driver for connecting. How can i get them and how to install ? Or should i use another type of driver ?

Oracle also distributes jdbc drivers : Oracle Jdbc Drivers
Daniel William wrote:
Does Oracle have a server ?if yes , should I use it for accessing the database? Can someone explain?

What kind of server do you expect? Do you mean a bundled application server with 10gR2 database setup? Please state it clearly. But in order to connect to database within your java code you don't need any server. Just have your database and tns listener running and follow any jdbc tutorial if necessary. This might be helpful for oracle specific how-to's : JDBC How-To Documents

Regards,

Fatih.
 
Daniel William
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok.i understood that i dont need a server to connect oracle with java.

i have created an Oracle database .

i have a java program which uses jdbc -odbc driver set for connecting it with Oracle.

there are 4 types of jdbc drivers . only one type can be used for connecting with odbc driver.
which type should i use and how can i configure it to work with odbc.?

i am just using a stand alone Java application program.

 
Fatih Keles
Ranch Hand
Posts: 182
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you use jdbc thin driver? Why are you using odbc? Is it on purpose?

Regards,

Fatih.
 
Daniel William
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its because i have used it in our lab session. i didnt have this difficulty of installing ,as it was set and configured by our admin.
i also did all programs using this driver set.
so to switch to thin driver i need learn about its syntax in java.

now whats the use of thin driver ? is it the right one for simple java programs?

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To turn your question on its head: what is the use of the JDBC-ODBC bridge? It is (by Sun's own admission) not what you would call a first choice for JDBC. If there is a vendor specific equivalent is is much easier to just use that.

The Orcale thin driver is a type 4 driver, so you need no extra configuration. I would always use it when working with Oracle.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic