添加oracle驱动包:
在lib中添加ojdbc6.jar
在controller中配置插件:
/** * 配置插件 */ public void configPlugin(Plugins me) { /*// 配置C3p0数据库连接池插件 C3p0Plugin c3p0Plugin = new C3p0Plugin(getProperty("jdbcUrl"), getProperty("user"), getProperty("password").trim()); me.add(c3p0Plugin); // 配置ActiveRecord插件 ActiveRecordPlugin arp = new ActiveRecordPlugin(c3p0Plugin); me.add(arp); arp.addMapping("blog", Blog.class); // 映射blog 表到 Blog模型 默认是id arp.addMapping("em_messages_entities","uuid", EMMessagesEntities.class); // 映射em_messages_entities 表到 EMMessagesEntities模型 arp.addMapping("em_messages_bodies","msg_id", EMMessagesBodies.class); // 映射em_messages_bodies 表到 EMMessagesBodies模型 msg_id为表的主键名 arp.addMapping("em_user","username", EMUser.class); // 映射em_user 表到 UserUploadVideo模型 rowid为表的主键名 arp.addMapping("upload_user_video","videoname", UserUploadVideo.class); // 映射upload_user_video 表到 UserUploadVideo模型 videoname为表的主键名*/ /*Oracle 配置*/ C3p0Plugin cp = new C3p0Plugin(getProperty("jdbcUrl"), getProperty("user"), getProperty("password").trim()); //配置Oracle驱动 cp. setDriverClass("oracle.jdbc.driver.OracleDriver"); me.add(cp); ActiveRecordPlugin arp = new ActiveRecordPlugin(cp); me.add(arp); // 配置Oracle方言 arp.setDialect(new OracleDialect()); // 配置属性名(字段名)大小写不敏感容器工厂 arp.setContainerFactory(new CaseInsensitiveContainerFactory()); // arp.addMapping("user", "user_id", User.class); // arp.addMapping("EM_MESSAGES_ENTITIES","uuid", EMMessagesEntities.class); // 映射em_messages_entities 表到 EMMessagesEntities模型 // arp.addMapping("EM_MESSAGES_BODIES","msg_id", EMMessagesBodies.class); // 映射em_messages_bodies 表到 EMMessagesBodies模型 msg_id为表的主键名 arp.addMapping("EM_USER","username", EMUser.class); // 映射em_user 表到 UserUploadVideo模型 rowid为表的主键名 // arp.addMapping("UPLOAD_USER_VIDEO","videoname", UserUploadVideo.class); // 映射upload_user_video 表到 UserUploadVideo模型 videoname为表的主键名 }
配置文件:
jdbcUrl =jdbc:oracle:thin:@localhost:1521:jfinalemchat
user = SCOTT
password =123456789
devMode = true
注:其中:jfinalemchat为你的数据库sid
右键-->属性-->
"listener does not currently know of SID given in connect descriptor"异常:
先打开listener.ora文件:
F:\app\qianhua\product\11.2.0\dbhome_1\NETWORK\ADMIN
# listener.ora Network Configuration File: F:\app\qianhua\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = F:\app\qianhua\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:F:\app\qianhua\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(GLOBAL_DBNAME =
jfinalemchat )
(ORACLE_HOME = F:\app\qianhua\product\11.2.0\dbhome_1)
(SID_NAME = jfinalemchat
)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = F:\app\qianhua
附件资源:
账号:
http://www.blogjava.net/wangdetian168/archive/2013/09/09/403858.html
下载:
安装说明:
http://www.jb51.net/article/32616.htm
使用说明:
数据库使用详解:[3]SQL Developer如何配置
http://jingyan.baidu.com/article/e4511cf33f289e2b845eafb6.html
创建新的数据库:
http://jingyan.baidu.com/article/90bc8fc80c01f2f653640c1f.html
使用Oracle SQLDeveloper连接数据库并创建用户
http://blog.csdn.net/xw13106209/article/details/6594738
操作:
Oracle打开cmd命令窗口 输入 SQLPLUS USERNAME/[email protected]_NAME
SYS密码:
如果忘记了,可以采用如下命令修改SYS密码。
1.首先登陆本地服务器
2.进入命令行
2.sqlplus / as sysdba
4.alter user sys identified by ‘输入密码‘。
http://blog.csdn.net/zzjjian333/article/details/8286341
权限不足:
以SYS登录,然后执行:GRANT CREATE ANY TABLE TO SCOTT
浏览器打开oracle操作界面:
https://主机名:1158/em
http://blog.csdn.net/wl_ldy/article/details/5920146