Nirav Bhatia
Nirav Bhatia

Reputation: 1033

Connecting to a database on another machine through Java application

If a java desktop application from a client machine needs to connect to a database on an external central server (on another machine), kind of like a php script that can connect from a browser on the client machine to a database, how would that be accomplished? I know that you can use JDBC, but wouldn't the person who's running the desktop application need mysql connector/j driver installed on his/her computer?

Upvotes: 1

Views: 1238

Answers (2)

Mike Deck
Mike Deck

Reputation: 18397

As long as you bundle the appropriate JDBC driver (usually a jar) with the application and make sure it's on the runtime classpath everything should work. There is no "installation" of the driver separate from having the appropriate classes on the application's classpath.

Upvotes: 2

Dave Newton
Dave Newton

Reputation: 160181

Of course: if an application is using JDBC to connect to a DB they'll need the appropriate JDBC driver.

Most applications already have a set of library dependencies; it would just be another one.

Upvotes: 1

Related Questions