简体   繁体   中英

How to connect Oracle Database using Javascript & HTML

我在后端有一个 Oracle 数据库,我想用 javascript 创建一个登录页面,所以任何人都可以告诉我如何在 Javascript 和 Oracle 数据库之间创建连接。

您无法使用客户端脚本连接数据库,您需要使用服务器端脚本(例如 PHP、Ruby、Java、.Net)进行数据库连接

You can use node js at the server side which is a javascript, so that you can create a connection to Oracle Database. https://nodejs.org/en/

您需要创建一个服务器端 API 来访问您的数据库,然后从您的 HTML5 应用程序中调用该 API。

You can create a PHP server side app. this app access your database (for example MYSQL) and you can get run database queries by sending special commands via ajax to server app. Example Ajax Call:(Using jQuery)

$.ajax({
url:'myapp.php',
type:'POST',
context: $(this),    //Refere to your correct element
data: {query:'my-example-query'}
dataType: 'json',
timeout: '800'
});

After that you create a server side PHP app like this:

<?php
if(isset($_POST['query'])){
 //Execute query or another conditional if ..else
}

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