i m trying to write a simple mysql connection code with JDBC to my mysql server on my LAN on OSX.
i have, – IntelliJ 15 CE – Gluon Plugins 1.0.1 installed. – member of apple developper center – Setting mysql-connector-java.5.1.37.bin.jar in Modules and Libraries (IntelliJ) from Maven Server and saved under /Library/Java/Extensions
I can create simple IPA and APK and send/start on device with launchIOSDevice / creataIP/android (but as i say only simple Hello world)
My Problem is, if i start my code with TASKS -> RUN everythings is ok.. I have a succes message on Desktop (OSX), that the connection is OK.
But, if i try same code below to send to my Ipad, i get following errors below.
can anybody help me please, why i cant start this simple code on my ipad?
thanks erkan kaplan
my build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.0.6'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
}
mainClassName = 'com.gluonapplication.GluonApplication'
jfxmobile {
android {
manifest = 'src/android/AndroidManifest.xml'
}
ios {
forceLinkClasses = [ 'com.gluonapplication.**.*']
infoPList = file('src/ios/Default-Info.plist')
}
}
How must i define my "forceLinkClassess" Line for mysql-connector-java?
my simple javafx code:
private static final String DB_CONNECTION = "jdbc:mysql://192.168.3.188:3306/test_sql";
private static final String DB_USER = "root";
private static final String DB_PASSWORD = "myPASSWORT";
public static Connection connection = null;
public static Connection getDBConnection (){
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
connection = DriverManager.getConnection(DB_CONNECTION, DB_USER, DB_PASSWORD);
alertMessage("Connection is OK");
System.out.println("BAglanti ok");
return connection;
} catch (SQLException e) {
e.printStackTrace();
System.out.println("CONNECTION ERROR...");
alertMessage(e.toString());
}
return connection;
}
public static void alertMessage(String msg){
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Information");
alert.setHeaderText("Information");
alert.setContentText("Ergebnis : " + msg );
alert.showAndWait();
}
Error Logs:
[WARN] java.lang.Class: Class.forName() failed to load ‘com.mysql.jdbc.Driver’. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>com.mysql.jdbc.Driver</pattern></forceLinkClasses> to your robovm.xml file to link it in.
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.lang.VMClassLoader.findClassInClasspathForLoader(Native Method)
..........
..........
..........