public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* Compiling with mysql
@ 2008-08-21 16:16 ezer
  2008-08-21 16:28 ` lorenzodevito
  2008-09-01 20:57 ` ezer
  0 siblings, 2 replies; 14+ messages in thread
From: ezer @ 2008-08-21 16:16 UTC (permalink / raw)
  To: java


I am triyng for a week to compile a project using mysql. I get all kind of
errors. 
i used mysql-connector-java-3.1.14-bin.jar,
mysql-connector-java-5.1.6-bin.jar and mysql-connector-java-5.1.6-bin.jar
I use something like that gcj --main=MyMainClass -o MyExec MyJar.jar
The MyJar i tryed to generate with all the java versions, 1.4, 15 and 1.6

I searched the net for info but i couldnt find anything...
-- 
View this message in context: http://www.nabble.com/Compiling-with-mysql-tp19092090p19092090.html
Sent from the gcc - java mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Compiling with mysql
  2008-08-21 16:16 Compiling with mysql ezer
@ 2008-08-21 16:28 ` lorenzodevito
  2008-08-21 19:20   ` ezer
  2008-09-01 20:57 ` ezer
  1 sibling, 1 reply; 14+ messages in thread
From: lorenzodevito @ 2008-08-21 16:28 UTC (permalink / raw)
  To: java

ezer wrote:
> I am triyng for a week to compile a project using mysql. I get all kind of
> errors. 
> i used mysql-connector-java-3.1.14-bin.jar,
> mysql-connector-java-5.1.6-bin.jar and mysql-connector-java-5.1.6-bin.jar
> I use something like that gcj --main=MyMainClass -o MyExec MyJar.jar
> The MyJar i tryed to generate with all the java versions, 1.4, 15 and 1.6
>
> I searched the net for info but i couldnt find anything...
>   
...something ???
...all kind of errors ???

??????????????????

paste the error output or a log in your email...please

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Compiling with mysql
  2008-08-21 16:28 ` lorenzodevito
@ 2008-08-21 19:20   ` ezer
  2008-08-21 20:28     ` Marco Trudel
  0 siblings, 1 reply; 14+ messages in thread
From: ezer @ 2008-08-21 19:20 UTC (permalink / raw)
  To: java


I am using JavaNativeCompiler from windows and also gcj form ubuntu

1) When i delete the references to com.mysql and the mysql lib from the
project, i can compile without problems.

2)
I tryed to include a class as sugested in some place:
public class ForceInclude {
	private static final Class class1 = com.mysql.jdbc.Driver.class;

	ForceInclude() {
	}
}


3) Compiling with JavaNativeCompiler from windows generating code only for
linux
"undefined reference to `java::util::Iterator*
java::sql::SQLException::iterator()"

4) Compiling the same file from ubuntu with gcj compiler containing lib 
libgcj-4.2.jar i get:
cannot find file for class java.sql.Connection
I looked inside the libgcj-4.2.jar and it doesnt have a directory with
java.sql folder, so i puted that directory from the jre

5) Compiling again from ubuntu but with modified libgcj-4.2.jar including
the sql package
com/mysql/jdbc/JDBC4ClientInfoProviderSP.java: In class
'com.mysql.jdbc.JDBC4ClientInfoProviderSP':
com/mysql/jdbc/JDBC4ClientInfoProviderSP.java: In method
'com.mysql.jdbc.JDBC4ClientInfoProviderSP.setClientInfo(java.sql.Connection,java.util.Properties)':
com/mysql/jdbc/JDBC4ClientInfoProviderSP.java:139: error: cannot find file
for class java.sql.SQLClientInfoException


I dont think that the right way is modifying the libs from the compiler,
there should be a better way, or there is some information that i dont know
now...

Thanks




Lorenzo De Vito wrote:
> 
> ezer wrote:
>> I am triyng for a week to compile a project using mysql. I get all kind
>> of
>> errors. 
>> i used mysql-connector-java-3.1.14-bin.jar,
>> mysql-connector-java-5.1.6-bin.jar and mysql-connector-java-5.1.6-bin.jar
>> I use something like that gcj --main=MyMainClass -o MyExec MyJar.jar
>> The MyJar i tryed to generate with all the java versions, 1.4, 15 and 1.6
>>
>> I searched the net for info but i couldnt find anything...
>>   
> ...something ???
> ...all kind of errors ???
> 
> ??????????????????
> 
> paste the error output or a log in your email...please
> 
> 

-- 
View this message in context: http://www.nabble.com/Compiling-with-mysql-tp19092090p19095165.html
Sent from the gcc - java mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Compiling with mysql
  2008-08-21 19:20   ` ezer
@ 2008-08-21 20:28     ` Marco Trudel
  2008-08-26 19:41       ` ezer
  0 siblings, 1 reply; 14+ messages in thread
From: Marco Trudel @ 2008-08-21 20:28 UTC (permalink / raw)
  To: ezer; +Cc: java

ezer wrote:
> I am using JavaNativeCompiler from windows and also gcj form ubuntu
> 
> 1) When i delete the references to com.mysql and the mysql lib from the
> project, i can compile without problems.
> 
> 2)
> I tryed to include a class as sugested in some place:
> public class ForceInclude {
> 	private static final Class class1 = com.mysql.jdbc.Driver.class;
> 
> 	ForceInclude() {
> 	}
> }

There's no problem with not included classes here. So that's not needed.

> 3) Compiling with JavaNativeCompiler from windows generating code only for
> linux
> "undefined reference to `java::util::Iterator*
> java::sql::SQLException::iterator()"

You are still providing insufficient information to efficiently help 
you. What version of JavaNativeCompiler are you using? What version of 
mysql? Where can it be downloaded? How did you compile?

Guessing all this, I now took
- JNC v1.1.1 with gcc-122233-win (compiles for Windows)
- MySQL Connector/J 5.1 from http://dev.mysql.com/downloads/#connector-j
and tried to compiled the jar. java.sql.SQLClientInfoException does not 
yet exist in GCJ (indeed it's quite new that class).

So, downgraded to MySQL Connector/J 5.0. Here some com.mchange classes 
and org.jboss classes are missing. Using -findirect-dispatch helps here 
and should solve the problem (I guess these classes are never needed at 
runtime since a Sun JRE doesn't have them either).


> 4) Compiling the same file from ubuntu with gcj compiler containing lib 
> libgcj-4.2.jar i get:
> cannot find file for class java.sql.Connection

This class exists in recent GCJs. What version are you using? Please update.


Again: Please, always add all information so that people willing to help 
you can fully reproduce the problem.


Hope that helps
Marco

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Compiling with mysql
  2008-08-21 20:28     ` Marco Trudel
@ 2008-08-26 19:41       ` ezer
  2008-08-27 13:33         ` ezer
  0 siblings, 1 reply; 14+ messages in thread
From: ezer @ 2008-08-26 19:41 UTC (permalink / raw)
  To: java


1) ok, I used the option  -findirect-dispatch
2) I also updated gcj to 4.3
gcj --version
gcj (Ubuntu 4.3.1-8ubuntu1) 4.3.1

3) I generated in windows using 
Eclipse 
jdk1.5.0_16
mysql-connector-java-5.0.8-bin.jar

Then the jar file i compile in the ubuntu machine getting the following
error

gcj --main=SearchManager -o search Searcher.jar -findirect-dispatch
/tmp/cc5qITfH.o: In function `com::mysql::jdbc::Buffer*
com::mysql::jdbc::MysqlIO::reuseAndReadPacket(com::mysql::jdbc::Buffer*)':
Searcher.jar:(.text+0x3b40e5): undefined reference to `.L53607'
Searcher.jar:(.text+0x3b4131): undefined reference to `.L53612'
collect2: ld returned 1 exit status




Marco Trudel-4 wrote:
> 
> ezer wrote:
>> I am using JavaNativeCompiler from windows and also gcj form ubuntu
>> 
>> 1) When i delete the references to com.mysql and the mysql lib from the
>> project, i can compile without problems.
>> 
>> 2)
>> I tryed to include a class as sugested in some place:
>> public class ForceInclude {
>> 	private static final Class class1 = com.mysql.jdbc.Driver.class;
>> 
>> 	ForceInclude() {
>> 	}
>> }
> 
> There's no problem with not included classes here. So that's not needed.
> 
>> 3) Compiling with JavaNativeCompiler from windows generating code only
>> for
>> linux
>> "undefined reference to `java::util::Iterator*
>> java::sql::SQLException::iterator()"
> 
> You are still providing insufficient information to efficiently help 
> you. What version of JavaNativeCompiler are you using? What version of 
> mysql? Where can it be downloaded? How did you compile?
> 
> Guessing all this, I now took
> - JNC v1.1.1 with gcc-122233-win (compiles for Windows)
> - MySQL Connector/J 5.1 from http://dev.mysql.com/downloads/#connector-j
> and tried to compiled the jar. java.sql.SQLClientInfoException does not 
> yet exist in GCJ (indeed it's quite new that class).
> 
> So, downgraded to MySQL Connector/J 5.0. Here some com.mchange classes 
> and org.jboss classes are missing. Using -findirect-dispatch helps here 
> and should solve the problem (I guess these classes are never needed at 
> runtime since a Sun JRE doesn't have them either).
> 
> 
>> 4) Compiling the same file from ubuntu with gcj compiler containing lib 
>> libgcj-4.2.jar i get:
>> cannot find file for class java.sql.Connection
> 
> This class exists in recent GCJs. What version are you using? Please
> update.
> 
> 
> Again: Please, always add all information so that people willing to help 
> you can fully reproduce the problem.
> 
> 
> Hope that helps
> Marco
> 
> 

-- 
View this message in context: http://www.nabble.com/Compiling-with-mysql-tp19092090p19168894.html
Sent from the gcc - java mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Compiling with mysql
  2008-08-26 19:41       ` ezer
@ 2008-08-27 13:33         ` ezer
  2008-08-27 18:11           ` ezer
  0 siblings, 1 reply; 14+ messages in thread
From: ezer @ 2008-08-27 13:33 UTC (permalink / raw)
  To: java


I saw that simply compiling the mysql jar is when i get that error.

>>gcj mysql-connector-java-5.0.8-bin.jar -findirect-dispatch 

/usr/lib/gcc/i486-linux-gnu/4.3.1/../../../../lib/crt1.o: In function
`_start':
(.text+0x18): undefined reference to `main'
/tmp/ccUb1RSI.o: In function `com::mysql::jdbc::Buffer*
com::mysql::jdbc::MysqlIO::reuseAndReadPacket(com::mysql::jdbc::Buffer*)':
mysql-connector-java-5.0.8-bin.jar:(.text+0x1798cb): undefined reference to
`.L16237'
mysql-connector-java-5.0.8-bin.jar:(.text+0x179917): undefined reference to
`.L16242'
collect2: ld returned 1 exit status


I think there are some basic steps that i am missing to make a gcj build....
any ideas ? must i compile the mysql jar outside my classes jar ?


ezer wrote:
> 
> 1) ok, I used the option  -findirect-dispatch
> 2) I also updated gcj to 4.3
> gcj --version
> gcj (Ubuntu 4.3.1-8ubuntu1) 4.3.1
> 
> 3) I generated in windows using 
> Eclipse 
> jdk1.5.0_16
> mysql-connector-java-5.0.8-bin.jar
> 
> Then the jar file i compile in the ubuntu machine getting the following
> error
> 
> gcj --main=SearchManager -o search Searcher.jar -findirect-dispatch
> /tmp/cc5qITfH.o: In function `com::mysql::jdbc::Buffer*
> com::mysql::jdbc::MysqlIO::reuseAndReadPacket(com::mysql::jdbc::Buffer*)':
> Searcher.jar:(.text+0x3b40e5): undefined reference to `.L53607'
> Searcher.jar:(.text+0x3b4131): undefined reference to `.L53612'
> collect2: ld returned 1 exit status
> 
> 
> 
> 
> Marco Trudel-4 wrote:
>> 
>> ezer wrote:
>>> I am using JavaNativeCompiler from windows and also gcj form ubuntu
>>> 
>>> 1) When i delete the references to com.mysql and the mysql lib from the
>>> project, i can compile without problems.
>>> 
>>> 2)
>>> I tryed to include a class as sugested in some place:
>>> public class ForceInclude {
>>> 	private static final Class class1 = com.mysql.jdbc.Driver.class;
>>> 
>>> 	ForceInclude() {
>>> 	}
>>> }
>> 
>> There's no problem with not included classes here. So that's not needed.
>> 
>>> 3) Compiling with JavaNativeCompiler from windows generating code only
>>> for
>>> linux
>>> "undefined reference to `java::util::Iterator*
>>> java::sql::SQLException::iterator()"
>> 
>> You are still providing insufficient information to efficiently help 
>> you. What version of JavaNativeCompiler are you using? What version of 
>> mysql? Where can it be downloaded? How did you compile?
>> 
>> Guessing all this, I now took
>> - JNC v1.1.1 with gcc-122233-win (compiles for Windows)
>> - MySQL Connector/J 5.1 from http://dev.mysql.com/downloads/#connector-j
>> and tried to compiled the jar. java.sql.SQLClientInfoException does not 
>> yet exist in GCJ (indeed it's quite new that class).
>> 
>> So, downgraded to MySQL Connector/J 5.0. Here some com.mchange classes 
>> and org.jboss classes are missing. Using -findirect-dispatch helps here 
>> and should solve the problem (I guess these classes are never needed at 
>> runtime since a Sun JRE doesn't have them either).
>> 
>> 
>>> 4) Compiling the same file from ubuntu with gcj compiler containing lib 
>>> libgcj-4.2.jar i get:
>>> cannot find file for class java.sql.Connection
>> 
>> This class exists in recent GCJs. What version are you using? Please
>> update.
>> 
>> 
>> Again: Please, always add all information so that people willing to help 
>> you can fully reproduce the problem.
>> 
>> 
>> Hope that helps
>> Marco
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Compiling-with-mysql-tp19092090p19181034.html
Sent from the gcc - java mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Compiling with mysql
  2008-08-27 13:33         ` ezer
@ 2008-08-27 18:11           ` ezer
  2008-09-03  9:14             ` Andrew Haley
  0 siblings, 1 reply; 14+ messages in thread
From: ezer @ 2008-08-27 18:11 UTC (permalink / raw)
  To: java


New try:

I generated mysql-connector-java-5.0.8-bin.o
and used it in the compilation of the program
gcj --main=Search --classpath=mysql-connector-java-5.0.8-bin.o  Searcher.jar
-o search

It compiles without errors, but when i execute ./search i get segmentation
fault

I dont know what to do.. help please...


ezer wrote:
> 
> I saw that simply compiling the mysql jar is when i get that error.
> 
>>>gcj mysql-connector-java-5.0.8-bin.jar -findirect-dispatch 
> 
> /usr/lib/gcc/i486-linux-gnu/4.3.1/../../../../lib/crt1.o: In function
> `_start':
> (.text+0x18): undefined reference to `main'
> /tmp/ccUb1RSI.o: In function `com::mysql::jdbc::Buffer*
> com::mysql::jdbc::MysqlIO::reuseAndReadPacket(com::mysql::jdbc::Buffer*)':
> mysql-connector-java-5.0.8-bin.jar:(.text+0x1798cb): undefined reference
> to `.L16237'
> mysql-connector-java-5.0.8-bin.jar:(.text+0x179917): undefined reference
> to `.L16242'
> collect2: ld returned 1 exit status
> 
> 
> I think there are some basic steps that i am missing to make a gcj
> build.... any ideas ? must i compile the mysql jar outside my classes jar
> ?
> 
> 
> ezer wrote:
>> 
>> 1) ok, I used the option  -findirect-dispatch
>> 2) I also updated gcj to 4.3
>> gcj --version
>> gcj (Ubuntu 4.3.1-8ubuntu1) 4.3.1
>> 
>> 3) I generated in windows using 
>> Eclipse 
>> jdk1.5.0_16
>> mysql-connector-java-5.0.8-bin.jar
>> 
>> Then the jar file i compile in the ubuntu machine getting the following
>> error
>> 
>> gcj --main=SearchManager -o search Searcher.jar -findirect-dispatch
>> /tmp/cc5qITfH.o: In function `com::mysql::jdbc::Buffer*
>> com::mysql::jdbc::MysqlIO::reuseAndReadPacket(com::mysql::jdbc::Buffer*)':
>> Searcher.jar:(.text+0x3b40e5): undefined reference to `.L53607'
>> Searcher.jar:(.text+0x3b4131): undefined reference to `.L53612'
>> collect2: ld returned 1 exit status
>> 
>> 
>> 
>> 
>> Marco Trudel-4 wrote:
>>> 
>>> ezer wrote:
>>>> I am using JavaNativeCompiler from windows and also gcj form ubuntu
>>>> 
>>>> 1) When i delete the references to com.mysql and the mysql lib from the
>>>> project, i can compile without problems.
>>>> 
>>>> 2)
>>>> I tryed to include a class as sugested in some place:
>>>> public class ForceInclude {
>>>> 	private static final Class class1 = com.mysql.jdbc.Driver.class;
>>>> 
>>>> 	ForceInclude() {
>>>> 	}
>>>> }
>>> 
>>> There's no problem with not included classes here. So that's not needed.
>>> 
>>>> 3) Compiling with JavaNativeCompiler from windows generating code only
>>>> for
>>>> linux
>>>> "undefined reference to `java::util::Iterator*
>>>> java::sql::SQLException::iterator()"
>>> 
>>> You are still providing insufficient information to efficiently help 
>>> you. What version of JavaNativeCompiler are you using? What version of 
>>> mysql? Where can it be downloaded? How did you compile?
>>> 
>>> Guessing all this, I now took
>>> - JNC v1.1.1 with gcc-122233-win (compiles for Windows)
>>> - MySQL Connector/J 5.1 from http://dev.mysql.com/downloads/#connector-j
>>> and tried to compiled the jar. java.sql.SQLClientInfoException does not 
>>> yet exist in GCJ (indeed it's quite new that class).
>>> 
>>> So, downgraded to MySQL Connector/J 5.0. Here some com.mchange classes 
>>> and org.jboss classes are missing. Using -findirect-dispatch helps here 
>>> and should solve the problem (I guess these classes are never needed at 
>>> runtime since a Sun JRE doesn't have them either).
>>> 
>>> 
>>>> 4) Compiling the same file from ubuntu with gcj compiler containing lib 
>>>> libgcj-4.2.jar i get:
>>>> cannot find file for class java.sql.Connection
>>> 
>>> This class exists in recent GCJs. What version are you using? Please
>>> update.
>>> 
>>> 
>>> Again: Please, always add all information so that people willing to help 
>>> you can fully reproduce the problem.
>>> 
>>> 
>>> Hope that helps
>>> Marco
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Compiling-with-mysql-tp19092090p19186515.html
Sent from the gcc - java mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Compiling with mysql
  2008-08-21 16:16 Compiling with mysql ezer
  2008-08-21 16:28 ` lorenzodevito
@ 2008-09-01 20:57 ` ezer
  2008-09-02 14:58   ` ezer
  1 sibling, 1 reply; 14+ messages in thread
From: ezer @ 2008-09-01 20:57 UTC (permalink / raw)
  To: java


Now i am trying diferent. i generated an .o file with mysql driver and get an
error, that error was the same when i try to run the applicatyion using the
java from gcj without generating native code.

java -jar Myapp.jar


You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near
'????????????????????????????????' at line 1
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in
your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near '????????????????????????????????'
at line 1
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
   at
com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
   at
com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
   at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
   at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
   at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
   at java.sql.DriverManager.getConnection(libgcj.so.90)
   at java.sql.DriverManager.getConnection(libgcj.so.90)
   at xx.yy.dao.DAO.getConnection(DAO.java:103)


$ java -version
java version "1.5.0"
gij (GNU libgcj) version 4.3.1


The same execution with the sam jar under win xp runs fine



ezer wrote:
> 
> I am triyng for a week to compile a project using mysql. I get all kind of
> errors. 
> i used mysql-connector-java-3.1.14-bin.jar,
> mysql-connector-java-5.1.6-bin.jar and mysql-connector-java-5.1.6-bin.jar
> I use something like that gcj --main=MyMainClass -o MyExec MyJar.jar
> The MyJar i tryed to generate with all the java versions, 1.4, 15 and 1.6
> 
> I searched the net for info but i couldnt find anything...
> 

-- 
View this message in context: http://www.nabble.com/Compiling-with-mysql-tp19092090p19260609.html
Sent from the gcc - java mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Compiling with mysql
  2008-09-01 20:57 ` ezer
@ 2008-09-02 14:58   ` ezer
  0 siblings, 0 replies; 14+ messages in thread
From: ezer @ 2008-09-02 14:58 UTC (permalink / raw)
  To: java


A simple example


import java.sql.*;

public class MysqlConnect{
  public static void main(String[] args) {
    System.out.println("MySQL Connect Example.");
    Connection conn = null;
    String url = "jdbc:mysql://localhost:3306/";
    String dbName = "myDatabase";
    String driver = "com.mysql.jdbc.Driver";
    String userName = "root"; 
    String password = "root";
    try {
      Class.forName(driver).newInstance();
      conn = DriverManager.getConnection(url+dbName,userName,password);
      System.out.println("Connected to the database");
      conn.close();
      System.out.println("Disconnected from database");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}


in ubuntu i compile:
javac MysqlConnect.java

execution:
java MysqlConnect

output:
MySQL Connect Example.
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in
your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near '????????????????????????????????'
at line 1
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
   at
com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
   at
com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
   at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
   at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
   at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
   at java.sql.DriverManager.getConnection(libgcj.so.90)
   at java.sql.DriverManager.getConnection(libgcj.so.90)
   at MysqlConnect.main(MysqlConnect.java:14)


$ java -version
java version "1.5.0"
gij (GNU libgcj) version 4.3.1

Please any idea ?


ezer wrote:
> 
> Now i am trying diferent. i generated an .o file with mysql driver and get
> an error, that error was the same when i try to run the applicatyion using
> the java from gcj without generating native code.
> 
> java -jar Myapp.jar
> 
> 
> You have an error in your SQL syntax; check the manual that corresponds to
> your MySQL server version for the right syntax to use near
> '????????????????????????????????' at line 1
> com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in
> your SQL syntax; check the manual that corresponds to your MySQL server
> version for the right syntax to use near
> '????????????????????????????????' at line 1
>    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
>    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
>    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
>    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
>    at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
>    at
> com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
>    at
> com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
>    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
>    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
>    at
> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
>    at java.sql.DriverManager.getConnection(libgcj.so.90)
>    at java.sql.DriverManager.getConnection(libgcj.so.90)
>    at xx.yy.dao.DAO.getConnection(DAO.java:103)
> 
> 
> $ java -version
> java version "1.5.0"
> gij (GNU libgcj) version 4.3.1
> 
> 
> The same execution with the sam jar under win xp runs fine
> 
> 
> 
> ezer wrote:
>> 
>> I am triyng for a week to compile a project using mysql. I get all kind
>> of errors. 
>> i used mysql-connector-java-3.1.14-bin.jar,
>> mysql-connector-java-5.1.6-bin.jar and mysql-connector-java-5.1.6-bin.jar
>> I use something like that gcj --main=MyMainClass -o MyExec MyJar.jar
>> The MyJar i tryed to generate with all the java versions, 1.4, 15 and 1.6
>> 
>> I searched the net for info but i couldnt find anything...
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Compiling-with-mysql-tp19092090p19271800.html
Sent from the gcc - java mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Compiling with mysql
  2008-08-27 18:11           ` ezer
@ 2008-09-03  9:14             ` Andrew Haley
  2008-09-03 14:53               ` ezer
  0 siblings, 1 reply; 14+ messages in thread
From: Andrew Haley @ 2008-09-03  9:14 UTC (permalink / raw)
  To: ezer; +Cc: java

ezer wrote:
> New try:
> 
> I generated mysql-connector-java-5.0.8-bin.o
> and used it in the compilation of the program
> gcj --main=Search --classpath=mysql-connector-java-5.0.8-bin.o  Searcher.jar
> -o search
> 
> It compiles without errors, but when i execute ./search i get segmentation
> fault
> 
> I dont know what to do.. help please...

the key problem here is that you haven't told us *exactly* what you are
doing.  We need to know if we can help you.

http://www.catb.org/~esr/faqs/smart-questions.html

Andrew.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Compiling with mysql
  2008-09-03  9:14             ` Andrew Haley
@ 2008-09-03 14:53               ` ezer
  2008-09-03 15:19                 ` Andrew Haley
  0 siblings, 1 reply; 14+ messages in thread
From: ezer @ 2008-09-03 14:53 UTC (permalink / raw)
  To: java


Andrew, i dont understand what do you mean with exactly, I will try to
explain again, i isolated the problem only compiling a short code that only
conects to the database and exit. 

1) The code is the following

import java.sql.*;

public class MysqlConnect{
  public static void main(String[] args) {
    System.out.println("MySQL Connect Example.");
    Connection conn = null;
    String url = "jdbc:mysql://localhost:3306/";
    String dbName = "myDatabase";
    String driver = "com.mysql.jdbc.Driver";
    String userName = "root";
    String password = "root";
    try {
      Class.forName(driver).newInstance();
      conn = DriverManager.getConnection(url+dbName,userName,password);
      System.out.println("Connected to the database");
      conn.close();
      System.out.println("Disconnected from database");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

2) I compile
gcj --main=MysqlConnect -o mysqlconnect MysqlConnect.java

(gcj version : 4.3.1)

3) Execution:

./mysqlconnect

4) Output:

MySQL Connect Example.
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in
your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near '????????????????????????????????'
at line 1
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
   at
com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
   at
com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
   at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
   at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
   at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
   at java.sql.DriverManager.getConnection(libgcj.so.90)
   at java.sql.DriverManager.getConnection(libgcj.so.90)
   at MysqlConnect.main(MysqlConnect.java:14)

5) I installed a previous version of gcj 4.2 and repetead the compilation
and execution, and the result was the following:

MySQL Connect Example.
java.sql.SQLException: Error during query: Unexpected Exception:
java.io.CharConversionException message given: null

Nested Stack Trace:


** BEGIN NESTED EXCEPTION ** 

java.io.CharConversionException

STACKTRACE:

java.io.CharConversionException
   at gnu.gcj.convert.Input_iconv.read(libgcj.so.81)
   at java.lang.String.init(libgcj.so.81)
   at java.lang.String.<init>(libgcj.so.81)
   at
com.mysql.jdbc.SingleByteCharsetConverter.<init>(SingleByteCharsetConverter.java:153)
   at
com.mysql.jdbc.SingleByteCharsetConverter.initCharset(SingleByteCharsetConverter.java:108)
   at
com.mysql.jdbc.SingleByteCharsetConverter.getInstance(SingleByteCharsetConverter.java:86)
   at com.mysql.jdbc.Connection.getCharsetConverter(Connection.java:3505)
   at com.mysql.jdbc.StringUtils.getBytes(StringUtils.java:615)
   at com.mysql.jdbc.Buffer.writeStringNoNull(Buffer.java:655)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1686)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
   at
com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
   at
com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
   at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
   at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
   at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
   at java.sql.DriverManager.getConnection(libgcj.so.81)
   at java.sql.DriverManager.getConnection(libgcj.so.81)
   at MysqlConnect.main(mysqlconnect)


** END NESTED EXCEPTION **


   at com.mysql.jdbc.Connection.execSQL(Connection.java:3330)
   at
com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
   at
com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
   at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
   at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
   at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
   at java.sql.DriverManager.getConnection(libgcj.so.81)
   at java.sql.DriverManager.getConnection(libgcj.so.81)
   at MysqlConnect.main(mysqlconnect)

6) It seems it cant execute  the line conn =
DriverManager.getConnection(url+dbName,userName,password);
From the same machine executing with java sun, it did well, but not with the
java version from the gcj.. 

It was exactly what i did.. dont know what else could i add.







Andrew Haley wrote:
> 
> ezer wrote:
>> New try:
>> 
>> I generated mysql-connector-java-5.0.8-bin.o
>> and used it in the compilation of the program
>> gcj --main=Search --classpath=mysql-connector-java-5.0.8-bin.o 
>> Searcher.jar
>> -o search
>> 
>> It compiles without errors, but when i execute ./search i get
>> segmentation
>> fault
>> 
>> I dont know what to do.. help please...
> 
> the key problem here is that you haven't told us *exactly* what you are
> doing.  We need to know if we can help you.
> 
> http://www.catb.org/~esr/faqs/smart-questions.html
> 
> Andrew.
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Compiling-with-mysql-tp19092090p19290948.html
Sent from the gcc - java mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Compiling with mysql
  2008-09-03 14:53               ` ezer
@ 2008-09-03 15:19                 ` Andrew Haley
  2008-09-03 16:06                   ` ezer
  0 siblings, 1 reply; 14+ messages in thread
From: Andrew Haley @ 2008-09-03 15:19 UTC (permalink / raw)
  To: ezer; +Cc: java

ezer wrote:
> Andrew, i dont understand what do you mean with exactly, I will try to
> explain again, i isolated the problem only compiling a short code that only
> conects to the database and exit. 
> 
> 1) The code is the following
> 
> import java.sql.*;
> 
> public class MysqlConnect{
>   public static void main(String[] args) {
>     System.out.println("MySQL Connect Example.");
>     Connection conn = null;
>     String url = "jdbc:mysql://localhost:3306/";
>     String dbName = "myDatabase";
>     String driver = "com.mysql.jdbc.Driver";
>     String userName = "root";
>     String password = "root";
>     try {
>       Class.forName(driver).newInstance();
>       conn = DriverManager.getConnection(url+dbName,userName,password);
>       System.out.println("Connected to the database");
>       conn.close();
>       System.out.println("Disconnected from database");
>     } catch (Exception e) {
>       e.printStackTrace();
>     }
>   }
> }

As far as I can tell the error message is not coming from gcj,
but from mysql.  It's quite possible that this is caused by
a bug in gcj, but I'd have to debug it to know for sure.  Is
there a log from mysql?

Andrew.

> 2) I compile
> gcj --main=MysqlConnect -o mysqlconnect MysqlConnect.java
> 
> (gcj version : 4.3.1)
> 
> 3) Execution:
> 
> ./mysqlconnect
> 
> 4) Output:
> 
> MySQL Connect Example.
> com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in
> your SQL syntax; check the manual that corresponds to your MySQL server
> version for the right syntax to use near '????????????????????????????????'
> at line 1
>    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
>    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
>    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
>    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
>    at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
>    at
> com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
>    at
> com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
>    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
>    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
>    at
> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
>    at java.sql.DriverManager.getConnection(libgcj.so.90)
>    at java.sql.DriverManager.getConnection(libgcj.so.90)
>    at MysqlConnect.main(MysqlConnect.java:14)
> 
> 5) I installed a previous version of gcj 4.2 and repetead the compilation
> and execution, and the result was the following:
> 
> MySQL Connect Example.
> java.sql.SQLException: Error during query: Unexpected Exception:
> java.io.CharConversionException message given: null
> 
> Nested Stack Trace:
> 
> 
> ** BEGIN NESTED EXCEPTION ** 
> 
> java.io.CharConversionException
> 
> STACKTRACE:
> 
> java.io.CharConversionException
>    at gnu.gcj.convert.Input_iconv.read(libgcj.so.81)
>    at java.lang.String.init(libgcj.so.81)
>    at java.lang.String.<init>(libgcj.so.81)
>    at
> com.mysql.jdbc.SingleByteCharsetConverter.<init>(SingleByteCharsetConverter.java:153)
>    at
> com.mysql.jdbc.SingleByteCharsetConverter.initCharset(SingleByteCharsetConverter.java:108)
>    at
> com.mysql.jdbc.SingleByteCharsetConverter.getInstance(SingleByteCharsetConverter.java:86)
>    at com.mysql.jdbc.Connection.getCharsetConverter(Connection.java:3505)
>    at com.mysql.jdbc.StringUtils.getBytes(StringUtils.java:615)
>    at com.mysql.jdbc.Buffer.writeStringNoNull(Buffer.java:655)
>    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1686)
>    at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
>    at
> com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
>    at
> com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
>    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
>    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
>    at
> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
>    at java.sql.DriverManager.getConnection(libgcj.so.81)
>    at java.sql.DriverManager.getConnection(libgcj.so.81)
>    at MysqlConnect.main(mysqlconnect)
> 
> 
> ** END NESTED EXCEPTION **
> 
> 
>    at com.mysql.jdbc.Connection.execSQL(Connection.java:3330)
>    at
> com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
>    at
> com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
>    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
>    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
>    at
> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
>    at java.sql.DriverManager.getConnection(libgcj.so.81)
>    at java.sql.DriverManager.getConnection(libgcj.so.81)
>    at MysqlConnect.main(mysqlconnect)
> 
> 6) It seems it cant execute  the line conn =
> DriverManager.getConnection(url+dbName,userName,password);
> From the same machine executing with java sun, it did well, but not with the
> java version from the gcj.. 
> 
> It was exactly what i did.. dont know what else could i add.
> 
> 
> 
> 
> 
> 
> 
> Andrew Haley wrote:
>> ezer wrote:
>>> New try:
>>>
>>> I generated mysql-connector-java-5.0.8-bin.o
>>> and used it in the compilation of the program
>>> gcj --main=Search --classpath=mysql-connector-java-5.0.8-bin.o 
>>> Searcher.jar
>>> -o search
>>>
>>> It compiles without errors, but when i execute ./search i get
>>> segmentation
>>> fault
>>>
>>> I dont know what to do.. help please...
>> the key problem here is that you haven't told us *exactly* what you are
>> doing.  We need to know if we can help you.
>>
>> http://www.catb.org/~esr/faqs/smart-questions.html
>>
>> Andrew.
>>
>>
>>
>>
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Compiling with mysql
  2008-09-03 15:19                 ` Andrew Haley
@ 2008-09-03 16:06                   ` ezer
  2008-09-03 16:24                     ` ezer
  0 siblings, 1 reply; 14+ messages in thread
From: ezer @ 2008-09-03 16:06 UTC (permalink / raw)
  To: java


1) I found whats going on, its an incompatibility in the character conversion
between the gcj and mysql. Here is the explanation and the workaround :

http://dev.mysql.com/doc/refman/5.0/en/connector-j-usagenotes-troubleshooting.html#qandaitem-28-4-5-3-9

http://bugs.mysql.com/bug.php?id=29636
(go to the post [9 Jul 2007 17:05])

2) I added 
default-character-set=utf8
under [client] and [mysqld] sections of the my.cnf file of mysql

3) The other solution of using useJvmCharsetConverters=true i didnt tested
because i dont know where to use that string.

4) Now i get the test program runing fine with the following output:
MySQL Connect Example.
Connected to the database
Disconnected from database

But one thing is that the connection executing under the gcj program runs
considerable slower than the same test runing with java MysqlConnect. Its
normal for connections ? 




Andrew Haley wrote:
> 
> ezer wrote:
>> Andrew, i dont understand what do you mean with exactly, I will try to
>> explain again, i isolated the problem only compiling a short code that
>> only
>> conects to the database and exit. 
>> 
>> 1) The code is the following
>> 
>> import java.sql.*;
>> 
>> public class MysqlConnect{
>>   public static void main(String[] args) {
>>     System.out.println("MySQL Connect Example.");
>>     Connection conn = null;
>>     String url = "jdbc:mysql://localhost:3306/";
>>     String dbName = "myDatabase";
>>     String driver = "com.mysql.jdbc.Driver";
>>     String userName = "root";
>>     String password = "root";
>>     try {
>>       Class.forName(driver).newInstance();
>>       conn = DriverManager.getConnection(url+dbName,userName,password);
>>       System.out.println("Connected to the database");
>>       conn.close();
>>       System.out.println("Disconnected from database");
>>     } catch (Exception e) {
>>       e.printStackTrace();
>>     }
>>   }
>> }
> 
> As far as I can tell the error message is not coming from gcj,
> but from mysql.  It's quite possible that this is caused by
> a bug in gcj, but I'd have to debug it to know for sure.  Is
> there a log from mysql?
> 
> Andrew.
> 
>> 2) I compile
>> gcj --main=MysqlConnect -o mysqlconnect MysqlConnect.java
>> 
>> (gcj version : 4.3.1)
>> 
>> 3) Execution:
>> 
>> ./mysqlconnect
>> 
>> 4) Output:
>> 
>> MySQL Connect Example.
>> com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in
>> your SQL syntax; check the manual that corresponds to your MySQL server
>> version for the right syntax to use near
>> '????????????????????????????????'
>> at line 1
>>    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
>>    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
>>    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
>>    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
>>    at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
>>    at
>> com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
>>    at
>> com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
>>    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
>>    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
>>    at
>> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
>>    at java.sql.DriverManager.getConnection(libgcj.so.90)
>>    at java.sql.DriverManager.getConnection(libgcj.so.90)
>>    at MysqlConnect.main(MysqlConnect.java:14)
>> 
>> 5) I installed a previous version of gcj 4.2 and repetead the compilation
>> and execution, and the result was the following:
>> 
>> MySQL Connect Example.
>> java.sql.SQLException: Error during query: Unexpected Exception:
>> java.io.CharConversionException message given: null
>> 
>> Nested Stack Trace:
>> 
>> 
>> ** BEGIN NESTED EXCEPTION ** 
>> 
>> java.io.CharConversionException
>> 
>> STACKTRACE:
>> 
>> java.io.CharConversionException
>>    at gnu.gcj.convert.Input_iconv.read(libgcj.so.81)
>>    at java.lang.String.init(libgcj.so.81)
>>    at java.lang.String.<init>(libgcj.so.81)
>>    at
>> com.mysql.jdbc.SingleByteCharsetConverter.<init>(SingleByteCharsetConverter.java:153)
>>    at
>> com.mysql.jdbc.SingleByteCharsetConverter.initCharset(SingleByteCharsetConverter.java:108)
>>    at
>> com.mysql.jdbc.SingleByteCharsetConverter.getInstance(SingleByteCharsetConverter.java:86)
>>    at com.mysql.jdbc.Connection.getCharsetConverter(Connection.java:3505)
>>    at com.mysql.jdbc.StringUtils.getBytes(StringUtils.java:615)
>>    at com.mysql.jdbc.Buffer.writeStringNoNull(Buffer.java:655)
>>    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1686)
>>    at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
>>    at
>> com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
>>    at
>> com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
>>    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
>>    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
>>    at
>> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
>>    at java.sql.DriverManager.getConnection(libgcj.so.81)
>>    at java.sql.DriverManager.getConnection(libgcj.so.81)
>>    at MysqlConnect.main(mysqlconnect)
>> 
>> 
>> ** END NESTED EXCEPTION **
>> 
>> 
>>    at com.mysql.jdbc.Connection.execSQL(Connection.java:3330)
>>    at
>> com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
>>    at
>> com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
>>    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
>>    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
>>    at
>> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
>>    at java.sql.DriverManager.getConnection(libgcj.so.81)
>>    at java.sql.DriverManager.getConnection(libgcj.so.81)
>>    at MysqlConnect.main(mysqlconnect)
>> 
>> 6) It seems it cant execute  the line conn =
>> DriverManager.getConnection(url+dbName,userName,password);
>> From the same machine executing with java sun, it did well, but not with
>> the
>> java version from the gcj.. 
>> 
>> It was exactly what i did.. dont know what else could i add.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> Andrew Haley wrote:
>>> ezer wrote:
>>>> New try:
>>>>
>>>> I generated mysql-connector-java-5.0.8-bin.o
>>>> and used it in the compilation of the program
>>>> gcj --main=Search --classpath=mysql-connector-java-5.0.8-bin.o 
>>>> Searcher.jar
>>>> -o search
>>>>
>>>> It compiles without errors, but when i execute ./search i get
>>>> segmentation
>>>> fault
>>>>
>>>> I dont know what to do.. help please...
>>> the key problem here is that you haven't told us *exactly* what you are
>>> doing.  We need to know if we can help you.
>>>
>>> http://www.catb.org/~esr/faqs/smart-questions.html
>>>
>>> Andrew.
>>>
>>>
>>>
>>>
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Compiling-with-mysql-tp19092090p19292423.html
Sent from the gcc - java mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Compiling with mysql
  2008-09-03 16:06                   ` ezer
@ 2008-09-03 16:24                     ` ezer
  0 siblings, 0 replies; 14+ messages in thread
From: ezer @ 2008-09-03 16:24 UTC (permalink / raw)
  To: java


3) i discovered how to use the second solution:
conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql?user=root&password=root&useJvmCharsetConverters=true");

with that you can stay de my.conf unmodified.

Now i am still dont know the performance diference, its not should to run
faster?


ezer wrote:
> 
> 1) I found whats going on, its an incompatibility in the character
> conversion between the gcj and mysql. Here is the explanation and the
> workaround :
> 
> http://dev.mysql.com/doc/refman/5.0/en/connector-j-usagenotes-troubleshooting.html#qandaitem-28-4-5-3-9
> 
> http://bugs.mysql.com/bug.php?id=29636
> (go to the post [9 Jul 2007 17:05])
> 
> 2) I added 
> default-character-set=utf8
> under [client] and [mysqld] sections of the my.cnf file of mysql
> 
> 3) The other solution of using useJvmCharsetConverters=true i didnt tested
> because i dont know where to use that string.
> 
> 4) Now i get the test program runing fine with the following output:
> MySQL Connect Example.
> Connected to the database
> Disconnected from database
> 
> But one thing is that the connection executing under the gcj program runs
> considerable slower than the same test runing with java MysqlConnect. Its
> normal for connections ? 
> 
> 
> 
> 
> Andrew Haley wrote:
>> 
>> ezer wrote:
>>> Andrew, i dont understand what do you mean with exactly, I will try to
>>> explain again, i isolated the problem only compiling a short code that
>>> only
>>> conects to the database and exit. 
>>> 
>>> 1) The code is the following
>>> 
>>> import java.sql.*;
>>> 
>>> public class MysqlConnect{
>>>   public static void main(String[] args) {
>>>     System.out.println("MySQL Connect Example.");
>>>     Connection conn = null;
>>>     String url = "jdbc:mysql://localhost:3306/";
>>>     String dbName = "myDatabase";
>>>     String driver = "com.mysql.jdbc.Driver";
>>>     String userName = "root";
>>>     String password = "root";
>>>     try {
>>>       Class.forName(driver).newInstance();
>>>       conn = DriverManager.getConnection(url+dbName,userName,password);
>>>       System.out.println("Connected to the database");
>>>       conn.close();
>>>       System.out.println("Disconnected from database");
>>>     } catch (Exception e) {
>>>       e.printStackTrace();
>>>     }
>>>   }
>>> }
>> 
>> As far as I can tell the error message is not coming from gcj,
>> but from mysql.  It's quite possible that this is caused by
>> a bug in gcj, but I'd have to debug it to know for sure.  Is
>> there a log from mysql?
>> 
>> Andrew.
>> 
>>> 2) I compile
>>> gcj --main=MysqlConnect -o mysqlconnect MysqlConnect.java
>>> 
>>> (gcj version : 4.3.1)
>>> 
>>> 3) Execution:
>>> 
>>> ./mysqlconnect
>>> 
>>> 4) Output:
>>> 
>>> MySQL Connect Example.
>>> com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error
>>> in
>>> your SQL syntax; check the manual that corresponds to your MySQL server
>>> version for the right syntax to use near
>>> '????????????????????????????????'
>>> at line 1
>>>    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
>>>    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
>>>    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
>>>    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
>>>    at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
>>>    at
>>> com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
>>>    at
>>> com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
>>>    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
>>>    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
>>>    at
>>> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
>>>    at java.sql.DriverManager.getConnection(libgcj.so.90)
>>>    at java.sql.DriverManager.getConnection(libgcj.so.90)
>>>    at MysqlConnect.main(MysqlConnect.java:14)
>>> 
>>> 5) I installed a previous version of gcj 4.2 and repetead the
>>> compilation
>>> and execution, and the result was the following:
>>> 
>>> MySQL Connect Example.
>>> java.sql.SQLException: Error during query: Unexpected Exception:
>>> java.io.CharConversionException message given: null
>>> 
>>> Nested Stack Trace:
>>> 
>>> 
>>> ** BEGIN NESTED EXCEPTION ** 
>>> 
>>> java.io.CharConversionException
>>> 
>>> STACKTRACE:
>>> 
>>> java.io.CharConversionException
>>>    at gnu.gcj.convert.Input_iconv.read(libgcj.so.81)
>>>    at java.lang.String.init(libgcj.so.81)
>>>    at java.lang.String.<init>(libgcj.so.81)
>>>    at
>>> com.mysql.jdbc.SingleByteCharsetConverter.<init>(SingleByteCharsetConverter.java:153)
>>>    at
>>> com.mysql.jdbc.SingleByteCharsetConverter.initCharset(SingleByteCharsetConverter.java:108)
>>>    at
>>> com.mysql.jdbc.SingleByteCharsetConverter.getInstance(SingleByteCharsetConverter.java:86)
>>>    at
>>> com.mysql.jdbc.Connection.getCharsetConverter(Connection.java:3505)
>>>    at com.mysql.jdbc.StringUtils.getBytes(StringUtils.java:615)
>>>    at com.mysql.jdbc.Buffer.writeStringNoNull(Buffer.java:655)
>>>    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1686)
>>>    at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
>>>    at
>>> com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
>>>    at
>>> com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
>>>    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
>>>    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
>>>    at
>>> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
>>>    at java.sql.DriverManager.getConnection(libgcj.so.81)
>>>    at java.sql.DriverManager.getConnection(libgcj.so.81)
>>>    at MysqlConnect.main(mysqlconnect)
>>> 
>>> 
>>> ** END NESTED EXCEPTION **
>>> 
>>> 
>>>    at com.mysql.jdbc.Connection.execSQL(Connection.java:3330)
>>>    at
>>> com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2525)
>>>    at
>>> com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:4139)
>>>    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2789)
>>>    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
>>>    at
>>> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
>>>    at java.sql.DriverManager.getConnection(libgcj.so.81)
>>>    at java.sql.DriverManager.getConnection(libgcj.so.81)
>>>    at MysqlConnect.main(mysqlconnect)
>>> 
>>> 6) It seems it cant execute  the line conn =
>>> DriverManager.getConnection(url+dbName,userName,password);
>>> From the same machine executing with java sun, it did well, but not with
>>> the
>>> java version from the gcj.. 
>>> 
>>> It was exactly what i did.. dont know what else could i add.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Andrew Haley wrote:
>>>> ezer wrote:
>>>>> New try:
>>>>>
>>>>> I generated mysql-connector-java-5.0.8-bin.o
>>>>> and used it in the compilation of the program
>>>>> gcj --main=Search --classpath=mysql-connector-java-5.0.8-bin.o 
>>>>> Searcher.jar
>>>>> -o search
>>>>>
>>>>> It compiles without errors, but when i execute ./search i get
>>>>> segmentation
>>>>> fault
>>>>>
>>>>> I dont know what to do.. help please...
>>>> the key problem here is that you haven't told us *exactly* what you are
>>>> doing.  We need to know if we can help you.
>>>>
>>>> http://www.catb.org/~esr/faqs/smart-questions.html
>>>>
>>>> Andrew.
>>>>
>>>>
>>>>
>>>>
>>> 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Compiling-with-mysql-tp19092090p19292758.html
Sent from the gcc - java mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-09-03 16:24 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-21 16:16 Compiling with mysql ezer
2008-08-21 16:28 ` lorenzodevito
2008-08-21 19:20   ` ezer
2008-08-21 20:28     ` Marco Trudel
2008-08-26 19:41       ` ezer
2008-08-27 13:33         ` ezer
2008-08-27 18:11           ` ezer
2008-09-03  9:14             ` Andrew Haley
2008-09-03 14:53               ` ezer
2008-09-03 15:19                 ` Andrew Haley
2008-09-03 16:06                   ` ezer
2008-09-03 16:24                     ` ezer
2008-09-01 20:57 ` ezer
2008-09-02 14:58   ` ezer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).