文章来自于http://docs.google.com/Doc?id=dhg923vj_2ghr8q9f3#PHP
Overview
jiql is a JDBC wrapper for accessing Google DataStore on Google App Engine for JAVA.
jiql supports the use of standard SQL as a method for accessing
the DataStore
Architecture
jiql introduces a concept called "Table Leafs". Table Leafs
are DataStore Kinds that can be dynamically added or
chained together in infinite amounts to represent a Table.
Table Leafs provides a standard method, with SQL, to
retrieve entities of more than the "1000 limit" at a time.
For optimization, entities in the same Table Leaf, has
the same entity group parent. That means all of the
members in the Table Leaf, are located in the same
network node of the Google DataStore Cloud, for faster
access.
To disable Table Leaves, add the following at the end of the
CREATE TABLE statement:
tableleafs=false
Quickstart
Download
jiql.jar
java database engine and driver library and place under WEB-INF/lib/
NOTE: The appengine-api.jar must also be placed under WEB-INF/lib. This file comes
with the GAE SDK.
Follow the steps below to create a JDBC connection with jiql on
GAE-J in your JAVA code:
String url = "jdbc:jiql://local";
String password = "";
String user = "";
Properties props = new Properties();
props.put("user",user);
props.put("password",password);
Class clazz = Class.forName("org.jiql.jdbc.Driver");
Driver driver = (Driver) clazz.newInstance();
Connection Conn = driver.connect(url,props);
Below is the link to a GAE-Ready JDBC guestbook application:
After downloading jiql-jdbc-guestbook.war, unpack to your GAE Application directory.
Edit the ./WEB-INF/appengine-web.xml file and add your GAE Application ID.
Upload to Google App Engine for JAVA.
to start using the JDBC guestbook application.
The source code may also be downloaded at the following URL:
Remote Access
You can access Google DataStore from a remote client via the JiqlServlet.
This requires setting up the GAE-J Server as well as the Client Application configuration.
GAE-J Server Configuration
First configure the JiqlServlet in the web.xml like so:
<servlet>
<servlet-name>jiqlservlet</servlet-name>
<servlet-class>org.jiql.JiqlServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>jiqlservlet</servlet-name>
<url-pattern>/jiqlservlet</url-pattern>
</servlet-mapping>
Next add authenication information in the jiql.properties file:
File: ./WEB-INF/jiql.properties
Entries:
user=admin
password=jiql
Client Application Configuration
Follow the steps below to create a JDBC connection with jiql on the Client in your JAVA code:
String url = "jdbc:jiql:https://yourapp.appspot.com/jiqlservlet";
String user = "admin";
String password = "jiql";
//or
//String url = "jdbc:jiql:https://yourapp.appspot.com/jiqlservlet?user=admin&password=jiql";
Properties props = new Properties();
props.put("user",user);
props.put("password",password);
Class clazz = Class.forName("org.jiql.jdbc.Driver");
Driver driver = (Driver) clazz.newInstance();
Connection Conn = driver.connect(url,props);
Required Libraries for Remote Client
jiql.jar
appengine-api.jar
Apache Commons HTTPClient - you may download the bundled JAR
here
.
jiql has limited support for Transactions.
Transactions support is based on the Google DataStore Transaction
engine. Google DataStore does not support Global Transactions.
A Transaction is limited to Entities/Rows within a Group or Table/Kind.
This mean you are not able to perform operations on multiple
Tables/Kinds within the same Transaction. To enable Transactions,
set the enable.transactions
Connection property option to true.
NOTE: Transaction are NOT supported for Remote connections.
Limitations
FILTERS
For large data sets, the left most filter, should not return
a result set of more than about a couple thousand items.
A timeout may result. In this case you should try a narrower
filter. If the query is comprised of multiple filters, you may
place the filter that returns the least items, to the left of all
the other filters.
JOINS
When working with large data sets, JOINS should be combined with
at least 1 filter acting on a specific table. Otherwise, the query would
involve traversing the entirety of all the tables in the JOIN. Such
an operation is time consuming and may create a Google App Engine Timeout
if the operation exceeds 30 seconds.
Optional Properties
date.format
Specifies the Date Format of a DATETIME field.
e.g. date.format=yyyy/MM/dd
enable.transactions
Enable Transactions (please refer to the Transactions
topic)
e.g. enable.transactions=true
DatabaseProductVersion
Used to emulate other Databases, such as MySQL.
e.g. DatabaseProductVersion=4.0.0
DriverVersion
Used to emulate other Databases, such as MySQL.
e.g. DriverVersion=mysql-connector-java-5.0.4 ()
Catalog
Used to specify a Database Catalog.
e.g. Catalog=jiql
MetaCache
Used for Caching MetaData, such as DatabaseMetaData.
e.g. MetaCache=true
In addition to standard SQL functions, there are a number of jiql specific functions.
LOAD
LOAD DATA INTO TABLE table_name INTEXT column1,column2
1,'text1'
2,'text2'
tableleafs
specify whether to use Table Leafs or not (default true).
tableleafs
=false
prefix
specify whether to add a prefix to Tables created by jiql (default true)
prefix
=false
prefix_value
specify whether to add a customized prefix name to Tables created by jiql (default jiql)
prefix_value
=jiql
How to run PHP with your same MySQL queries
Running PHP on Google App Engine for JAVA requires jiql with a modified version of Quercus
,
a Java implementation of PHP 5. The following URL has the downloads:
After downloading jiql-quercus.war, unpack to your GAE Application directory.
Add your PHP files to the root of the unpacked Quercus application.
Edit the ./WEB-INF/appengine-web.xml file and add your GAE Application ID.
Upload to Google App Engine for JAVA.
Below is a simple PHP application from PLUS2NET as a starting PHP example:
分享到:
相关推荐
This practical guide shows intermediate and advanced web and mobile app developers how to build highly scalable Java applications in the cloud with Google App Engine. The flagship of Google's Cloud ...
A good book to learn Google App Engine.
Google App Engine Documentation
在搭建WebRTC(AppRTC)时,我们会遇到需要部署Google App Engine的难题,并且最近墙的厉害,所以我特地把我珍藏的Google App Engine 最新版(2020-7-5)分享出来,希望可以方便想搭建WebRTC(AppRTC)的同学们
clock.rar 这是我今天做的一个基于google app engine写的一个在该平台上开发app的示例,通过该示例的学习,我们可以很快上手学会怎样在GAE上开发属于你的应用程序了,希望对大家有用!
Google App Engine文档
Google App Engine for Java 中文指南,Google App Engine for Java 中文指南
云应用开发——Google App Engine & Google Web Toolkit入门指南 Google App Engine入门 Google App Engine 开发人员指南
google app Engine for java中文api,
Using Google App Engine
Google App Engine is a key component of the Google Cloud Platform and one of the most comprehensive cloud services. Together with Python, the first programming language ever supported by the platform,...
Google App Engine is a web application hosting service. By “web application,” we mean an application or service accessed over the Web, usually with a web browser: storefronts with shopping carts, ...
Google云端的一个重要部分,主要介绍了Google中App Engine的限制。
Eclipse Google 插件 Google App Engine SDK for Java Google App Engine文档 按钮 Google App Engine 开发包
Google App Engine 入门
云端代码Google App Engine编程指南 人民邮电出版社 高清带书签
Google App Engine 入门教程 eclipse插件 详情请参考我的博客
一个应该在Google App Engine 上的一个实例。用Java语言编写,里面包含源代码。致以Google App Engine是什么,请Google。 实例部署的地址是:http://hellojavaweb.appspot.com
appengine-java-sdk-1.3.1 GoogleApp开发的SDK(Java版)