Guest User

Untitled

a guest
Dec 26th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  3.  
  4. <sql:query var="rs" dataSource="jdbc/mmas">
  5. select current_validstart as ValidTime from runoff_forecast_valid_time
  6. </sql:query>
  7.  
  8. <Context path="/gs2" allowLinking="true">
  9. <Resource name="jdbc/mmas" type="javax.sql.Datasource"
  10. auth="Container" driverClassName="org.postgresql.Driver"
  11. maxActive="100" maxIdle="30" maxWait="10000"
  12. username="mmas" password="very_secure_yess_precious!"
  13. url="jdbc:postgresql//localhost:5432/mmas" />
  14. </Context>
  15.  
  16. <resource-ref>
  17. <description>
  18. The database resource for the MMAS PostGIS database
  19. </description>
  20. <res-ref-name>
  21. jdbc/mmas
  22. </res-ref-name>
  23. <res-type>
  24. javax.sql.DataSource
  25. </res-type>
  26. <res-auth>
  27. Container
  28. </res-auth>
  29. </resource-ref>
  30.  
  31. exception
  32. org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
  33. [...wads of ensuing goo elided]
  34.  
  35. Class.forName("com.example.jdbc.Driver");
  36.  
  37. url="jdbc:postgresql//localhost:5432/mmas"
  38.  
  39. url="jdbc:postgresql://localhost:5432/mmas"
  40.  
  41. $CLASSPATH << '~/.rbenv/versions/jruby-1.7.17/lib/ruby/gems/shared/gems/jdbc-postgres-9.4.1200/lib/postgresql-9.4-1200.jdbc4.jar'
  42.  
  43. @Config
  44. @EnableTransactionManagement
  45. public class appDataConfig {
  46. * Other Bean Defs *
  47. @Bean
  48. public DataSource dataSource() {
  49. // configure and return the necessary JDBC DataSource
  50. DriverManagerDataSource dataSource = new DriverManagerDataSource("jdbc:oracle:thin:@//HOST:PORT/SID", "user", "password");
  51. dataSource.setSchema("MY_SCHEMA");
  52. return dataSource;
  53. }
  54. }
  55.  
  56. @Config
  57. @EnableTransactionManagement
  58. public class appDataConfig {
  59. /* Other Bean Defs */
  60. @Bean
  61. public DataSource dataSource() {
  62. // configure and return the necessary JDBC DataSource
  63. OracleDataSource datasource = null;
  64. try {
  65. datasource = new OracleDataSource();
  66. } catch (SQLException e) {
  67. // TODO Auto-generated catch block
  68. e.printStackTrace();
  69. }
  70.  
  71. datasource.setURL("jdbc:oracle:thin:@//HOST:PORT/SID");
  72. datasource.setUser("user");
  73. datasource.setPassword("password");
  74.  
  75. return datasource;
  76. }
  77. }
Add Comment
Please, Sign In to add comment