wood burning stoves 2.0*
The moose likes JDBC and the fly likes ODBC Connection through a batch file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "ODBC Connection through a batch file" Watch "ODBC Connection through a batch file" New topic
Author

ODBC Connection through a batch file

Chase Becicka
Greenhorn

Joined: Feb 16, 2004
Posts: 23
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

Joined: May 26, 2003
Posts: 30580
    
154

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Chase Becicka
Greenhorn

Joined: Feb 16, 2004
Posts: 23
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

Joined: May 26, 2003
Posts: 30580
    
154

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.
 
GeeCON Prague 2014
 
subject: ODBC Connection through a batch file