Connecting to the datastore

13 views
Skip to first unread message

genjlc

unread,
Jul 22, 2010, 4:28:47 PM7/22/10
to Google App Engine
I've made a simple Client/Server/Shared app that I would like to add
data to. I am trying to use Google's data store.

I have been reading for two days and have yet to find a step by step
checklist/example of how to establish a connection to the cloud, in
Java, without resorting to PHP. There seems to be lots of information
on what to do once the connection is made, but no information on
actually establishing the connection

Christoffer Viken

unread,
Jul 22, 2010, 4:34:37 PM7/22/10
to google-a...@googlegroups.com
are you trying to use it trough another platform?
You can't connect to the datastore, you can only use it (from within a AppEngine app) as i understand it (and that makes sense)
You could expose the datastore to your app (on 3p server) trough a REST API that you deploy to AppEngine (unless that breaks the TOS)


--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.


genjlc

unread,
Jul 24, 2010, 6:06:02 PM7/24/10
to Google App Engine
I am trying to connect to the datastore from within the confines of an
app. The app (client) is currently looping through an array of
strings, where every string is a URL to a pic. The client is
periodically bugging the server for some data that it then displays to
the user. This is all static and has no user interaction.
http://cd-jks-countdown-app-v2.appspot.com/

The ideal is to allow the user to search the DB by any number of
filters (first name, last name, event, ,,, ) So I am setting up the
client to capture the user's search parameters and pass them to the
server, I am trying to get the server to build a query and ask the DB
for the correct result set. The server would then pass the list of
strings to the client and the client would only loop through those
photos. This implies, however, that I can:

1. Connect to the DB.
2, Pass the query to the DB and get a result set back
3. That I can load data to the DB to be queried against.

I think I have the "Add data" part correct:
PersistenceManager.persist(entity).
I think I have the entity correct. Basically a standard bean with
getter and setters for the instance variables, with the exception of
the primary kay (auto assigned Long), and a few annotation tags.
I think I have the query portion correct. Dynamically builds the
WHERE clause based on the parameters passed to it: if (firstName !=
null) query.append(blah)
(There is lots of information, online, about what to do when you have
the connection)

I haven't, however, figured out how to create the DB connection for
the server to use.
(There isn't any information about how to establish the connection, in
Java at least)

This is supposed to be a learning app, its only my second GWT app, but
it is rapidly becoming an exercise in extreme frustration.
> > google-appengi...@googlegroups.com<google-appengine%2Bunsubscrib­e...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.- Hide quoted text -
>
> - Show quoted text -

Luis Daniel Mesa Velasquez

unread,
Jul 25, 2010, 3:34:14 PM7/25/10
to Google App Engine
1. Copy JARs
2. Create jdoconfig.xml
3. Obtain a PersistenceManager

http://code.google.com/appengine/docs/java/datastore/usingjdo.html

What do you exactly mean by "create the DB connection"?

Just obtain the persistence manager ...and persist.

On Jul 24, 5:06 pm, genjlc <jeremy.sh...@gmail.com> wrote:
> I am trying to connect to the datastore from within the confines of an
> app.  The app (client) is currently looping through an array of
> strings, where every string is a URL to a pic.  The client is
> periodically bugging the server for some data that it then displays to
> the user.  This is all static and has no user interaction.http://cd-jks-countdown-app-v2.appspot.com/
> > >http://groups.google.com/group/google-appengine?hl=en.-Hide quoted text -

genjlc

unread,
Jul 26, 2010, 2:56:35 PM7/26/10
to Google App Engine
Ok I think I was making the whole thing harder than it had to be.
Additionally, I did ALLOT of reading to try and find an example of how
to store and retrieve data from Google's Data store. There was some
stray code left over from one of those early attempts that was
detonating. Everything appears to be working, except that my query is
returning an empty set when it shouldn't ... Time to do a SELECT *
and see if the data is actually there.

On Jul 25, 1:34 pm, Luis Daniel Mesa Velasquez
> > > >http://groups.google.com/group/google-appengine?hl=en.-Hidequoted text -
>
> > > - Show quoted text -- Hide quoted text -

Luis Daniel Mesa Velasquez

unread,
Jul 31, 2010, 9:28:17 PM7/31/10
to Google App Engine
If the Set is an attribute of another persisted entity, check the
default prefetch group setting... so that when an entity is loaded,
the collection which is an attribute is also loaded in the same
request. Good luck! :)
> > > > >http://groups.google.com/group/google-appengine?hl=en.-Hidequotedtext -
Reply all
Reply to author
Forward
0 new messages