DBをMySQLに変更

標準ではSQLiteが動くので、それをMySQLに換えてみる。でも、Google Gearsとか使うつもりだったら、SQLiteのままの方がいいのかな?

参考サイト

本家Aptana なにからなにまで、ありがとうございます。

Running Jaxer with MySQL
http://www.aptana.com/node/143

使用するDBを設定

jaxerサーバの使用するDBの情報が記述された設定ファイルを変更すればいいだけなんだけど、1. 設定ファイルの場所 と、2. 設定方法をメモする。

  1. 設定ファイルの場所

/local_jaxer/config.js

なんですが、開発環境付属のjaxerサーバ使うときは、eclipseのpluginフォルダfindかけないとわかんない。と思ったら、eclipse上のserversペインのJaxer Internal Server の行を選択して、command + クリック すると、[Edit Jaxer Files] - [Edit config.js]というのが選択できて、該当のconfig.jsを開いてくれる。

  1. 設定内容

すでに設定例が記述されてて、それをちょっと修正してコメントアウト外せばそれで終了。Jaxerサーバ用のDBと自分で作るアプリケーション用のDBのそれぞれ別個に設定できる。とりあえず、アプリケーションだけで使えればよいので、その分だけコメントアウトを外す。
リンク先のaptanaのサイトでは、33-43行がアプリケーション用、44-54行がJaxer Server用となっているが、最新のAptana Studio に付属のサーバでは、47-57行がアプリケーション用、58-68行がJaxer Server用の模様

// To have Jaxer use MySQL rather than SQLite, for its own needs or your applications or both,
// use settings similar to the following:
Config.DB_IMPLEMENTATION = "MySQL";
Config.DB_CONNECTION_PARAMS =
{
HOST: "127.0.0.1",
PORT: 3306, // This uses a port different than the default of 3306, to minimize conflicts with existing installs
NAME: "myApplicationDB",
USER: "root",
PASS: "",
CLOSE_AFTER_EXECUTE: false,
CLOSE_AFTER_REQUEST: true
};
// Config.DB_FRAMEWORK_IMPLEMENTATION = "MySQL";
// Config.DB_FRAMEWORK_CONNECTION_PARAMS =
// {
// HOST: "127.0.0.1",
// PORT: 4417, // This uses a port different than the default of 3306, to minimize conflicts with existing installs
// NAME: "jaxerFrameworkDB",
// USER: "root",
// PASS: "",
// CLOSE_AFTER_EXECUTE: false,
// CLOSE_AFTER_REQUEST: true
// };