简体   繁体   中英

Can you use JDBC with Codename One?

I am planning an app that needs to connect to a MySQL database. Can I use JDBC in my Codename One project and expect it to work in runtime?

If Codename One does not support JDBC, could I implement a connection to MySQL using the native code (Objective-C) generated by Codename One?

Then if that is not possible, could I connect my Codename One project to a php script that runs on the server next to the MySQL database?

You can only connect to a server using a REST API or similar. JDBC will not pass thru the bytecode translation process and none of the JDBC drivers were designed for unreliable mobile device network connectivity.

Regardless its pretty unsafe to expose your database to the wireless network.

Just to add to this there is this new post covering connectivity to mysql in the backend: https://www.codenameone.com/blog/connecting-to-a-mysql-database.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM