play! 1.2.4からSQL Serverに接続するための設定方法
play! 1.2.4からSQL Serverに接続するための設定方法です。自分用のメモです。
1. jtds-*.jarをlibディレクトリに入れる
The jTDS Projectからjtds-*.jar(*にはバージョンが入ります)をダウンロードし、libディレクトリに入れます。
2. application.confを書き換える
conf/application.confに次のように記入します。
db.driver=net.sourceforge.jtds.jdbc.Driver db.url=jdbc:jtds:sqlserver://SERVER_NAME;databaseName=DB_NAME; db.user=USER db.pass=PASS jpa.dialect=org.hibernate.dialect.SQLServerDialect
これでSQL Serverに接続できるようになります。
Playフレームワークのインストール方法
Playフレームワーク 2.0.1 をインストールしたので自分用のメモ。環境はWindowsXP。
JDKをインストールする
ここでJDK Downloadと書かれたボタンをクリックし、自分の環境に合うものをダウンロードします。私はjdk-7u4-windows-i586.exeをダウンロードしました。これをインストールします。
Access VBAでオブジェクトをエクスポートするコード
以前に書いた「Excel VBAでモジュールをエクスポートするコード」(d:id:paz3:20090813:1250134172)のAccess版です。
使い方
1. AccessのVisual Basic Editor(VBE)を表示します。
2. 新規モジュールに下記のコードを記入し、「ModuleExporter」のような適当な名前で保存します。
3. ExportModulesプロシージャを実行します。
モジュールが格納されたファイルが現在のMDBファイルと同じ場所に出力されます。出力されるオブジェクトは以下の種類のものです。
- クエリー(拡張子 .qry)
- フォーム(拡張子 .frm)
- レポート(拡張子 .rpt)
- マクロ(拡張子 .mcr)
- モジュール(拡張子 .mdl)
オブジェクトをエクスポートするコード
Option Explicit '現在のMDBのオブジェクトをエクスポートする Public Sub ExportModules() Dim outputDir As String Dim currentDat As Object Dim currentProj As Object outputDir = GetDir(CurrentDb.Name) Set currentDat = Application.CurrentData Set currentProj = Application.CurrentProject ExportObjectType acQuery, currentDat.AllQueries, outputDir, ".qry" ExportObjectType acForm, currentProj.AllForms, outputDir, ".frm" ExportObjectType acReport, currentProj.AllReports, outputDir, ".rpt" ExportObjectType acMacro, currentProj.AllMacros, outputDir, ".mcr" ExportObjectType acModule, currentProj.AllModules, outputDir, ".mdl" End Sub 'ファイル名のディレクトリ部分を返す Private Function GetDir(FileName As String) As String Dim p As Integer GetDir = FileName p = InStrRev(FileName, "\") If p > 0 Then GetDir = Left(FileName, p - 1) End Function '特定の種類のオブジェクトをエクスポートする Private Sub ExportObjectType(ObjType As Integer, _ ObjCollection As Variant, Path As String, Ext As String) Dim obj As Variant Dim filePath As String For Each obj In ObjCollection filePath = Path & "\" & obj.Name & Ext SaveAsText ObjType, obj.Name, filePath Debug.Print "Save " & obj.Name Next End Sub
ちなみに出力されたファイルはLoadFromTextコマンドで読み込んでオブジェクトに戻せます。