Google based MySQL connection error usinf IJC Enterprise

User 37eeffe0b4

21-08-2015 08:49:02

Trying to connect to a google hosted mySQL database and get the following error with IJC Enterprise:


  
Could not get JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot load connection class because of underlying exception: 'java.lang.NumberFormatException: For input string: "jchem6"'.


ChemAxon 37bb34e128

21-08-2015 12:03:17

Hi, could you please attach here the IJC log file so that we could see the whole exception? I guess that the problem is in your JDBC URL, but from so little information I can't say more.


Thanks,
-vita

User 37eeffe0b4

21-08-2015 12:49:23

The IJC log file is attached.

ChemAxon 37bb34e128

24-08-2015 08:39:52

Hi, thanks for attaching the exception here. It says "Unsupported database type", but unfortunately does not show any more details. I still think that the problem is in your JDBC URL string. Could you please attach here the whole IJC log file. Here are the instructions how to get the IJC logfile.


https://docs.chemaxon.com/display/instantjchem/Reporting+a+Problem#ReportingaProblem-logfile


Thank you,
-vita

User 37eeffe0b4

24-08-2015 12:38:49

Hi Vita,


Please see attached. Hopefully this is the correct one. Thank you.

ChemAxon 37bb34e128

24-08-2015 13:18:45

Hi, thanks for the log file. It is the correct one. But it still does not show the JDBC URL of the database that you are trying to connect to. I thought that the URL will be logged, but the error seems to happen too early in the process. Anyway, I assume that you are trying to follow the steps described here:


https://docs.chemaxon.com/display/instantjchem/Adding+a+New+Schema


What is the URL that you enter on the 'Database connection' panel? It needs to follow the format shown in the documentation, which is "jdbc:mysql:" followed by your database server IP address (or DNS), followed by the port (default port is 3306), followed by slash and your database name.


We are not familiar we the google hosted MySQL databases, but I assume that it's just an ordinary MySQL database running on some Google machine and reachable over the internet. As such it should behave as any other MySQL server and IJC should be able to connect to it.


One last question though, do you have IJC enterprise license? If not, then you won't be able to connect to remote databases.


Thanks,
-vita

User 37eeffe0b4

24-08-2015 20:13:55

I have a license to IJC Enterprise edition.


The url is the following:


jdbc:google:mysql://tirk-1042:ijcprojects



Google provides the following Java code to connect:


String url = null;
if (SystemProperty.environment.value() ==
SystemProperty.Environment.Value.Production) {
// Connecting from App Engine.
// Load the class that provides the "jdbc:google:mysql://"
// prefix.
Class.forName("com.mysql.jdbc.GoogleDriver");
url =
"jdbc:google:mysql://tirk-1042:ijcprojects?user=root";
} else {
// You may also assign an IP Address from the access control
// page and use it to connect from an external network.
}


Connection conn = DriverManager.getConnection(url);
ResultSet rs = conn.createStatement().executeQuery(
"SELECT 1 + 1");

ChemAxon 37bb34e128

25-08-2015 07:18:51

Hi,


thanks for all this info, I think it explains the situation. IJC does not use com.mysql.jdbc.GoogleDriver, it uses the standard com.mysql.jdbc.Driver for connecting to MySQL databses. You won't be able to use the URL from the example code provided by Google. The URL really has to be a standard URL for connecting to MySQL databases, which is something like "jdbc:mysql://x.x.x.x:3306/dbname".


I guess that you will have to follow the instructions in the 'else' clause from the Google example, which says:



// You may also assign an IP Address from the access control
// page and use it to connect from an external network.



Once your MySQL server has an IP address that can be accessed over the internet, you should be able to connect to it from IJC using the URL format mentioned above. Just use your server's IP address instead of the 'x.x.x.x' part and replace 'dbname' with the real name of your database.


I hope this helps and good luck!


Thanks,
-vita

User 37eeffe0b4

25-08-2015 18:52:31

On a related note, does the url support ipv6?

ChemAxon 26d92e5dcd

27-08-2015 07:46:23

Hello,


the standard com.mysql.jdbc.Driver should support ipv6 protocol, however we never tested this possibility as no customer required such option so far.


Wishing all the best


David