• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ODBC Connection through a batch file

 
Chase Becicka
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just have a question with know wheather or not you can get your java program to run a batch file that will hook up an Access or SQL server database in your program

For Example

run file setup.bat

So basically I want the ODBC connection to be established through the running of a method on the program so if a user is taking my app he can just click it open on for the first time on his comp, then the connection is just their assuming hes running Access or SQL Server

Any help would be greatly appriciated and if you need me to restate the problem please ask
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34073
335
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chase,
I'm not sure if I understand the question, so if this doesn't answer it let me know.

Are you trying to run a batch file from java? If so, use Runtime.exec().
Are you trying to run java from a batch file? If so, use the java command.
Are you trying to share objects between the batch file and java? If so, this can't be done.
 
Chase Becicka
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to run a batch file from a method in java? so would the Runtime.exec().work???
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34073
335
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chase Becicka:
I'm trying to run a batch file from a method in java? so would the Runtime.exec().work???

Yes. Runtime.exec() runs an operating system command. In this case, the operating system command is the batch file name.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic