TotalCross Forums
September 10, 2010, 06:33:04 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: TotalCross - the heaven of mobile application development
 
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Compile JDBC conector to SQLITE in TotalCross  (Read 1277 times)
sgilito
Guest
« on: December 16, 2009, 11:44:58 pm »


Hi ,

I'm trying to implement JDBC connect to SQLite but I don´t know how to compile the JDBC sources in TotalCross.

CLASPATH=C:\totalcrossSDK\dist\tc.jar; c:\LitebaseSDK\dist\litebase.jar;C:\totalcrossSDK\dist\sqlitejdbc-v056.jar

My example funtion OK for Win32, but I try to deploy to PPC or Palm and get the message:


java tc.Deploy CotMet99.class -all

---------
Class: GridShow
Method: FillGrid
z.aR: Class 'java.sql.DriverManager' is not available at the device! To see the
available classes, see the Javadocs for totalcross.lang package. Be aware that t
he classes and methods you use from the java.lang package at desktop are automat
ically transformed by tc.Deploy into the classes and methods available in totalc
ross.lang. Thus, you must use only the classes and methods described in the java
docs.
        at z.I.a(Unknown Source)
        at z.I.b(Unknown Source)
        at z.I.a(Unknown Source)
        at z.dA.a(Unknown Source)
        at z.fD.<init>(Unknown Source)
        at z.fD.a(Unknown Source)
        at z.fD.a(Unknown Source)
        at tc.Deploy.<init>(Unknown Source)
        at tc.Deploy.main(Unknown Source)
################################################################################

Can you help me please....
Logged
guich
Administrator
Sr. Member
*****
Posts: 471



View Profile WWW Email
« Reply #1 on: December 19, 2009, 07:47:41 am »

Isn't the message self-explanatory?
Logged
sgilito
Guest
« Reply #2 on: December 20, 2009, 07:18:13 pm »

I'm Sorry I'll try to explain:

I want to use JDBC connector to SQLite.

I have installed Eclipse with TotalCross SDK 1.15

My Project in win32 "CotMet99" include user libs like tc.jar, litebase.jar and sqlitejdbc-v056.jar

In my project include code to use SQLite like:
    public void FillGrid(){
        try  {
              grid.removeAllElements();
              Class.forName("org.sqlite.JDBC");
           Connection conn = DriverManager.getConnection("jdbc:sqlite:movilife.db");
           Statement stat = conn.createStatement();
           ResultSet rs = stat.executeQuery("select * from ocupaciones_exp where ocupacion like '%"+ed1.getText()+"%'");
           r1=0;
              while ( rs.next()) {
               items[r1][0]=new String(rs.getString(1));
               items[r1][1]=new String(rs.getString(2));
               items[r1][2]=new String(rs.getString(3));
              grid.add(items[r1]);
              r1=r1+1;
            }
...
}
This code function OK for Win32 but when I try to deploy to any platform (PPC, Palm, BB, etc) using the next instruction:

java tc.Deploy CotMet99.class -all

I get the message:

Class: GridShow
Method: FillGrid
z.aR: Class 'java.sql.DriverManager' is not available at the device! To see the
available classes, see the Javadocs for totalcross.lang package. Be aware that t
he classes and methods you use from the java.lang package at desktop are automat
ically transformed by tc.Deploy into the classes and methods available in totalc
ross.lang. Thus, you must use only the classes and methods described in the java
docs.
        at z.I.a(Unknown Source)
        at z.I.b(Unknown Source)
        at z.I.a(Unknown Source)
        at z.dA.a(Unknown Source)
        at z.fD.<init>(Unknown Source)
        at z.fD.a(Unknown Source)
        at z.fD.a(Unknown Source)
        at tc.Deploy.<init>(Unknown Source)
        at tc.Deploy.main(Unknown Source)
##############################

All The code generated under the install dir doesn´t function. I think this is because I need to include sqlitejdbc-v056.jar in a correct way to work with TotalCross.

When I deactivate the code that use SQLite my project function OK in all platforms (PPC, Palm, applet, win32)

How can I use JDBC connector to SQLite in TotalCross and all Supported platforms ?

Thanks in advance.
Logged
guich
Administrator
Sr. Member
*****
Posts: 471



View Profile WWW Email
« Reply #3 on: December 22, 2009, 07:03:09 am »

The answer to your question is written here:

"Class 'java.sql.DriverManager' is not available at the device! To see the
available classes, see the Javadocs for totalcross.lang package. Be aware that t
he classes and methods you use from the java.lang package at desktop are automat
ically transformed by tc.Deploy into the classes and methods available in totalc
ross.lang. Thus, you must use only the classes and methods described in the java
docs."

Read it and you will understand why what you're doing is impossible to work.
Logged
sgilito
Guest
« Reply #4 on: December 22, 2009, 01:56:13 pm »

I understood that I can't use it.

I have de source code for sqlitejdbc-v056.jar classes.

Is there a way to compile this source code and include it in my project ? ( May be like an user lib).

Regards.
Logged
guich
Administrator
Sr. Member
*****
Posts: 471



View Profile WWW Email
« Reply #5 on: December 22, 2009, 10:18:44 pm »

Do you have the sources for java.sql.DriverManager?
Logged
sgilito
Guest
« Reply #6 on: December 23, 2009, 09:11:46 pm »

No, I don´t have sources for java.sql.DriverManager.

I just have sqlitejdbc-v056-src.tgz downloaded from http://files.zentus.com/sqlitejdbc/

Any idea to include this sqlitejdbc code in TotalCross Applications ?

Regards.

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!