Results 1 to 2 of 2
  1. #1
    Matko is offline Member
    Join Date
    Feb 2012
    Location
    Slovenia
    Posts
    8
    Rep Power
    0

    Default SQLite database at FTP server, accessing

    I wrote in "New To Java" part of this forum and got no answer so far. I'm sorry if I'm being annoying but I need to solve this asap. Whole my project stopped at this point and cannot continue as all I have to do to make everything work is connect database. Localy everything worked great but problem is how to get access to ftp server.

    This are my posts:
    Quote Originally Posted by Matko View Post
    Hey

    My first post here and I hope not the last one. Well short explenation what is my problem. So far I know how to make connection with a SQLite DB, do with sql statements and so on. Now the problem is that I wrote a program that store certain informations in this database while file is stored next to program location (or anywhere on disk, it doesn't matter as I know how to set path to it) but company that want to buy this program have two locations and I want to move DB on ftp server so both can access it at the same time.

    I know that SQLite DB can have only one connection at a time so I also add timeout at 30s. In case one client is accessing from one location, in worst case scenario the connection will not be open for more than 10s, so this problem is eliminated. Now, each row in DB is changed 2 times and then locked for reading only.

    My questions are:
    1. What is the best way to access DB? I was thinking about this steps: download DB(file), edit it and then upload back again. That would make DB faster as it would be saved localy for editing, but what if in the same time another client want's to write into it? Then I have a problem as some work will be lost due to overwrite.
    2. How time consuming is leaving DB at server and accessing it via ftp? Also how can I make this happen in program? Any reference to a good example or explenation would be welcome.
    3. Is it possible to connect with program login, to know which client inserted which row?

    If you need any more explenation I can give you but please, I have a deadline soon so I'm kinda tight with time.

    Thanks!
    Quote Originally Posted by Matko View Post
    Ok let's try with something I wrote so far:
    private static final String DRIVER = "org.sqlite.JDBC";
    private static final String user="username";
    private static final String pass="pass";
    private static final String url = "jdbc:sqlite:ftp://username:pass@server.com/temp/database.db:21";
    private static final int iTimeout = 30;
    private static Connection conn = null;
    private static Statement stat = null;

    Then in methods I create connection like that:
    Class.forName(DRIVER);
    conn = DriverManager.getConnection(url);

    I catch exception and I get this:
    java.sql.SQLException: path to 'ftp://username:pass@@server.com/temp/database.db:21': 'E:\NetBeans workspace\PotniNalogi\ftp:' does not exist

    This is my local folder:
    E:\NetBeans workspace\PotniNalogi\ftp:
    and I don't understand why this is pointing to local folder. Is it because of "@" that break the link?
    Thanks for taking your time to at least read it through

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default Re: SQLite database at FTP server, accessing

    Don't double post. I'm closing this thread and shall move the other thread to this forum.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. SQLite database at FTP server
    By Matko in forum JDBC
    Replies: 11
    Last Post: 02-14-2012, 09:42 AM
  2. JSON Array Loop Inserting into Android SQLite Database
    By viviosoft in forum New To Java
    Replies: 6
    Last Post: 09-26-2011, 10:34 AM
  3. Replies: 12
    Last Post: 08-26-2010, 10:14 AM
  4. Replies: 1
    Last Post: 12-18-2009, 01:16 AM
  5. Accessing database through applet
    By sukatoa in forum Java Applets
    Replies: 1
    Last Post: 07-08-2008, 03:49 PM

Posting Permissions

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