Two Laptop Bag
The moose likes JDBC and Relational Databases and the fly likes what is dsn?user dsn?system dsn?file dsn? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "what is dsn?user dsn?system dsn?file dsn?" Watch "what is dsn?user dsn?system dsn?file dsn?" New topic

what is dsn?user dsn?system dsn?file dsn?

Dinesh Jayaraj

Joined: Nov 19, 2000
Posts: 23
hello friends
1> iam totaly confused with dsn?
what does it do?what is file dsn? system dsn? and user dsn?
why we should set them before connecting to db.
2>the method Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
will load the driver(jdbcdbc)actually from where it is
loaded wheather from jdk or windows os.
3>in jdbc url like jdbcdbc:xyz
wheather xyz is a dsn or a database name?
if it is dsn how it will resolve the
actual table name when we query the the url we have to give userid
and password wheather theese userid and password corresponds to db or dsn?.
help please

[This message has been edited by Thomas Paul (edited December 11, 2000).]
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") will load the class JdbcOdbcDriver if it finds it on the classpath.
The dsn is one of two things:
1) It is the ODBC name of the database. That is, the name you defined when you set the database up in odbc.
2) The actual URL of the database, specifying the server ip address, the port number, and the database name.
Hope this clarifies things for you.
[This message has been edited by Thomas Paul (edited December 11, 2000).]

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Matthew Roth

Joined: Jan 30, 2001
Posts: 19
How can you access a database without using an dsn? I want to tell it to find the database in the same folder as where the program resides.
thanks for your help
I agree. Here's the link:
subject: what is dsn?user dsn?system dsn?file dsn?
It's not a secret anymore!