• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I am not able to create DSN

 
sagar shiraguppi
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
please let me know why I am not able to create DSN in my laptop. Here are the steps I performed to create a DSN.
Go to control panel-->Admin tool-->data Sources(ODBC)-->then select Add button, and I am selecting Microsoft ODBC for oracle driver, but I am getting these error there itself.
The error is :
The oracle client and networking components were not found.....................
You will be unable to use this driver until these components have been installed.






I am installed oracle 10g and its working fine independently.
Please let me know what should be done.

Thanks in advance.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you need a DSN if you are using Oracle?
 
sagar shiraguppi
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Paul

This is the program i am practicing ....


package jdbc_progs;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class SimpleJdbcDemo {
public static void main(String[] args) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection connection = DriverManager.getConnection("jdbcdbc:sagar", "scott", "tiger");
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM dept");

while (resultSet.next()){
System.out.print(resultSet.getInt(1)+"\t");
System.out.print(resultSet.getString(2)+"\t");
System.out.println(resultSet.getString("loc"));
}

} catch (ClassNotFoundException cnfe) {
cnfe.printStackTrace();
}
catch (SQLException sqle) {
sqle.printStackTrace();
}

}

}

 
sagar shiraguppi
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not able to create DSN called sagar there which is I am passing in URL of Class.forName.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why use the JDBC-ODBC bridge with Oracle? Unless you are using MS Access there is no need to use this, and it is recommended you don't. Instead try using Oracle's own type-4 driver.
 
sagar shiraguppi
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Paul
I am beginner of JDBC.
I am not able to search type 4 driver as you said in the list there.

Could you please let me know some more details.
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read this link
http://www.tutorialspoint.com/jdbc/jdbc-driver-types.htm

Which Driver should be used?
If you are accessing one type of database, such as Oracle, Sybase, or IBM, the preferred driver type is 4.

If your Java application is accessing multiple types of databases at the same time, type 3 is the preferred driver.

Type 2 drivers are useful in situations where a type 3 or type 4 driver is not available yet for your database.

The type 1 driver is not considered a deployment-level driver and is typically used for development and testing purposes only.



Thanks
Shanky
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sagar shiraguppi wrote:@Paul
I am beginner of JDBC.
I am not able to search type 4 driver as you said in the list there.

Could you please let me know some more details.


The link supplied above is good. And you'll find out more here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic