aspose file tools*
The moose likes JDBC and the fly likes How to create DSN programmatically? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to create DSN programmatically?" Watch "How to create DSN programmatically?" New topic
Author

How to create DSN programmatically?

Vidyadhar Hegde
Greenhorn

Joined: Oct 24, 2000
Posts: 11
Hi,
I am working on some application where I need to use the DSN for JdbcOdbc connection which is created manually. Now I want to make this programmatically. How do I go about this?
Please help me.
Thanks in advance.
Vidyadhar.
------------------
Vidyadhar Hegde
Greenhorn

Joined: Oct 24, 2000
Posts: 11
Hai,
Nobody is there to help me in creating the DSN programmatically
Looking for help.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Creating a dsn for odbc is a windows specific function. I don't think this is supported in java.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
narayan kulkarni
Greenhorn

Joined: Jan 31, 2001
Posts: 17
Yes its windows specific function but it would be some exe right, so if you find out the exe that creates the DSn then we have method called exec() in java.lang (refer the docs to find this method) to execute exe from a java program.
You also need to find out whether that exe accepts commandline parameters this you will be able to find if you execute the exe in dos mode..
Thats all you are ready to create dsn programatically.
Hope it makes some sense to you..
I tried to find the exe its rundll32.exe but I did not get any information on command line parameter. You need to find whether there is utility that runs in dos mode accepting parameters to create dsn..
Sorry about that
Please let me know.
[This message has been edited by narayan kulkarni (edited February 08, 2001).]
[This message has been edited by narayan kulkarni (edited February 08, 2001).]


Take up computer programming as fun and you will just enjoy it. Always keep in mind that in some way your program is going to make human life easier.
Vidyadhar Hegde
Greenhorn

Joined: Oct 24, 2000
Posts: 11
Thank you, Kulkarni.
I'll try to find details about the rundll32.exe. Hope I'll get it.
Vidyadhar Hegde
Greenhorn

Joined: Oct 24, 2000
Posts: 11
Thank you for the Reply, Paul
If it is not supported by Java then, if you don't mind, can you tell me what is the solution for this problem.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
There already is a program set up to create ODBC connections in Windows.
I have a feeling that the program can not be run from the command line. If I recall, it has way too many parameters to be entered.
amit shukla
Ranch Hand

Joined: Oct 25, 2000
Posts: 45
You can us windows sdk to create a dll for the above functionality n then use dll through JNI calls...
try using SQLConfigDataSource() method of ODBC API ...
hope this solves ur problem ... if u found any other way do reply back...
Bye
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to create DSN programmatically?