Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection through DSN

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although I have got two methods of JDBC connection (thin and oci8) but can't try it now and don't want to take any risk, so asking for one more method.

Through DNS:
-----------

When we create DSN, we have to give value for four items:

1] DSN Name = dsn1
2] DSN Description = dsn2
3] Service Name = dsn3
4] User Name = dsn4

Suppose I have given values as per I wrote above, then what would be the code for DB connection:



Please help me in Driver Name and URL. And if any JAR or ZIP file, we have to take in classpath, then please tell me the name of that.

Thanks a lot.


[ November 17, 2005: Message edited by: rathi ji ]
[ November 17, 2005: Message edited by: Bear Bibeault ]
 
Vikramjit Singh
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You can put it like this

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc dbc SN","username","password");
Ststement stmt = con.createStatement();

<for win2000pro>
DSN is the name that you made in programs->settings->control panel->Administrative tools->Data Sources(ODBC)
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will it be like this:



No need for DSN description, Service name and User name?, can I give any thing in these fields?

Please reply.

Thanks a lot.
[ November 17, 2005: Message edited by: rathi ji ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"VJS",
we take the rule on display names quite seriously.

Your display name was originally valid, now it is not. Please change it back immediately, since accounts with invalid display names get deleted. Often without warning.

thanks,
Dave.
 
Vikramjit Singh
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
Yes it is like that :---

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbcdbcSN","username","password");
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Vikramjit.

And here 'DSN' is DSN Name, that is dsn1 in my case.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic