hi all i am a newbie on java i am making a desktop application which does various database operations and it has a gui what i want to do is to make another copy of the program which does limited operations (no inserting or deleting for example) and the copy must read the database from the original application through internet or local network what do i need for this kind of application,is networking api sufficient? thanks for your interest
I'm not sure I understand the problem. You have two programs that connect to a database (presumably using JDBC in some form); the first one to read and write, the second read-only. Is that correct? If so, can't the second one connect to the DB in the same way as the first?
Having said that, I wouldn't open up a database for straight JDBC access over the internet. I'd probably use an intermediate server that proxies the requests, and also takes care of encryption.
As an aside, please use punctuation like you would normally in written communication; this isn't IRC or IM. It's much easier to understand (and you do want to make it easy to understand for other people, so that they're in a better position to help you).
Sorry for the punctuation. The first program has Mysql in it and databases i made(used jdbc for java ) but I don't want to install Mysql on the second machine, rather i would like to make data transfer between first and second machine through internet or local network. Thank you again.
Are the programs on the first and second machine the same program? Or basically do the same thing?
If so, you can use one program. The first one can connect to the database via localhost and the second one via the network. So you can use the same program. You can even pass in the same JDBC connection URL. But if you want to limit the one to read only, you can do that by using different database accounts. Se the one up to allow for inserts, updates, etc. And the other for selects only.
As for the Networking API, you will not need to use this directly. When you construct a DataSource to connect to the database, you can use a URL in uts construction. That will then connect to the remote database.
So you can use the same code to connect. You could even pass the DB connection URL in as a startup parameter or have it in a properties configuration file. This would allow for it to be changes easily.
Does that solve your issue?
Joined: Aug 10, 2008
Ok, got it i havent tried it yet but url will probably solve my problem. Thank you everyone