`
itnumone
  • 浏览: 6143 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类

Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver grails

 
阅读更多

将ojdbc14.jar加到grails项目中的lib下,将conf包下的DataSource.groovy文件改为dataSource {

    pooled = true
    driverClassName = "oracle.jdbc.driver.OracleDriver"
    username = "scott"
    password = "xx"
}
hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = false
    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
    development {
        dataSource {
            dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
            url = "jdbc:oracle:thin:@localhost:1521:orcl"
        }
    }
    test {
        dataSource {
            dbCreate = "update"
            url = "jdbc:oracle:thin:@localhost:1521:orcl"
        }
    }
    production {
        dataSource {
            dbCreate = "update"
            url = "jdbc:oracle:thin:@localhost:1521:orcl"
            pooled = true
            properties {
               maxActive = -1
               minEvictableIdleTimeMillis=1800000
               timeBetweenEvictionRunsMillis=1800000
               numTestsPerEvictionRun=3
               testOnBorrow=true
               testWhileIdle=true
               testOnReturn=true
               validationQuery="SELECT 1"
            }
        }
    }
}

 运行run as grails command(run-app)后提示Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver

解决方法是(通过stackoverflow找到答案)

   右击项目-grails tools-open gails command prompt(alt+shift+ctrl+G) 输入clean  然后输入compile --refresh-dependencies

  此时再运行项目,并没有报错,在浏览器能正常打开 http://localhost:8080/testgrails说明项目运行成功

在pl/sql查看项目中的表是否存在于oracle数据库中

 

  显示表:
select  * from tab                
显示表结构:
   select   *   from   user_tab_columns   where   table_name   =   upper('race')   在sqlplus输入desc race即可
 

 

分享到:
评论
1 楼 laoma036912 2013-08-21  
Thank you!

相关推荐

    Definitive.Guide.to.Grails.part2

    Definitive.Guide.to.Grails.part2

    Apress.Beginning.Groovy.and.Grails.From.Novice.to.Professional.Jun.2008

    《Apress.Beginning.Groovy.and.Grails.From.Novice.to.Professional.Jun.2008》这本书深入浅出地介绍了Groovy语言和Grails框架,旨在帮助初学者快速掌握这两项技术并转化为专业人士。Groovy和Grails是Java生态中的...

    ds_test.rar_ds test_grails_oracle

    driverClassName = "oracle.jdbc.driver.OracleDriver" username = "your_oracle_username" password = "your_oracle_password" url = "jdbc:oracle:thin:@localhost:1521:your_oracle_service_name" } ``` 在...

    The.Definitive.Guide.to.Grails.Second.Edition.2009

    根据提供的文件信息,我们可以推断出这是一本关于Grails框架的权威指南书籍的第二版,出版于2009年。此书由Graeme Rocher和Jeff Brown合著,旨在为读者提供深入理解Grails框架所需的知识和技术。下面我们将从几个...

    Apress.Beginning.Groovy.and.Grails.From.Novice.to.Professional.2008.rar

    《 Beginning Groovy and Grails: From Novice to Professional 2008》是Apress出版社在2008年发布的一本专为初学者至专业人士准备的编程书籍,主要介绍了Groovy和Grails两种强大的开源技术。这本书的核心目标是帮助...

    grails-acegi-0.5.2.zip

    《Grails Acegi 0.5.2:构建安全的Web应用》 Grails Acegi 0.5.2是一个针对Grails框架的权限管理插件,它基于Spring Security(原名为Acegi Security)的核心机制,为Grails应用程序提供了强大的身份验证和授权功能...

    grails.2.5.1 环境

    grails.2.5.1 环境,适用于Windows下Grails开发,具体配置请参照https://jingyan.baidu.com/article/86fae3461af6cf3c49121a91.html

    Grails Oracle PostgreSQL

    标题中的“Grails Oracle PostgreSQL”揭示了我们正在讨论一个关于Grails框架与Oracle及PostgreSQL数据库集成的主题。Grails是一个基于Groovy语言的开源Web应用框架,它简化了开发过程,提供了丰富的插件系统和MVC...

    grails 配置mongodb数据库

    compile 'org.grails.plugins:mongodb:5.2.0' } ``` 然后运行`grails refresh-dependencies`命令,以更新项目依赖并引入MongoDB插件。 接下来,我们配置Grails与MongoDB的连接。在`Config.groovy`文件中,添加...

    精通grails.rar

    《精通Grails》 Grails,作为一款基于Groovy语言的开源Web应用框架,深受Java开发者喜爱。它采用“约定优于配置”的理念,极大地提高了开发效率。本资料集旨在帮助开发者深入理解并精通Grails,从基础概念到高级...

    Grails.2.A.Quick-Start.Guide.pdf

    ### Grails 2: A Quick-Start Guide #### 书籍概览 《Grails 2:快速入门指南》是一本专为希望快速掌握Grails框架的开发者编写的实用指南。本书由Dave Klein与Ben Klein共同编写,通过一个逐步迭代的小项目来介绍...

    Grails 3.X开发实战

    ### Grails 3.X开发实战:Groovy基础详解 #### Groovy简介 Groovy是一种针对Java虚拟机(JVM)设计的动态编程语言,它融合了多种语言的优点,包括Python、Ruby以及Smalltalk等,旨在提供更为灵活和高效的开发体验。...

    grails学习

    grails.project.plugins.dir="./plugins" ``` 这将恢复旧的插件存储位置,从而解决编辑问题。 3. **静态参数插件应用** 使用 `<g:selectParams>` 和 `<g:staticParams>` 标签可以方便地在视图层处理静态参数。...

    Grails开发之(Rest教程).pdf

    在安全性配置部分,提及了org.grails.plugins:spring-security-core和org.grails.plugins:spring-security-rest,这代表了Grails项目中将使用Spring Security来管理安全问题,包括认证和授权,以及Spring Security ...

    Definitive.Guide.to.Grails

    Definitive Guide to Grails

    使用GORM构建Spring Boot应用程序 Grails指南_ Grails框架.pdf

    你可以通过访问<http://grails.org/index.html> 和 <https://travis-ci.org/grails-guides/gorm-without-grails> 来获取更多关于Grails和项目的相关信息。 要开始项目,可以从GitHub上下载或克隆本指南提供的源代码...

    grails3.2.8.7z.002

    grails3.2.8.7z.002 PART2

    grails 开发文档 合辑

    Apress.Beginning.Groovy.and.Grails.From.Novice.to.Professional.Jun.2008 grails_programming Grails1.1中文文档-----2009.3.25 Grails入门指南(第二版) Groovy经典入门 Programming Groovy 2 合集,超实惠哦

Global site tag (gtag.js) - Google Analytics