Guest User

Untitled

a guest
Mar 31st, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. <Resource name="jdbc/testdb" auth="Container" type="javax.sql.DataSource"
  2. username="test" password="test1234"
  3. url="*********"
  4. driverClass="oracle.jdbc.driver.OracleDriver"
  5. initialSize="5" maxWait="5000"
  6. maxActive="120" maxIdle="5"
  7. validationQuery="select 1"
  8. poolPreparedStatements="true"/>
  9.  
  10. <Resource name="jdbc/testdb" auth="Container" type="javax.sql.DataSource"
  11. username="test" password="test1234"
  12. url="*********"
  13. driverClass="oracle.jdbc.driver.OracleDriver"
  14. initialSize="5" maxWait="5000"
  15. maxActive="120" maxIdle="5"
  16. validationQuery="select 1"
  17. poolPreparedStatements="true"/>
  18.  
  19. <ResourceLink name="jdbc/testdb" global="jdbc/testdb"
  20. type="javax.sql.DataSource" />
  21.  
  22. <jee:jndi-lookup id="dataSource" jndi-name="jdbc/testdb" resource-ref="true" />
  23.  
  24. <resource-ref>
  25. <description>Resource reference to database</description>
  26. <res-ref-name>jdbc/testdb</res-ref-name>
  27. <res-type>javax.sql.DataSource</res-type>
  28. <res-auth>Container</res-auth>
  29. <res-sharing-scope>Shareable</res-sharing-scope>
  30. </resource-ref>
  31.  
  32. Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
  33.  
  34. driverClassName="oracle.jdbc.driver.OracleDriver"
  35.  
  36. <!-- dependency>
  37. <groupId>org.postgresql</groupId>
  38. <artifactId>postgresql</artifactId>
  39. <scope>runtime</scope>
  40. </dependency-->
  41.  
  42. <GlobalNamingResources>
  43. ...
  44. <Resource name="jdbc/postgres_jndi"
  45. auth="Container"
  46. type="javax.sql.DataSource"
  47. driverClassName="org.postgresql.Driver"
  48. url="jdbc:postgresql://xxx.xxx.xx.xxx:5432/db"
  49. factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
  50. removeAbandonedOnBorrow="true"
  51. removeAbandonedOnMaintenance="true"
  52. timeBetweenEvictionRunsMillis="10000"
  53. removeAbandonedTimeout="60"
  54. logAbandoned="true"
  55. username="xxx"
  56. password="xxxxxx"
  57. maxTotal="20"
  58. maxIdle="10"
  59. maxWaitMillis="-1"/>
  60. ...
  61. </GlobalNamingResources>
  62.  
  63. spring:
  64. datasource:
  65. platform: postgres
  66. jndi-name: java:comp/env/jdbc/postgres_jndi
  67. type: javax.sql.DataSource
  68. driver-class-name: org.postgresql.Driver
  69. jpa:
  70. hibernate:
  71. ddl-auto: validate
  72. database-platform: org.hibernate.dialect.PostgreSQL9Dialect
  73. database: POSTGRESQL
  74. show-sql: true
  75. #Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented.
  76. properties:
  77. hibernate:
  78. temp:
  79. use_jdbc_metadata_defaults: false
  80.  
  81. spring.datasource.platform= postgres
  82. spring.datasource.jndi-name= java:comp/env/jdbc/postgres_jndi
  83. spring.datasource.type= javax.sql.DataSource
  84. spring.datasource.driver-class-name= org.postgresql.Driver
  85. spring.jpa.hibernate.ddl-auto= validate
  86. spring.jpa.hibernatedatabase-platform= org.hibernate.dialect.PostgreSQL9Dialect
  87. spring.jpa.database= POSTGRESQL
  88. spring.jpa.show-sql= true
  89. spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
  90.  
  91. <?xml version="1.0" encoding="UTF-8"?>
  92. <Context path="/myapp">
  93. <ResourceLink global="jdbc/postgres_jndi" name="jdbc/postgres_jni" type="javax.sql.DataSource"/>
  94. </Context>
Add Comment
Please, Sign In to add comment