Results 1 to 7 of 7
  1.    #1  
    Hi,

    i'm writing a java programm to import contacts from a cvs file to the palm database. But if i insert a row a get an exception:

    Code:
    java.sql.SQLException: no such collation sequence: LOCALIZED_SECONDARY
    	at org.sqlite.DB.throwex(DB.java:288)
    	at org.sqlite.NestedDB.prepare(NestedDB.java:115)
    	at org.sqlite.DB.prepare(DB.java:114)
    	at org.sqlite.PrepStmt.<init>(PrepStmt.java:37)
    	at org.sqlite.Conn.prepareStatement(Conn.java:231)
    	at org.sqlite.Conn.prepareStatement(Conn.java:224)
    	at org.sqlite.Conn.prepareStatement(Conn.java:213)
    	at de.bs.test.Import.insertContact(Import.java:72)
    	at de.bs.test.Import.main(Import.java:48)
    I think i have to use sqlite3_palm_extension.so somehow to get the right collation.

    Any ideas how? I use sqlitejdbc-v056.jar as driver.

    Thx
  2. #2  
    I read on another thread that you can't load external libraries with the jala sqlite driver :S

    Maybe you could try and run it over a shell script, I'm researching on the messaging and call history also
  3. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #3  
    It can be done, but you'd need a different sql java wrapper other than the one that comes stock on the Pre.

    With the sqllite-jdbc java wrapper in order to use load_exension('...') funtion, you have to use org.sqlite.SQLiteConfig to enable load extension, since load_extension('..') is disabled in default. Then, pass the result of config.toProperties() when creating a connection.

    thusly, ...

    Code:
    SQLiteConfig config = new SQLiteConfig();
    config.enableLoadExtension(true);
    
    Connection connection =
            DriverManager.getConnection("jdbc:sqlite:", config.toProperties());
            Statement statement = connection.createStatement();
            statement.execute("select load_extension('/usr/lib/sqlite3_palm_extension.so')");
            ResultSet rs = statement.executeQuery("select * from com_palm_pim_Person');
            while(rs.next())
            {
                // read the result set
                System.out.println("half = " + rs.getInt(1));
            }

    Palm Pre Backup Utility...done!
    Locate Pre....done!
  4. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #4  
    On the other hand,..... Logic dictates that since the collation_sequence LOAD_SECONDARY is already implemented in various tables that it had to have been implemented using the stock SQLJDBC wrapper found in webOS....

    So there has to be a function/method to implement that collation sequence. Some investigation reveals that the class org.sqlite.DB has a method called load_extension.... however it's properties/attributes aren't obvious and it is also a private method and cannot be called externally.

    You would almost need a internal Palm Developer to divulge exactly how that method and/or collation sequence is implemented.

    Maybe some one who is better at reverse engineering sqlitejdbc-v053.jar can take this a little [or a lot] further than me.

    This may all be a moot point as it has been told to me that in a few updates to webOS, ... Java services will be obsolete.

    Palm Pre Backup Utility...done!
    Locate Pre....done!
  5.    #5  
    Thx for your reply

    I can find the class SQLiteConfig in my driver. Which driver do I have to use exactly? My java programm should not be executed on pre but on win/linux with an extracted database and extension file. Currently I'm using this driver by zentus.com.
  6. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #6  
    Interesting.

    Check out SQLiteJDBC – Xerial – Trac

    the driver from zentus may not have the SQLiteConfig class but it may have an equivalent class that performs the same function.

    Palm Pre Backup Utility...done!
    Locate Pre....done!
  7. #7  
    Quote Originally Posted by DrewPre View Post
    the driver from zentus may not have the SQLiteConfig class but it may have an equivalent class that performs the same function.
    I had pull the contacts.db to local mochine from a android mobile previos,then I codee some code to access this database file,but the program threw exception as follow:
    java.sql.SQLException:[SQLITE-ERROR]SQL error or missing database(no such collation sequence: PHONEBOOK)
    at org.sqlite.DB.throwex(DB.java:288)
    at org.sqlite.NestedDB.prepare(NestedDB.java:115)
    at org.sqlite.DB.prepare(DB.java:114)
    at org.sqlite.PrepStmt.<init>(PrepStmt.java:37)
    at org.sqlite.Conn.prepareStatement(Conn.java:231)
    at org.sqlite.Conn.prepareStatement(Conn.java:224)
    at org.sqlite.Conn.prepareStatement(Conn.java:213)
    at SQLiteTest.Import.insertContact(Import.java:72)
    at SQLiteTest.Import.main(Import.java:48)

    And then,I've coded a program on android platform to access the contacts infomation, the program could read all the contacts infomation normally.

    dear brother upstairs,please help me to deal with this problem..
    thanks.

Posting Permissions