Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create DSN programmatically?

 
Vidyadhar Hegde
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,
Nobody is there to help me in creating the DSN programmatically
Looking for help.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Creating a dsn for odbc is a windows specific function. I don't think this is supported in java.
 
narayan kulkarni
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Vidyadhar Hegde
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Kulkarni.
I'll try to find details about the rundll32.exe. Hope I'll get it.
 
Vidyadhar Hegde
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic