- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在阅读 Gilberto T. Garcia Jr 编写的 Lift 应用程序开发指南,但遇到了一个我似乎无法解决的问题。我已经复制了源代码 Chap06-map-table,并尝试修改它以与我的 IBM i(iSeries、AS/400、i5)数据库配合使用。我能够使用 Squeryl Record 使其与第一种连接类型一起工作。但是,我似乎不知道如何使用 JNDI 数据源使其工作。我花了几天时间在互联网上搜索设置示例,但没有找到涉及 DB/400 数据库连接的好示例。以下是我尝试启动容器时遇到的错误以及我为了使其工作而修改的代码。任何帮助,将不胜感激。jt4oo.jar (jtOpen) 中的数据源类似乎有一些选择,我不确定哪个是最好使用的,或者也许还有另一个。我已经对这三个中的每一个进行了尝试,并假设第一个是正确的。
com.ibm.as400.access.AS400JDBCManagedConnectionPoolDataSource
com.ibm.as400.access.AS400JDBCConnectionPoolDataSource
com.ibm.as400.access.AS400JDBCDataSource
谢谢。鲍勃
这是错误的开始:
> container:start
[info] jetty-8.0.4.v20111024
[info] No Transaction manager found - if your webapp requires one, please config
ure one.
[info] NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
[info] started o.e.j.w.WebAppContext{/,[file:/C:/Users/Bob/Lift26Projects/scala_
210/chap06-map-table/src/main/webapp/]}
[info] started o.e.j.w.WebAppContext{/,[file:/C:/Users/Bob/Lift26Projects/scala_
210/chap06-map-table/src/main/webapp/]}
18:21:47.062 [pool-7-thread-1] ERROR n.liftweb.http.provider.HTTPProvider - Fail
ed to Boot! Your application may not run properly
java.sql.SQLException: The application requester cannot establish the connection
. ("jdbc:as400://www.busapp.com;libraries=PLAY2TEST";naming=system;errors=full;)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:524) ~[jt
400-6.7.jar:JTOpen 6.7]
at com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConne
ction.java:3142) ~[jt400-6.7.jar:JTOpen 6.7]
at com.ibm.as400.access.AS400JDBCManagedDataSource.createPhysicalConnect...
我的 Build.sbt 文件:
name := "Lift 2.5 starter template"
version := "0.0.1"
organization := "net.liftweb"
scalaVersion := "2.10.0"
resolvers ++= Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
"staging" at "http://oss.sonatype.org/content/repositories/staging",
"releases" at "http://oss.sonatype.org/content/repositories/releases"
)
seq(com.github.siasia.WebPlugin.webSettings :_*)
unmanagedResourceDirectories in Test <+= (baseDirectory) { _ / "src/main/webapp" }
scalacOptions ++= Seq("-deprecation", "-unchecked")
env in Compile := Some(file("./src/main/webapp/WEB-INF/jetty-env.xml") asFile)
libraryDependencies ++= {
val liftVersion = "2.5"
Seq(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile",
"net.liftmodules" %% "lift-jquery-module_2.5" % "2.3",
"org.eclipse.jetty" % "jetty-webapp" % "8.0.4.v20111024" % "container",
"org.eclipse.jetty" % "jetty-plus" % "8.0.4.v20111024" % "container",
"ch.qos.logback" % "logback-classic" % "1.0.6",
"org.specs2" %% "specs2" % "1.14" % "test",
"net.liftweb" %% "lift-squeryl-record" % liftVersion % "compile",
"net.sf.jt400" % "jt400" % "6.7",
"org.liquibase" % "liquibase-maven-plugin" % "3.0.2"
)
}
这是我的 boot.scala 文件:
package bootstrap.liftweb
import _root_.liquibase.database.DatabaseFactory
import _root_.liquibase.database.jvm.JdbcConnection
import _root_.liquibase.exception.DatabaseException
import _root_.liquibase.Liquibase
import _root_.liquibase.resource.FileSystemResourceAccessor
import net.liftweb._
import util._
import Helpers._
import common._
import http._
import sitemap._
import Loc._
import net.liftmodules.JQueryModule
import net.liftweb.http.js.jquery._
import net.liftweb.squerylrecord.SquerylRecord
import org.squeryl.Session
import java.sql.{SQLException, DriverManager}
import org.squeryl.adapters.DB2Adapter
import javax.naming.InitialContext
import javax.sql.DataSource
import code.model.LiftBookSchema
/**
* A class that's instantiated early and run. It allows the application
* to modify lift's environment
*/
class Boot {
def runChangeLog(ds: DataSource) {
val connection = ds.getConnection
try {
val database = DatabaseFactory.getInstance().
findCorrectDatabaseImplementation(new JdbcConnection(connection))
val liquibase = new Liquibase(
"database/changelog/db.changelog-master.xml",
new FileSystemResourceAccessor(),
database
)
liquibase.update(null)
} catch {
case e: SQLException => {
connection.rollback()
throw new DatabaseException(e)
}
}
}
def boot {
// where to search snippet
LiftRules.addToPackages("code")
prepareDb()
// Build SiteMap
val entries = List(
Menu.i("Home") / "index", // the simple way to declare a menu
// more complex because this menu allows anything in the
// /static path to be visible
Menu(Loc("Static", Link(List("static"), true, "/static/index"),
"Static Content")))
// set the sitemap. Note if you don't want access control for
// each page, just comment this line out.
LiftRules.setSiteMap(SiteMap(entries: _*))
//Show the spinny image when an Ajax call starts
LiftRules.ajaxStart =
Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd)
// Make the spinny image go away when it ends
LiftRules.ajaxEnd =
Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd)
// Force the request to be UTF-8
LiftRules.early.append(_.setCharacterEncoding("UTF-8"))
// Use HTML5 for rendering
LiftRules.htmlProperties.default.set((r: Req) =>
new Html5Properties(r.userAgent))
//Init the jQuery module, see http://liftweb.net/jquery for more information.
LiftRules.jsArtifacts = JQueryArtifacts
JQueryModule.InitParam.JQuery = JQueryModule.JQuery172
JQueryModule.init()
}
def prepareDb() {
Class.forName("com.ibm.as400.access.AS400JDBCManagedConnectionPoolDataSource")
val ds = new InitialContext().lookup("java:/comp/env/jdbc/dsliftbook").asInstanceOf[DataSource]
runChangeLog(ds)
SquerylRecord.initWithSquerylSession(
Session.create(
ds.getConnection,
new DB2Adapter)
)
}
}
这是我的 jetty-env-xml 文件
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<New id="dsliftbook" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/dsliftbook</Arg>
<Arg>
<New class="com.ibm.as400.access.AS400JDBCManagedConnectionPoolDataSource">
<Set name="serverName">"jdbc:as400://www.[server].com;libraries=PLAY2TEST";naming=system;errors=full;</Set>
<Set name="user">[user]</Set>
<Set name="password">[password]</Set>
</New>
</Arg>
</New>
</Configure>
最佳答案
好的,我已成功建立连接。一个问题是 jetty-env-xml 文件中的引号。而且我使用的用户名/密码显然没有完成这项工作所需的权限,我不确定为什么,因为这是我用于所有 iSeries 开发的相同 ID/密码。因此,目前,我是另一个具有安全官员权限的用户配置文件,直到我弄清楚发生了什么或需要什么权限。
登录后,我无法为用户设置库列表,这导致 SQL 失败。它正在寻找与用户 ID 相同的库名称。目前,我通过创建一个与用户 ID 命名相同的新库来解决这个问题。
这里的另一个问题是,即使我同时提供了 ID 和密码,系统仍会提示我在连接之前输入 ID/密码。 ID 和 url 已填写,但密码始终需要重新输入。
我已经包含了 jetty-env-xml 文件和 boot.scala 文件的当前源代码。希望这可以帮助其他人。
感谢戴夫和詹姆斯的帮助!
鲍勃
boot.scala:
package bootstrap.liftweb
// import _root_.liquibase.database.DatabaseFactory
// import _root_.liquibase.database.jvm.JdbcConnection
// import _root_.liquibase.exception.DatabaseException
// import _root_.liquibase.Liquibase
// import _root_.liquibase.resource.FileSystemResourceAccessor
import net.liftweb._
import util._
import Helpers._
import common._
import http._
import sitemap._
import Loc._
import net.liftmodules.JQueryModule
import net.liftweb.http.js.jquery._
import net.liftweb.squerylrecord.SquerylRecord
import org.squeryl.Session
import java.sql.{SQLException, DriverManager}
import org.squeryl.adapters.DB2Adapter
import javax.naming.InitialContext
import javax.sql.DataSource
import code.model.LiftBookSchema
import com.ibm.as400.access.AS400JDBCManagedConnectionPoolDataSource
/**
* A class that's instantiated early and run. It allows the application
* to modify lift's environment
*/
class Boot {
// def runChangeLog(ds: DataSource) {
// val connection = ds.getConnection
// try {
// val database = DatabaseFactory.getInstance().
// findCorrectDatabaseImplementation(new JdbcConnection(connection))
// val liquibase = new Liquibase(
// "database/changelog/db.changelog-master.xml",
// new FileSystemResourceAccessor(),
// database
// )
// liquibase.update(null)
// } catch {
// case e: SQLException => {
// connection.rollback()
// throw new DatabaseException(e)
// }
// }
// }
def boot {
// where to search snippet
LiftRules.addToPackages("code")
prepareDb()
// Build SiteMap
val entries = List(
Menu.i("Home") / "index", // the simple way to declare a menu
// more complex because this menu allows anything in the
// /static path to be visible
Menu(Loc("Static", Link(List("static"), true, "/static/index"),
"Static Content")))
// set the sitemap. Note if you don't want access control for
// each page, just comment this line out.
LiftRules.setSiteMap(SiteMap(entries: _*))
//Show the spinny image when an Ajax call starts
LiftRules.ajaxStart =
Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd)
// Make the spinny image go away when it ends
LiftRules.ajaxEnd =
Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd)
// Force the request to be UTF-8
LiftRules.early.append(_.setCharacterEncoding("UTF-8"))
// Use HTML5 for rendering
LiftRules.htmlProperties.default.set((r: Req) =>
new Html5Properties(r.userAgent))
//Init the jQuery module, see http://liftweb.net/jquery for more information.
LiftRules.jsArtifacts = JQueryArtifacts
JQueryModule.InitParam.JQuery = JQueryModule.JQuery172
JQueryModule.init()
}
def prepareDb() {
Class.forName("com.ibm.as400.access.AS400JDBCManagedConnectionPoolDataSource")
val ds = new InitialContext().lookup("java:/comp/env/jdbc/dsliftbook").asInstanceOf[DataSource]
// runChangeLog(ds)
SquerylRecord.initWithSquerylSession(Session.create(ds.getConnection, new DB2Adapter)
)
}
}
jetty-env-xml
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<New id="dsliftbook" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/dsliftbook</Arg>
<Arg>
<New class="com.ibm.as400.access.AS400JDBCManagedConnectionPoolDataSource">
<Set name="serverName">www.[server].com</Set>
<Set name="user">DBUSER</Set>
<Set name="password">DBUSER</Set>
</New>
</Arg>
</New>
</Configure>
关于scala - 请求者无法建立连接。 jetty 、电梯/Scala、iSeries DB2/400,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20603166/
我在 Linux Centos 服务器上使用 iSeries Access ODBC 驱动程序来使用 PHP/PDO 访问 as/400。 当网页进行 ODBC 查询时,它会写入 QZDASOINIT
是否有将表中的数据导出为 CSV 格式的 iSeries 命令? 我知道 Windows 实用程序,但由于它需要自动运行,我需要从 CL 程序运行它。 最佳答案 您可以使用 CPYTOIMPF 并指定
哪些工具可用于加密或密码保护 IFS 上存储的文件? *集成文件系统,可从 Windows 访问 最佳答案 您可以设置对象安全性,以便只有某些用户可以查看该文件。 有可供购买的加密工具。还有一些内置的
我知道我们很少,我们这些穷人使用 iSeries for DB2/AS400,但我希望有人能回答这个简单的问题。有什么方法可以在不使用两行 SQL 的情况下从插入语句返回标识值?我被迫在 C# 中使用
我有一个包含数千行的 iSeries 表,并且刚刚添加了一个新的数字/整数列作为表键。这基本上是一个整数 id 列 (1,2,3...)。 假设我无法将此列设为自动递增列。有没有一种简单的方法可以为每
我想更改我们在 iseries 服务器上运行的 mysql 服务器。更改将增加 mysql 将使用的内存量。在进行此更改之前,我想知道我们的系列中有多少内存?在任何给定时间点大约有多少可用?我看到了
我的主要语言是 vb/c#.net,我想制作一个带有菜单系统的控制台程序。 如果你们中有人使用过类似“dos”的程序或来自 IBM 的 iSeries,那么这就是我想要的风格。 所以,想知道是否有人知
我花了很多时间试图解决这个问题。所以也许任何人都可以在这里帮助我,请 :(。 我得到了一个 ibm-iaccess64.rpm,然后使用 alien 将它转换为 deb。然后安装它:sudo dpkg
我正在尝试在 iSeries 上创建一个新命令,其中一个参数必须是使用标准 LIBRARY/FILE MEMBER 语法的文件名,例如 MYCMD FILE(MYLIB/MYFILE MYMEMBER
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
谁能给我一个线索,如何在 DB2 iSeries 中创建/调用函数正则表达式语法。 例子: DECLARE VAL VARCHAR (16) DEFAULT 'abcde1235876e' ; DEC
有没有办法从 iSeries 终端发送电子邮件,从 IFS 添加附件?我知道如何使用 SNDDST 实用程序发送普通电子邮件。 最佳答案 有两种主要方法可以做到这一点。 Do-It-Yourselfe
在项目中实现敏捷需要具备重构能力。这并不是必须的,但代码重构已被证明是一种很好的工程实践。 在iSeries平台上的敏捷(Scrum)项目中,需要在RPG、RPG LE中开发(新代码和对遗留代码的修改
我已尝试使用以下脚本向我的列添加非空约束。 ALTER TABLE MYDB.RULES ALTER TYPEID SET NOT NULL; ALTER TABLE MYDB.RULES ALTER
我一直在测试 Java 程序以从 iSeries 连接到 Oracle 数据库。 如果我对连接字符串进行硬编码,一切都会正常。 如果我将连接字符串的详细信息作为参数传递,然后在 Java 程序中构建连
我正在尝试使用 .net 类连接到 AS400 服务器。 我添加了对 IBM.Data.DB.iSeries 的引用,并使用以下代码: var conn = new iDB2Connection("D
我已尝试使用以下脚本向我的列添加非空约束。 ALTER TABLE MYDB.RULES ALTER TYPEID SET NOT NULL; ALTER TABLE MYDB.RULES ALTER
我有一个脚本,如果它试图创建的任何过程已经存在,它就会失败。如果此过程已创建,我如何检查/删除? 最佳答案 我猜是这样的: IF EXISTS ( SELECT * FROM SYSP
有没有办法可以在 QSH 命令中加载属性文件。 问题是我的系统正在 Java 1.4 版本上运行,而我的程序仅在 Java 1.6 版本上运行。所以我写了一个属性文件,上面写着,采用 1.6 版本,但
我有一个 Java 应用程序,我将使用 CommandCall 远程调用它。 目前我是放在/home/username文件夹下,并在JAVA命令的CLASSPATH参数中指定这个文件夹。 但现在我必须
我是一名优秀的程序员,十分优秀!