简体   繁体   English

仅使用 php-java 网桥连接到数据库

[英]use php-java bridge only to connect to DB

I would like to know how can I use php-java bridge but only to connect to database..and then i would like to use PHP to view data from DB, to update data from DB and to delete data from DB through PHP files(interface)我想知道如何使用 php-java 桥接但只能连接到数据库。然后我想使用 PHP 从数据库中查看数据,从数据库中更新数据并通过 PHP 文件从数据库中删除数据(界面)

What Database are you using?你用的是什么数据库?

If you use MySQL, SQLite or MongoDB, there is no need for a bridge since Java can connect to all of them directly.如果您使用 MySQL、SQLite 或 MongoDB,则无需桥接器,因为 ZD52387880E1EA2128117A72D 都可以直接连接3。 To connect to MySQL (for example) you would use JDBC .要连接到 MySQL(例如),您将使用JDBC

I've done it using Zend Server Community Edition - it has a java bridge option that I am currently using.我已经使用 Zend Server Community Edition 完成了它 - 它有一个我目前正在使用的 java 桥接选项。

However...I have a different opinion on how to get to your destination thast will be faster and easier.但是...我对如何更快更轻松地到达目的地有不同的看法。 To have the ability to switch out databases or use multiple databases is easy in php - use pdo, and you'll be able to keep it generic.在 php 中可以轻松切换数据库或使用多个数据库 - 使用 pdo,您将能够保持其通用性。 You can even connect to MSSQL if you wanted to - it's all there.如果你愿意,你甚至可以连接到 MSSQL——它就在那里。 With PDO prepared statements (your queries) you'll also have similiar security without creating an additional database layer.使用 PDO 准备好的语句(您的查询),您也将拥有类似的安全性,而无需创建额外的数据库层。

Please note: If you already have Java code already written to server as a model, however, rock out!请注意:如果您已经将 Java 代码作为 model 写入服务器,那么请滚开!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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