久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <tfoot id='EGsnT'></tfoot>
    1. <i id='EGsnT'><tr id='EGsnT'><dt id='EGsnT'><q id='EGsnT'><span id='EGsnT'><b id='EGsnT'><form id='EGsnT'><ins id='EGsnT'></ins><ul id='EGsnT'></ul><sub id='EGsnT'></sub></form><legend id='EGsnT'></legend><bdo id='EGsnT'><pre id='EGsnT'><center id='EGsnT'></center></pre></bdo></b><th id='EGsnT'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='EGsnT'><tfoot id='EGsnT'></tfoot><dl id='EGsnT'><fieldset id='EGsnT'></fieldset></dl></div>

      <legend id='EGsnT'><style id='EGsnT'><dir id='EGsnT'><q id='EGsnT'></q></dir></style></legend>

      <small id='EGsnT'></small><noframes id='EGsnT'>

        • <bdo id='EGsnT'></bdo><ul id='EGsnT'></ul>

      1. 如何修復:“找不到適合 jdbc:mysql://localhost/dbname

        How to fix: quot;No suitable driver found for jdbc:mysql://localhost/dbnamequot; error when using pools?(如何修復:“找不到適合 jdbc:mysql://localhost/dbname 的驅動程序;使用池時出錯?) - IT屋-程序員軟件開發技術分

        1. <small id='rDddk'></small><noframes id='rDddk'>

          <legend id='rDddk'><style id='rDddk'><dir id='rDddk'><q id='rDddk'></q></dir></style></legend>
                • <bdo id='rDddk'></bdo><ul id='rDddk'></ul>

                    <tbody id='rDddk'></tbody>
                  <tfoot id='rDddk'></tfoot>
                • <i id='rDddk'><tr id='rDddk'><dt id='rDddk'><q id='rDddk'><span id='rDddk'><b id='rDddk'><form id='rDddk'><ins id='rDddk'></ins><ul id='rDddk'></ul><sub id='rDddk'></sub></form><legend id='rDddk'></legend><bdo id='rDddk'><pre id='rDddk'><center id='rDddk'></center></pre></bdo></b><th id='rDddk'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='rDddk'><tfoot id='rDddk'></tfoot><dl id='rDddk'><fieldset id='rDddk'></fieldset></dl></div>
                • 本文介紹了如何修復:“找不到適合 jdbc:mysql://localhost/dbname 的驅動程序";使用池時出錯?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試創建到我的數據庫的連接,當我使用 main 方法測試我的代碼時,它可以無縫地工作.但是,當嘗試通過 Tomcat 7 訪問它時,它失敗并顯示錯誤:

                  I am trying to create a connection to my database, when I put test my code using the main method, it works seamlessly. However, when trying to access it through Tomcat 7, it fails with error:

                  No suitable driver found for jdbc:mysql://localhost/dbname. 
                  

                  我正在使用池化.我在 WEB-INF/lib 和 .classpath 中放入了 mysql 連接器 (5.1.15)、dbcp (1.4) 和 pool(1.4.5) 庫.我正在使用 Eclipse IDE.我的數據庫驅動程序代碼是:

                  I am using pooling. I put in mysql connector (5.1.15), dbcp (1.4) , and pool(1.4.5) libraries in WEB-INF/lib and in .classpath as well. I am using Eclipse IDE. My code for the database driver is:

                  import java.sql.Connection;
                  import java.sql.DriverManager;
                  import java.sql.SQLException;
                  
                  import org.apache.tomcat.dbcp.dbcp.ConnectionFactory;
                  import org.apache.tomcat.dbcp.dbcp.DriverManagerConnectionFactory;
                  import org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory;
                  import org.apache.tomcat.dbcp.dbcp.PoolingDriver;
                  import org.apache.tomcat.dbcp.pool.impl.GenericObjectPool;
                  
                  public class DatabaseConnector {
                      public static String DB_URI = "jdbc:mysql://localhost/dbname";
                      public static String DB_USER = "test";
                      public static String DB_PASS = "password";
                  
                      // Singleton instance
                      protected static DatabaseConnector _instance;
                  
                      protected String _uri;
                      protected String _username;
                      protected String _password;
                  
                      /**
                       * Singleton, so no public constructor
                       */
                      protected DatabaseConnector(String uri, String username, String password) {
                          _uri = uri;
                          _username = username;
                          _password = password;
                  
                          GenericObjectPool connectionPool = new GenericObjectPool(null);
                          ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
                              _uri, _username, _password);
                          PoolableConnectionFactory poolableConnectionFactory =
                              new PoolableConnectionFactory(connectionFactory, connectionPool,
                                                              null, null, false, true);
                          PoolingDriver driver = new PoolingDriver();
                          driver.registerPool("test", connectionPool);
                      }
                  
                      /**
                       * Returns the singleton instance
                       */
                      public static DatabaseConnector getInstance() {
                          if (_instance == null) {
                              _instance = new DatabaseConnector(DB_URI, DB_USER, DB_PASS);
                          }
                          return _instance;
                      }
                  
                      /**
                       * Returns a connection to the database
                       */
                      public Connection getConnection() {
                          Connection con = null;
                          try {
                              con = DriverManager.getConnection("jdbc:apache:commons:dbcp:test");
                          } catch (SQLException e) {
                              throw new RuntimeException(e);
                          }
                          return con;
                      }
                  }
                  

                  我的堆棧跟蹤的開始:

                  Apr 5, 2011 9:49:14 PM org.apache.catalina.core.StandardWrapperValve invoke
                  SEVERE: Servlet.service() for servlet [Login] in context with path [/Project] 
                  threw exception
                  java.lang.RuntimeException: java.sql.SQLException: 
                  No suitable driver found for jdbc:mysql://localhost/dbname
                  

                  是什么導致了這個錯誤?

                  What is causing this error?

                  推薦答案

                  嘗試將驅動程序 jar 放在服務器 lib 文件夾中.($CATALINA_HOME/lib)

                  Try putting the driver jar in the server lib folder. ($CATALINA_HOME/lib)

                  我相信甚至在應用程序實例化之前就需要設置連接池.(至少在 Jboss 中是這樣的)

                  I believe that the connection pool needs to be set up even before the application is instantiated. (At least that's how it works in Jboss)

                  這篇關于如何修復:“找不到適合 jdbc:mysql://localhost/dbname 的驅動程序";使用池時出錯?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數根據 N 個先前值來決定接下來的 N 個行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環數組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數據庫表作為 Spark 數據幀讀取?)
                    <tbody id='UnKIR'></tbody>

                  <tfoot id='UnKIR'></tfoot>
                    • <bdo id='UnKIR'></bdo><ul id='UnKIR'></ul>
                    • <i id='UnKIR'><tr id='UnKIR'><dt id='UnKIR'><q id='UnKIR'><span id='UnKIR'><b id='UnKIR'><form id='UnKIR'><ins id='UnKIR'></ins><ul id='UnKIR'></ul><sub id='UnKIR'></sub></form><legend id='UnKIR'></legend><bdo id='UnKIR'><pre id='UnKIR'><center id='UnKIR'></center></pre></bdo></b><th id='UnKIR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='UnKIR'><tfoot id='UnKIR'></tfoot><dl id='UnKIR'><fieldset id='UnKIR'></fieldset></dl></div>

                          <small id='UnKIR'></small><noframes id='UnKIR'>

                        1. <legend id='UnKIR'><style id='UnKIR'><dir id='UnKIR'><q id='UnKIR'></q></dir></style></legend>

                          • 主站蜘蛛池模板: 日韩精品久久久久 | 久久久精品一区二区三区 | 免费黄色a级毛片 | 日韩三区| 国产一区亚洲二区三区 | 久久久久久亚洲欧洲 | 午夜精品一区二区三区在线观看 | 欧美视频日韩 | 日本特黄a级高清免费大片 成年人黄色小视频 | 国产精品亚洲精品 | 夜夜夜久久 | 亚洲免费一区二区 | 欧美日韩不卡合集视频 | 国产日韩精品一区 | 欧美一区二区三区 | 国产精品日韩欧美一区二区 | 亚洲午夜精品一区二区三区 | 伊人春色成人 | 国产精品久久影院 | 精品一区二区观看 | 免费在线观看av网址 | 日韩欧美在线播放 | 日韩久久精品 | 精品伊人久久 | 九九热在线视频观看这里只有精品 | 一区二区三区四区在线视频 | 久久成人一区二区三区 | 国产精品中文字幕在线播放 | 日韩电影免费在线观看中文字幕 | 欧美日韩专区 | 性色av网站 | 色偷偷噜噜噜亚洲男人 | 日韩精品一区二区三区 | 日韩亚洲一区二区 | 欧美大片一区 | 国产精品一区二区无线 | 亚洲精品电影 | 暖暖成人免费视频 | 日本一区二区视频 | 国产特级毛片aaaaaa喷潮 | 久久91av |