aspose file tools*
The moose likes JDBC and the fly likes database programming Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "database programming" Watch "database programming" New topic
Author

database programming

Tosin Michael
Greenhorn

Joined: Mar 18, 2013
Posts: 4
Please, I want my java desktop application and php dynamic website to share the same online database. Especially a mysql database hosted online.
I want to embark on a project where I'd install my java desktop application on several systems and they can all access mysql database online.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
The Java app would use the JDBC API, which comes with the JRE. The only thing you would need to ship with the app are the JDBC drivers for MySQL (which you can find here).


Ping & DNS - my free Android networking tools app
Tosin Michael
Greenhorn

Joined: Mar 18, 2013
Posts: 4
Hhmmn..Thank you so much. But I'm still not very clear. I have been using netbeans to connect my java desktop app to WAMP MySql database on localhost and now I want to connect to Wamp mySql on a web server (ie.hosted online, in a remote server). How can I do that please..How can I connect my java desktop app to my php website's online database in netbeans.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
NetBeans is an IDE - it plays no role during runtime.

So you want to connect to a DB that's not somewhere on a local network, but somewhere across the internet? Then JDBC is generally discouraged due to security concerns.
Tosin Michael
Greenhorn

Joined: Mar 18, 2013
Posts: 4
So how can I go about it? Though I'm not so partcular about security for now because the contents of my online database will be uninteresting to a malicious user
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3611
    
  60

Malicious users tend to hack or destroy things just for the fun of it. Be sure to have a tested backup process in place, and not to put sensitive (ie. personal) data in the database.

The proper way would be to set up an application server (placed behind a firewall). The desktop application would call the business logic stored on the application server (probably using webservices), and the app server would connect to the database. So there would not be a direct connection from the app to the database and the firewall would not allow connections to the DB from the internet. (The app server would also check the privileges of the current user on each call, so that an unauthorized person cannot circumvent these checks by calling the webservice directly.)

And since you'd have an application server, you could use WebStart to deploy the application, alleviating the need for a separate deployment process.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39828
    
  28
And welcome to the Ranch
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8207
    
  23

Martin Vajsar wrote:Malicious users tend to hack or destroy things just for the fun of it...

<nitpick>
Those nefarious bottom-feeders are actually called 'crackers'. Hackers are the good guys.
</nitpick>

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: database programming