+ Reply to Thread
Results 1 to 6 of 6

Thread: ES 5.2 DatabaseJDBCPlugin - Pure Server side query

  1. #1
    Senior Member
    Join Date
    Jun 2011
    Posts
    126
    Thanks
    6
    Thanked 1 Time in 1 Post

    Question ES 5.2 DatabaseJDBCPlugin - Pure Server side query

    (1) In the plus-in example

    Why do I need to require to
    import com.electrotank.electroserver5.extensions.BasePlug in;
    import com.electrotank.electroserver5.extensions.api.valu e.EsObject;
    import com.electrotank.electroserver5.extensions.api.valu e.EsObjectRO;

    ----------------------

    (2) Do I need to re-Develop with the JDBC connection to a class?
    like:
    jConnect.db.Host("localhost");
    jConnect.db.UserName("sqlUName");
    jConnect.db.Password("mypassword");

    jConnect.db.select("*");
    jConnect.db.where("uID", "1234");
    jConnect.db.from("myTable");
    jConnect.db.join("profileTable", "profileTable.uID = myTable.uID", "INNER");
    jConnect.db.limit(1);

    result = jConnect.db.query();


    (3) I am confused getting started to connect the database
    Where to set the MySQL host/username/password/database?
    it need to create a *.sql file every time to query a DB?

    (4) how can I connect the Component if I have a Pure handle database class, so that I dont need to re-write the *.sql like in the sample? I wanna to set that jConnect to a component and use on all other plug-in or class?

  2. #2
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,214
    Thanks
    80
    Thanked 1,087 Times in 1,076 Posts
    Have you read the Database Examples tutorial? I know that it doesn't mention DatabaseJDBC, but one of the three examples it discusses might be closer to what you need.

    You do not need to create a .sql file for each query. You can create an sql String instead.

    Tell me exactly which class in which of the various database examples you are looking at and I can give you better advice.

    It is possible that there might be unused imports in the classes. I'd have to look. If the class extends BasePlugin, then it would need to import BasePlugin because that's in a different package - that's something that Java requires.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  3. #3
    Senior Member
    Join Date
    Jun 2011
    Posts
    126
    Thanks
    6
    Thanked 1 Time in 1 Post
    for a Framework base like Active Record Query is most user friendly ~
    PS. All values passed to function are escaped automatically


    For the ES Example I was look at:

    DBLoginMySQL
    ConnectionPool
    Database with JDBC

    I mean if have have 10 server side script... I need to import 10 duplicate database class to ES extension?
    Or I can public the ES Extension as a Component to let another extension to access it?

    Reference:
    Connector/J
    Last edited by Cusco; 06-18-2011 at 04:20 PM.

  4. #4
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,214
    Thanks
    80
    Thanked 1,087 Times in 1,076 Posts
    ES5 plugins can use anything that Java can do, which includes doing an HTTP Post or Get to a PHP server. It's faster to use a direct connection to the database.

    We provide 4 examples using databases. That should be enough information for you to figure out how to use your own favorite type of database framework. I'll answer specific questions on how to use ES5 or about our examples, and give basic advice on best practices. Implementing your application to your specs is not in the scope of this forum.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  5. #5
    Senior Member
    Join Date
    Jun 2011
    Posts
    126
    Thanks
    6
    Thanked 1 Time in 1 Post
    Thanks =D I will have a look for the example again

  6. #6
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,214
    Thanks
    80
    Thanked 1,087 Times in 1,076 Posts
    If it helps, most applications have just a single extension, with everything in it. That allows them to share the same managed objects, reference the same Java object classes, etc. Our examples have each example in its own extension so that you only have to deploy the parts that you want to use, and because in some cases different example extensions won't live happily on the same server.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts