Results 1 to 9 of 9
  1. #1
    UJJAL DHAR is offline Senior Member
    Join Date
    Apr 2010
    Location
    Dhaka,Bangladesh
    Posts
    180
    Rep Power
    0

    Default Remote database + JAR

    I am created an desktop application (i.e An restaurent management system) which stores all sale informations on MySQL database.

    Now I want to store it on server i.e I will run my JAR file on my pc and the entered data should be stored on the MySQL on the server [offering remote database]

    Is it possible? If what should I do now?

    Thanks in advance
    Don't Forget to try yourself before asking others help.....
    Press REP, if you find their advices/solutions effective.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    Use JDBC to query, update, etc...the remote database:
    Lesson: JDBC Basics (The Java™ Tutorials > JDBC(TM) Database Access)

  3. #3
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    392
    Rep Power
    4

    Default

    I'm guessing you're currently connecting to your database through localhost or some such? If so, just change "localhost" to the IP-address or hostname your database provider gives you. That's all I had to do when I moved mine, at least.

    If you want to transfer the data from your local database to the database on the server, you could always create two database-connections and move it that way.

  4. #4
    UJJAL DHAR is offline Senior Member
    Join Date
    Apr 2010
    Location
    Dhaka,Bangladesh
    Posts
    180
    Rep Power
    0

    Default

    I'm guessing you're currently connecting to your database through localhost or some such? If so, just change "localhost" to the IP-address or hostname your database provider gives you. That's all I had to do when I moved mine, at least.

    If you want to transfer the data from your local database to the database on the server, you could always create two database-connections and move it that way.
    Yes, Now I am using localhost. Okay, I will try it and If I fail, I will come back here.

    Thanks
    Don't Forget to try yourself before asking others help.....
    Press REP, if you find their advices/solutions effective.

  5. #5
    UJJAL DHAR is offline Senior Member
    Join Date
    Apr 2010
    Location
    Dhaka,Bangladesh
    Posts
    180
    Rep Power
    0

    Default

    I'm guessing you're currently connecting to your database through localhost or some such? If so, just change "localhost" to the IP-address or hostname your database provider gives you. That's all I had to do when I moved mine, at least.
    I have created a database and needed tables on it. In my JAVA code I have replace the host name like this.
    Java Code:
    m_Driver ="com.mysql.jdbc.Driver";
    m_Url = "jdbc:mysql://mysql13.000webhost.com:3306/a7312346_shop";
    But, My code is not working. I can't access the database from the desktop.

    Note: I am using a free hosting,may be there is problem on remote database access???

    Will you please help me?
    Don't Forget to try yourself before asking others help.....
    Press REP, if you find their advices/solutions effective.

  6. #6
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    392
    Rep Power
    4

    Default

    What I'd suggest you do is to try to connect from another program and see if that works (personally I use the MySQL tools). If you can connect through those tools, then it's your Java-code that's at fault. If you can't, then it's something else (wrong address, wrong port, firewall-issues, etc).

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,945
    Rep Power
    19

    Default

    Quote Originally Posted by UJJAL DHAR View Post
    I have created a database and needed tables on it. In my JAVA code I have replace the host name like this.
    Java Code:
    m_Driver ="com.mysql.jdbc.Driver";
    m_Url = "jdbc:mysql://mysql13.000webhost.com:3306/a7312346_shop";
    But, My code is not working. I can't access the database from the desktop.

    Note: I am using a free hosting,may be there is problem on remote database access???

    Will you please help me?
    Is that db opened up to accept connections from your machine?
    Many hosts don't allow for that, and those that do don't open it up as standard (for understandable reasons), meaning you need to use your control panel to allow connections from your IP.

  8. #8
    UJJAL DHAR is offline Senior Member
    Join Date
    Apr 2010
    Location
    Dhaka,Bangladesh
    Posts
    180
    Rep Power
    0

    Default

    Yaa, I am using the host is not supporting remote access which I have mentioned before.I got that I need an premium account to check my project.

    Anyway thanks..
    Don't Forget to try yourself before asking others help.....
    Press REP, if you find their advices/solutions effective.

  9. #9
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    If the host doesn't allow for remote connections, you could get around this by wrapping the database with something local like a php, asp, or other server side script that calls the db for you. You then query that page and parse its output (care should be taken with this route however - the permissions it has and what it actually does as there are malicious folk out there wishing to use a backdoor like this to do something you don't want them to).

Similar Threads

  1. Replies: 3
    Last Post: 12-01-2011, 06:40 AM
  2. How to access Remote Database over internet
    By surya86mca in forum New To Java
    Replies: 3
    Last Post: 03-28-2011, 10:59 AM
  3. unable to connect remote database using jdbc
    By enggvijaysingh@gmail.com in forum Advanced Java
    Replies: 1
    Last Post: 12-16-2010, 12:16 PM
  4. Replies: 4
    Last Post: 04-28-2010, 06:13 PM
  5. Remote deploy and remote work with JBoss AS
    By chalda in forum Eclipse
    Replies: 2
    Last Post: 03-08-2010, 11:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •