Login | Register
My pages Projects Community openCollabNet

Discussions > users > Re: [maxq-users] DBUtil

maxq
Discussion topic

Back to topic list

Re: [maxq-users] DBUtil

Author christophe blin <cblin at tennaxia dot com>
Full name christophe blin <cblin at tennaxia dot com>
Date 2005-05-20 04:33:02 PDT
Message Hi,

I've clearly identify the problem. This is not a maxq or jython issue
but a java issue.
Here is the TestDB.java :
<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<
import java.sql.*;

public class TestDB{
    public static void main(String[] argv){
        try{
            Class.forName("org.g​jt.mm.mysql.Driver")​;
            Connection conn =
DriverManager.getCon​nection("jdbc:mysql:​//192.168.0.253:3306​/testlink",
"root", "");
           
            String sql = "select id from project where name='T2 :
Conformité : plan fonctionnel'";
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery(sql);
            String str = null;
            if (rs.next()) {
                str = rs.getString(1);
            }
            rs.close();
            stmt.close();
           
            System.out.println("projid: "+str);
        } catch (Exception e) {
            System.err.println("error"+e);
        }
    }
}
<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<
Compile it and run it under Linux. Ouput is:
projid: null

Run it under windows (the .class is compiled under Linux). Output is:
projid: null

Compile it and run it under Windows. Ouput is:
projid: 8

Run it under linux (.class is compiled under Windows). Output is:
projid: 8
<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<

So I do not know the reason nor the solution, but I have identified the
problem.

If someone has some informations about that problem, please let me know.

Regards,
chris

christophe blin wrote:

> Hi,
>
> I have a different behavior of DBUtil between Windows XP Pro and Linux
> (Fedora 3 or Mandrake 10).
> All the data (maxq + script) are under a fat32 visible from win xp and
> linuxes.
> The database is under another Fedora 3 @ 192.168.0.253
>
> Here is the code of test_dbutil.py (encoding: ISO-8859-15) :
> <<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<
> from com.bitmechanic.maxq import DBUtil
>
> db = DBUtil("org.gjt.mm.m​ysql.Driver",
> "jdbc:mysql://192.16​8.0.253:3306/testlin​k", "root", "")
>
> projid = db.loadVal("select id from project where name='T2 :
> Conformité : plan fonctionnel'")
> if projid == None:
> print "projid1:None"
> else:
> print "projid1:"+projid
>
> projid = db.loadVal("select id from project where name='T2 :
> Conformité : plan fonctionnel'")
> if projid == None:
> print "projid2:None"
> else:
> print "projid2:"+projid
> <<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<
> The ouput under windows xp pro (which is the expected output) :
> $> MaxQ\maxq-0.98\bin\maxq.bat -r test_dbutil.py
> 20 mai 2005 11:28:54 com.bitmechanic.maxq.Main runTests
> INFO: Running: test_dbutil.py
> projid1:None
> projid2:8
> 20 mai 2005 11:28:55 com.bitmechanic.maxq.Main runTests
> INFO: OK
> <<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<
> The ouput under Linux (Fedora 3 or Mandrake 10)
> $ ./MaxQ/maxq-0.98/bin/maxq.sh -r test_dbutil.py
> 20 mai 2005 11:25:12 com.bitmechanic.maxq.Main runTests
> INFO: Running: test_dbutil.py
> projid1:None
> projid2:None
> 20 mai 2005 13:25:12 com.bitmechanic.maxq.Main runTests
> INFO: OK
> <<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<<<<<​<
> Can someone explain me why there is a difference between the systems ?
> I think this is an encoding problem but I do not see where : the JVM
> is UTF8 under win and linux, the db does not change (so encoding of
> the db is not the problem),
> the jdbc driver is exactly the same...
>
> Regards,
> chris
>
> --------------------​--------------------​--------------------​---------
> To unsubscribe, e-mail: users-unsubscribe@ma​xq.tigris.org
> For additional commands, e-mail: users-help at maxq dot tigris dot org
>
>
>

--
____________________​____________________​____________________​____________________​_______
Tennaxia, www.tennaxia.com,
société de services auprès des entreprises industrielles pour une gestion globale de l'environnement
____________________​____________________​____________________​____________________​_______
Siège social :
6, rue Léonard de Vinci - 53001 Laval Cedex - Tél : 02 43 49 75 50 - Fax : 02 43 49 75 77
Agence Paris :
 47, rue Servan - 75011 Paris - Tél : 01 43 57 17 05 - Fax : 08 25 19 19 61
Agence Lyon :
Parc du Chater - 63 rue de la garenne - 69340 FRANCHEVILLE - Tél : 04 72 39 98 14 - Fax : 04 72 39 93 85

Les informations contenues dans ce message envoyées par TENNAXIA sont confidentielles et sont établies à l'attention exclusive de leurs destinataires. L'accès à ce message par toute autre personne n'est pas autorisé. Si vous n'êtes pas le destinataire de ce message, merci de le détruire et d'en avertir l'expéditeur : toute altération, copie, distribution ou toute action prise ou omise sont interdites et peuvent être illégales.
The information in this message sent by TENNAXIA is confidential and may be legally privileged. It is intended solely for the addressee(s). Access to this message by anyone else is unauthorized. If you are not the intended recipient, please delete it and notify the sender : any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.

« Previous message in topic | 6 of 11 | Next message in topic »

Messages

Show all messages in topic

RE: [maxq-users] problem building, can't find javac James Richards <James dot Richards at demandtec dot com> James Richards <James dot Richards at demandtec dot com> 2005-04-22 10:42:11 PDT
     Documentation: command line arguments christophe blin <cblin at tennaxia dot com> christophe blin <cblin at tennaxia dot com> 2005-05-18 08:31:03 PDT
         Re: [maxq-users] Documentation: command line arguments christophe blin <cblin at tennaxia dot com> christophe blin <cblin at tennaxia dot com> 2005-05-20 02:32:20 PDT
             Re: [maxq-users] Documentation: command line arguments oliverbock Oliver Bock 2005-05-24 00:41:16 PDT
         DBUtil christophe blin <cblin at tennaxia dot com> christophe blin <cblin at tennaxia dot com> 2005-05-20 02:44:17 PDT
             Re: [maxq-users] DBUtil christophe blin <cblin at tennaxia dot com> christophe blin <cblin at tennaxia dot com> 2005-05-20 04:33:02 PDT
                 Re: [maxq-users] DBUtil christophe blin <cblin at tennaxia dot com> christophe blin <cblin at tennaxia dot com> 2005-05-20 08:44:02 PDT
                     Re: [maxq-users] DBUtil saperski Marcin Cieslak 2005-05-20 10:07:09 PDT
                         Re: [maxq-users] DBUtil christophe blin <cblin at tennaxia dot com> christophe blin <cblin at tennaxia dot com> 2005-05-23 02:37:37 PDT
                             Re: [maxq-users] DBUtil saperski Marcin Cieslak 2005-05-23 14:06:30 PDT
                                 Re: [maxq-users] DBUtil christophe blin <cblin at tennaxia dot com> christophe blin <cblin at tennaxia dot com> 2005-05-24 02:14:30 PDT
Messages per page: