通过Spring建立数据库连接出现no suitable driver异常!

在学习Spring的有关JDBCTemplater时,出现no suitable driver异常!

代码如下:

IOC容器配置:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
    <!-- 配置C3P0数据源 -->
    <bean id="DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="user" value="root"></property>
        <property name="password" value=""></property>
        <property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/test"></property>
        <property name="driverClass" value="com.mysql.jdbc.Driver"></property>
        <property name="initialPoolSize" value="10"></property>
        <property name="maxPoolSize" value="10" />
    </bean>

</beans>

测试代码:

public class Tset {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("applictionContext.xml");
        DataSource dataSource = (DataSource) context.getBean("DataSource");
        try {
            System.out.println("数据库连接成功"+dataSource.getConnection());
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
}

Maven依赖:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.springframework.samples</groupId>
    <artifactId>JDBCTEst</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <properties>

        <!-- Generic properties -->
        <java.version>1.6</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- Spring -->
        <spring-framework.version>3.2.3.RELEASE</spring-framework.version>

        <!-- Hibernate / JPA -->
        <hibernate.version>4.2.1.Final</hibernate.version>

        <!-- Logging -->
        <logback.version>1.0.13</logback.version>
        <slf4j.version>1.7.5</slf4j.version>

        <!-- Test -->
        <junit.version>4.11</junit.version>

    </properties>

    <dependencies>
        <!-- Spring and Transactions -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>

        <!-- Logging with SLF4J & LogBack -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>


        <!-- Test Artifacts -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring-framework.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.mchange</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.5-pre8</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.26</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>3.0.5.RELEASE</version>
        </dependency>
    </dependencies>
</project>

通过如上代码的运行会出现no suitable driver异常,但将mysql驱动程序配置到java bulid path中,代码运行成功!
请大神指点,为什么通过maven依赖配置mysql驱动程序,程序运行不成功。但将驱动加入java bulid path就可以运行?

1个回答

对应的jdbc的jar包是否存在,还有数据库的驱动是否兼容。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
和数据库连接时No suitable driver 。。
我用的j2sdk1.4.1_03,Tomcat 4.1,Microsoft SQL Server 2000 Driver for JDBC,rnrn这是原码rnrn<%rnClass.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");rnString url="jdbc:microsoft:sqlserver://WORKGROU-AE53P0:1433;DatabaseName=zy";rn Connection con=DriverManager.getConnection(url);rncon.setCatalog("lyb"); rnStatement stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);rn ResultSet rs=stmt.executeQuery("select * from lyb");rn String name=rs.getString("name");rn stmt.close();rn con.close();rn%>rnrnrnrn运行后就是rndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnorg.apache.jasper.JasperException: com.microsoft.jdbc.sqlserver.SQLServerDriverrnat org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)rn .............................(下面N行省略)rnrn如果把Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");rn换成Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");rn的话,动行时就变成:rndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnorg.apache.jasper.JasperException: No suitable driver (这句和上面不同)rnat org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)rn ...........................(下面都是一样。)rnrnrnclasspath也设了msbase.jar,mssqlserver.jar,msutil.jar的安装路径rnrn我也把msbase.jar,mssqlserver.jar,msutil.jar拷到tomcat4.1\shared\lib下了rnrnsql server2000服务也运行着的。rnrn可就是连不上驱动呐。。。
连接数据库出现No suitable driver怎么办?
sqlserver_db.java(javaBean)rnrnpackage sqlserver;rnrnimport java.sql.*;rnrnpublic class sqlserver_dbrn rn String sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";rn rn String sConnStr = "jdbc:odbc:SQLServer_test"; rn rn Connection conn = null;rn rn ResultSet rs = null;rn rn Statement stmt = null;rn rn public void sqlserver_db()rn tryrn Class.forName(sDBDriver);rn System.out.println("success");rn rn catch(java.lang.ClassNotFoundException e)rn System.err.println("Class sqlserver_db not found!"+e.getMessage());rn rn rn rn public ResultSet executeQuery(String sql)rn rs = null;rn tryrn conn = DriverManager.getConnection(sConnStr,"sa",""); rn stmt = conn.createStatement();rn rs = stmt.executeQuery(sql);rn rn catch(SQLException ex)rn System.err.println("aq.executeQuery:"+ex.getMessage());rn rn return rs;rn rn rn public void executeUpdate(String sql)rn tryrn rn conn = DriverManager.getConnection(sConnStr,"sa",""); rn stmt = conn.createStatement();rn stmt.executeUpdate(sql);rn rn catch(SQLException ex)rn System.err.println("aq.executeUpdate:"+ex.getMessage());rn rn rn rnrnrn//调用javaBeanrn//test_diaoyong.javarnrnpackage sqlserver;rnrnimport java.sql.*; rnimport java.io.*;rnrn public class test_diaoyong rn rn public test_diaoyong() rn rn public static void main(String args[]) rn rn try rn System.out.println("success");rn rn sqlserver_db test = new sqlserver_db() ; rn rn ResultSet rs = test.executeQuery("select * from user_info ");rn rn while(rs.next())rn rn System.out.println("TestName:"+rs.getString("name")); rn rn rs.close();rn System.out.println("success");rn rn catch(Exception ex) rn System.err.println(ex.getMessage()); rn rn rn rnrn希望诸位高人指点迷津,感激中..........
No suitable driver
急求jsp连接数据库出错(sql server 2000)!!已经把jar包导入到lib目录下!还是提示:rnNo suitable driver.求老鸟解答rn<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>rn<%@ page import="java.sql.*" %>rnrn rn My JSP 'conn.jsp' starting pagern rn rn <%rn Connection con;rn Statement sql;rn ResultSet rs;rn tryrn Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");rn rn catch(ClassNotFoundException e)rn rn tryrn rn con=DriverManager.getConnection("jbbc:odbc:mymoon","","");rn sql=con.createStatement();rn rs=sql.executeQuery("select * from employee");rn out.print(" ");rn out.print(" ");rn out.print(" "+"雇佣号");rn out.print(" "+"姓名");rn out.print(" "+"出生日期");rn out.print(" "+"薪水");rn out.print("");rn while(rs.next())rn rn out.print(" ");rn out.print(" "+rs.getString(1)+"");rn out.print(" "+rs.getString(2)+"");rn out.print(" "+rs.getDate("birthday")+"");rn out.print(" "+rs.getFloat("salary")+"");rn out.print("");rn rn out.print("");rn con.close();rn catch(SQLException e)rn rn out.print(e);rn rn %>rn rnrn
No Suitable driver
java.sql.SQLException: No suitable dreverrn at java.sql.DriverManager.getConnection rn at java.sql.DriverManager.getConnection rn用sqljdbc.jar连接SQL server 2000
No suitable driver~~~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
java.sql.SQLException: No suitable driverrnrnimport java.sql.*;rnpublic class New6rnrn public static void main(String[] args)rn rn tryrn rn Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); rn rn catch(ClassNotFoundException e)rn tryrn rn Connection con=DriverManager.getConnection("jdbc:odbc:sun","",""); rn Statement sql=con.createStatement();rn ResultSet rs=sql.executeQuery("select name,english from student where english>=80");rn while(rs.next())rn rn String name=rs.getString(1);rn int english=rs.getInt(5);rn System.out.println(" 姓名:"+ name);rn System.out.println(" 英语"+english);rn rn rn con.close();rn rn rn rn rn rn catch(SQLException e)rn rn System.out.println(e); rn rn rn rn
与ACCESS数据库连接,出现SQL error:java.sql.SQLException: No suitable driver
程序代码很简单,就是想测试一下是否能够连接上。只用了一个MAIN函数。rn昨天写的一个BEAN的语句基本上和这个一摸一样,昨天那个能成功,今天这个就运行不了,十分奇怪,而且也没改JBUILDER的设置啊。。。。rnrnpackage application;rnrnimport java.sql.*;rnrnpublic class app rn public app() rn try rn Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");rn rn catch (java.lang.ClassNotFoundException e) rn System.err.print("sf error:" + e);rn rn rnrn public static void main(String args[]) rn try rn Connection conn = DriverManager.getConnection("jdbc:odbc:faq");rn Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,rn ResultSet.CONCUR_READ_ONLY);rn ResultSet rs = stmt.executeQuery("SELECT * FROM comment");rn while (rs.next()) rn System.out.println("Get a record");rn rn System.out.println("Link to DB successed.");rn rs.close();rn rn catch (SQLException e) rn System.err.print("SQL error:" + e);rn rn rnrnrn-----------------------------rnSQL error:java.sql.SQLException: No suitable driver
抛出一个“no suitable driver”异常?为什么???
为什么我用这两个文件,就是执行不了呢?rn老出没有匹配的驱动,抛出一个(“no suitable driver”)异常!!!!!!!!!!!!!!rn我在我的机器上,配置了一个odbc数据源,叫absrn我的环境是:windows2000 server, tomcat4.0rnrnrn这个是.jsp文件rnrn<%@page language="java" import="java.sql.*"%>rn<%@page contentType="text/html;charset=gb2312"%>rnrn 查询用户信息rnrnrnrnrnrn查询用信息rn rn<%rnResultSet rs;rnrs=user.executeQuery("select * from Employeeinfo");rnwhile(rs.next())rnrn%>rn用户ID:<%=rs.getInt("employeeid")%> 用户姓名:<%=rs.getString("employeename")%> rn用户功能组:<%=rs.getString("emplyeepower")%> rn<%rnrn%>rnrnrnrn这个是SQLServer_dbconnect.java文件rnrnpackage SQLServer;rnimport java.sql.*;rnrnpublic class SQLServer_dbconnectrnrnString sDBDriver="sun.jdbc.odbc.JdbcOdbcDriver";rnString sConnStr="jdbc.odbc.abs";rnConnection conn=null;rnResultSet rs=null;rnpublic SQLServer_dbconnect()rnrn tryrn Class.forName(sDBDriver);rn rn catch (java.lang.ClassNotFoundException e)rnrn System.err.println("Class SQLServer_dbconnect not found!"+e.getMessage());rn rnrnpublic ResultSet executeQuery(String sql)rnrn rs=null;rn tryrnrn conn=DriverManager.getConnection(sConnStr,"abs","abs");rn Statement stmt=conn.createStatement();rn rs=stmt.executeQuery(sql);rn rncatch(SQLException ex)rnrnSystem.err.println("aq.executeQuery:"+ex.getMessage());rnrn return rs;rnrnpublic ResultSet executeUpdate(String sql)rnrnrs=null;rntryrn conn=DriverManager.getConnection(sConnStr,"abs","abs");rn Statement stmt=conn.createStatement();rn rs=stmt.executeQuery(sql);rnrncatch(SQLException ex)rnrnSystem.err.println("ap.executeQUery:"+ex.getMessage());rnrnreturn rs;rnrnrnrnrnrnrnrn
JAVA连接数据库出现 No suitable driver异常怎么办?请求各位大侠帮忙!!
[code=Java]rnimport java.sql.*;rnpublic class DBUtil rn public static Connection getConnection()rn Connection con=null;rn try rn Class.forName("net.sourceforge.jtds.jdbc.Driver");/*注册驱动程序*/rn con=DriverManager.getConnection("jdbc:jtbs:sqlserver://localhost:1433;databasename=databar","sa","112789"); rn catch (Exception e) rn e.printStackTrace();rn rn rn return con;rn rn public static void main(String[] args) rn getConnection();rn rnrn[/code]出现这样的异常:java.sql.SQLException: No suitable driverrn at java.sql.DriverManager.getConnection(Unknown Source)rn at java.sql.DriverManager.getConnection(Unknown Source)rn at Dao.DBUtil.getConnection(DBUtil.java:8)rn at Dao.DBUtil.main(DBUtil.java:16)是怎么回事?一般怎么办呢?
关于使用dbcp1.4出现的No suitable driver异常的问题!
在转载上一篇博文中,我发现将数据库放在jre的ext目录中可以解决这个异常。 但是这样并不能消除我的疑问,为什么要把驱动包放在那里才能正常运行呢?阅读了论坛的很多帖子我发现凡是关于这个问题的帖子必有关于jvm类加载机制的说法。但对于这种很抽象的东西确实说出来令人感到费解。但是所幸的是,问题是解决了,大家也不必纠结原理了。 对于项目的异常问题我做了很多的实验: 比如: 使用c3p0连接池,未
spring中通过jndi获取tomcat配置的数据源(错误:No suitable driver)
tomcat下部分配置rnrn rn在common/lib和应用下都有classes12.jarrn在继承ContextLoaderListener的类中contextInitialized方法rnctx = WebApplicationContextUtils.getRequiredWebApplicationContext(context);rn或者rnctx = new FileSystemXmlApplicationContext(beanFileNames);rn初始化使用dataSource就要报No suitable driverrn而在系统启动后初始化,通过类初始化applicationcontextrnctx = new FileSystemXmlApplicationContext(beanFileNames);rn不会报这个错误,请高手指点下哈rnrnrnrn
mysql连接出现如下提示 No suitable driver
mysql odbc版本是3.51rnjdbcodbc驱动是 mysql-connector-java-3.0.9-stable-bin.jarrn会出现如下问题rnrn连接报No suitable driver错误rnrn连接代码如下:rnpackage linktel.db.mysql;rnrnimport java.sql.*;rnimport java.util.Properties;rnimport java.io.*;rnimport java.util.*;rnrnpublic class accessDbrnrnprivate static boolean isInited=false;rnprivate String sDBDriver = null;rnprivate String sConnStr = null;rnprivate String sUser = null;rnprivate String sPwd = null;rnprivate static Connection conn = null;rnprivate static Statement stmt = null;rnResultSet rs = null;rn//savelog sl= new savelog();rn public accessDb() rn try rn if(!isInited)rn Properties props = new Properties();rn InputStream iFile = new FileInputStream(accessDb.class.getResource(rn "default.properties").getPath());rn props.load(iFile);rn sDBDriver = props.getProperty("dbDriver");rn sConnStr = props.getProperty("dbURL");rn sUser = props.getProperty("dbUser");rn sPwd =props.getProperty("dbPwd");rn Class.forName(sDBDriver);rn rn rn catch(Exception e) rn System.err.println("accessDb(): " + e.getMessage());rn //sl.appendLog(new java.util.Date() +" accessDb(): " + e.getMessage());rn rn rnrn public ResultSet executeQuery(String sql) rn try rn conn = DriverManager.getConnection(sConnStr,sUser,sPwd);rn stmt = conn.createStatement();rn rs = stmt.executeQuery(sql);rn rn catch(SQLException e) rn System.err.println("accessDb().executeQuery: " + e.getMessage());rn //sl.appendLog(new java.util.Date() +" accessDb().executeQuery: " + e.getMessage());rn rn return rs;rn rnrn public void executeUpdate(String sql) rn //stmt = null;rn //rs=null;rn try rn conn = DriverManager.getConnection(sConnStr,sUser,sPwd);rn stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,rn ResultSet.CONCUR_UPDATABLE);rn stmt.executeUpdate(sql);rn //stmt.close();rn //conn.close();rn rn catch(SQLException e) rn System.err.println("accessDb().executeUpdate: " + e.getMessage());rn //sl.appendLog(new java.util.Date() +" accessDb().executeUpdate: " + e.getMessage());rn rn rnrn public void closeStmt()rn tryrn if(stmt!=null)rn stmt.close();rn rn rn catch(SQLException e)rn e.printStackTrace();rn rn rn public void closeConn()rn tryrn if(conn!=null)rn conn.close();rn rn rn catch(SQLException e)rn e.printStackTrace();rn rn rnrnrn public void finalize()rn closeStmt();rn closeConn();rn rnrnrn外部设置连接文件内容rndbDriver=org.gjt.mm.mysql.DriverrndbURL=jdbc:mysql:Callcenterrnrn页面代码rn<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>rn<%rn response.setHeader("Cache-Control","no-store");rn response.setHeader("Pragma","no-cache");rn response.setDateHeader("Expires",0);rn%> rnrnrnrnrnrn rn 123rnrn<%rn String sql="";rn sql="select * from Fieldcode";rn ResultSet Fieldcode=dbbean.executeQuery(sql);rn if(Fieldcode.next())rn String name=Fieldcode.getString("Name");rn rn%>rnrnrnrnrnrn
连接数据库,tomcat出现No suitable driver? 怎么办
org.apache.jasper.JasperExceptionrn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)rn at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)rn at java.lang.Thread.run(Thread.java:536)rnrnrnroot cause rnrnjava.lang.NullPointerExceptionrn at org.apache.jsp.view_jsp._jspService(view_jsp.java:73)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)rn at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)rn at java.lang.Thread.run(Thread.java:536)rnrn
java.sql.SQLException: No suitable driver问题~~~~~
我用的是MyEclipse+SQLServer2005+Tomcat6.0 rndriver都倒了 用的是sqljdbc1.2的 rn可还是出现这个问题 rnjava.sql.SQLException: No suitable driver rnat java.sql.DriverManager.getConnection(DriverManager.java:545) rnat java.sql.DriverManager.getConnection(DriverManager.java:171) rnat y2ssh.epai.xmal3.dao.jdbcimpl.BaseJdbcDao.openConn(BaseJdbcDao.java:23) rnat y2ssh.epai.xmal3.dao.jdbcimpl.UserDAOJdbcImpl.search(UserDAOJdbcImpl.java:42) rnat y2ssh.epai.xmal3.biz.impl.UserBizImpl.isExists(UserBizImpl.java:17) rnat y2ssh.epai.xmal3.web.action.UserAction.doAdd(UserAction.java:40) rnat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) rnat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) rnat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) rnat java.lang.reflect.Method.invoke(Method.java:585) rnat org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270) rnat org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187) rnat org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) rnat org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) rnat org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) rnat org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) rnat javax.servlet.http.HttpServlet.service(HttpServlet.java:710) rnat javax.servlet.http.HttpServlet.service(HttpServlet.java:803) rnat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) rnat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) rnat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) rnat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) rnat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) rnat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) rnat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) rnat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) rnat org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) rnat org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) rnat org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) rnat java.lang.Thread.run(Thread.java:595) rn2008-6-18 20:15:44 org.apache.catalina.core.StandardWrapperValve invoke rn严重: Servlet.service() for servlet action threw exception rnjava.lang.NullPointerException rnat y2ssh.epai.xmal3.dao.jdbcimpl.UserDAOJdbcImpl.search(UserDAOJdbcImpl.java:44) rnat y2ssh.epai.xmal3.biz.impl.UserBizImpl.isExists(UserBizImpl.java:17) rnat y2ssh.epai.xmal3.web.action.UserAction.doAdd(UserAction.java:40) rnat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) rnat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) rnat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) rnat java.lang.reflect.Method.invoke(Method.java:585) rnat org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270) rnat org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187) rnat org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) rnat org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) rnat org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) rnat org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) rnat javax.servlet.http.HttpServlet.service(HttpServlet.java:710) rnat javax.servlet.http.HttpServlet.service(HttpServlet.java:803) rnat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) rnat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) rnat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) rnat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) rnat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) rnat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) rnat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) rnat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) rnat org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) rnat org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) rnat org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) rnat java.lang.Thread.run(Thread.java:595) rn高手支招咋解决啊 就连我们老师也趴窝了 看网好多人问就是没有解决方法
no suitable driver,什么原因?
AIX环境,使用JDBC连接DB2,rnrn驱动加载了,代码也肯定没问题,究竟是什么原因呢?有遇到这种情况的TX吗?
jdbc-odbc的No suitable driver问题
package test;rn写了一个java bean:rnimport java.sql.*;rnrnpublic class mychatreg rn String sDbDriver="sun:jdbc:odbc:JdbcOdbcDriver";rn String sUrl="jdbc:odbc:chatreg";rn Connection conn=null;rn ResultSet rs=null;rn public mychatreg()rn tryrn Class.forName(sDbDriver);rn rn catch(java.lang.ClassNotFoundException e) rn System.err.println("dbdriverset:" + e.getMessage());rn rn rn rn其中chatreg是一个access数据库的system dsn数据源,可是jswdk抱怨说dbdriverset:No suitable driver 这是怎么回事?怎么解决?rnrn还有sun:jdbc:odbc:JdbcOdbcDriver到底是个什么东东?rnrn
请教:No suitable driver
我的tomcat 抛出:No suitable driverrn数据源我建好了 jdk 的环境设置也没问题 源文件如下 :faq.javarnpackage test;rn import java.sql.*;rn public class faq rn String sDBDriver ="sun.jdbc.odbc.JdbcOdbcDriver";rn String sConnStr ="jdbc:odbc:faq";rn Connection conn=null;rn ResultSet rs =null;rn public faq() rn try rn Class.forName(sDBDriver);rn rn catch(java.lang.ClassNotFoundException e)rn System.err.println("faq():" +e.getMessage());rn rn rn rn public ResultSet executeQuery(String sql)rn rn rs=null;rn tryrn conn=DriverManager.getConnection(sConnStr);rn Statement stmt =conn.createStatement();rn rs=stmt.executeQuery(sql);rn rn catch(SQLException e)rn System.err.println("sql.executeQuery():" + e.getMessage());rn rn return rs;rn rn rn rnrnfaq.jsprnrnrn rn 我的faqrnrnrn 这是我的FAQrn<%@ page language="java" import="java.sql.*" %>rnrn<%rnResultSet RS = work.executeQuery("SELECT * FROM faqs");rnString tt;rnrnwhile(RS.next())rnrntt=RS.getString("answers");rnout.println(" " + RS.getString("subject")+"");rnout.println(" " + tt + "");rnrnrnRS.close();rn%>rnrnrnrn帮帮我,搜了很多帖子 没有解决问题,驱动程序要其他的设置吗?
no suitable driver found for
这个问题已经困扰我半天,实在是找不到解决办法,请大家帮忙,这里先谢谢大家,请看清楚我遇到的问题。rnrn工作环境:Windows xp系统,安装的sql server2000个人版数据库(本机安装)rn用java连接db这样写的:rnString user="";//用的Windows验证,没有设置userrnString password="";//用的Windows验证,没有设置passwordrnString url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=myNewDB";rnClass.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();rnConnection conn = DriverManager.getConnection(url,user,password);rnrn程序运行到DriverManager.getConnection(url,user,password);的时候,报错:no suitable driver found forrnrn驱动mssqlserver.jar,msbase.jar和msutil.jar三个文件被放置在jdk1.6.0_05\jre\lib\ext下、应用的web-inf的lib下、tomcat的lib下,放了3份。rnsql server2000的sp4补丁也打上了,端口经确认是:1433,DB名字是:myNewDBrnrn实在找不到报错的原因,请高人指点,在线等,谢谢!
No suitable driver found
控制面板已添加数据源并且连接正常,可还找不到驱动,请各位指点一下rn[code=Java]import java.sql.Connection;rnimport java.sql.DriverManager;rnimport java.sql.Statement;rnimport java.sql.ResultSet;rnrnpublic class Testrnrn public static void main(String[] args)rn rn tryrn rn Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");rn Connection con = DriverManager.getConnection("jdbc::odbc:mine", "scott", "tiger");rn rn Statement sm = con.createStatement();rn ResultSet rs = sm.executeQuery("select * from emp");rn while(rs.next())rn rn System.out.println("用户名" + rs.getString(2));rn rn rn catch(Exception ex)rn rn ex.printStackTrace();rn rn rn[/code]
老问题No suitable driver
struts-config.xml数据源配制如下:rnrn rn rn rn rn rn rn rn rn rn rnrnrnTOMCAT5启动时:rn2005-8-14 23:02:26 org.apache.struts.action.ActionServlet initModuleDataSourcesrn??: Initializing application data source org.apache.struts.action.DATA_SOURCErnorg.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'rn' for connect URL 'jdbc:mysql://localhost/:3306/crm', cause:rnjava.sql.SQLException: No suitable driverrn at java.sql.DriverManager.getDriver(DriverManager.java:243)rn at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSournrce.java:743)rn at org.apache.commons.dbcp.BasicDataSource.setLogWriter(BasicDataSource.rnjava:576)rn at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionSernrvlet.java:778)rn at org.apache.struts.action.ActionServlet.init(ActionServlet.java:331)rn at javax.servlet.GenericServlet.init(GenericServlet.java:211)rn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.rnjava:1019)rn at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:86rn2)rn at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContexrnt.java:3991)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4rn335)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)rnrn at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)rnrn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478rn)rn at org.apache.catalina.core.StandardService.start(StandardService.java:4rn76)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:229rn8)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:556)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.rnjava:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesrnsorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:324)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)rn rn最新版的MYSQL驱动已放在LIB,CLASSPATH下,URL正确,桌面程序可以正常访问,WHY "java.sql.SQLException: No suitable driver"???
MySQL+Tomcat+JSP之:No suitable driver错误
我按照tomcat的文档,在TOMCAT下配置了MySQL的JDBC驱动,但运行时却在提示:rnorg.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: rnjava.sql.SQLException: No suitable driverrn......rn谁能告诉我怎么回事呀?rn我都折腾了一个星期了。
jsp+bean+access 错误提示:“No suitable driver”
bean的内容:rnrnpackage test;rnimport java.sql.*;rnrnpublic class userinf rnString sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";rnString sConnStr = "jdbc:odbc:first";rnConnection conn = null;rnResultSet rs = null;rnrnpublic void userinf() rntry rnClass.forName(sDBDriver);rnrncatch(java.lang.ClassNotFoundException e) rnSystem.err.println("faq(): " + e.getMessage());rnrnrnrnpublic ResultSet executeQuery(String sql) rnrs = null;rntry rnconn = DriverManager.getConnection(sConnStr);rnStatement stmt = conn.createStatement();rnrs = stmt.executeQuery(sql);rnrncatch(SQLException ex) rnSystem.err.println(ex.getMessage());rnrnreturn rs;rnrnrn但是用另一种方式连接就没问题,jsp页面:rn<%@ page info="database handler"%> rn<%@ page import="java.io.*"%> rn<%@ page import="java.util.*"%> rn<%@ page import="java.sql.*"%> rn<%@ page import="javax.servlet.*"%> rn<%@ page import="javax.servlet.http.*"%> rn<%! String tt;%>rn<% rntry rn rnClass.forName("sun.jdbc.odbc.JdbcOdbcDriver"); rnString url="jdbc:odbc:first"; rnConnection con=DriverManager.getConnection(url); rnjava.sql.Statement stmt = con.createStatement(); rnString query="select * from userinfs";rnResultSet RS=stmt.executeQuery(query);rnwhile (RS.next()) rn rn tt=RS.getString("name");rn out.println("tt");rn rnRS.close();rn rncatch (Exception e) rnout.println("table coffees created"); rn%>rn
java.sql.SQLException: No suitable driver
在ECLIPSE中运行正常,但是dos下运行不可以 rn rnclapsspath在环境变量中已经这定了 rn rnset CLASSPATH==.;.\lib;E:\Java\jdk141_03 rn\lib\tools.jar;E:\Java\jdk141_03\lib\dt.jar;E:\Java\jdk141_03\bin;E:\Java\jdk141_03\lib\jdom.jar;E:\Java\jdk141_03\lib\msutil.jar;E:\Java\jdk141_03\lib\mssqlserver.jar; rnE:\Java\jdk141_03\lib\msbase.jar; rn rnjava -jar TEST.jar rn rn rn报错 rn rnjava.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver rn at java.net.URLClassLoader$1.run(URLClassLoader.java:198) rn at java.security.AccessController.doPrivileged(Native Method) rn at java.net.URLClassLoader.findClass(URLClassLoader.java:186) rn at java.lang.ClassLoader.loadClass(ClassLoader.java:299) rn at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265) rn at java.lang.ClassLoader.loadClass(ClassLoader.java:255) rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315) rn at java.lang.Class.forName0(Native Method) rn at java.lang.Class.forName(Class.java:140) rn at MmsDb.CMyJdbc.(CMyJdbc.java:42) rn at Gateway.MtScanner.(MtScanner.java:89) rn at Gateway.Main.main(Main.java:52) rnjava.sql.SQLException: No suitable driver rn at java.sql.DriverManager.getConnection(DriverManager.java:532) rn at java.sql.DriverManager.getConnection(DriverManager.java:171) rn at MmsDb.CMyJdbc.Connect(CMyJdbc.java:65)
oracle11g:java.sql.SQLException: No suitable driver
用hibernate连接oracle11g数据库时,老是出现这个问题:java.sql.SQLException: No suitable driver,hibernate用的是4.1.2版的,驱动用的是ojdbc14.jar,控制台出现一大堆java.sql.SQLException: No suitable driver,但是junit却没有出现错误。另外用纯java连接没问题,能从中读出数据。请问各位,这到底是怎么回事啊?
oracle驱动:no suitable driver
与数据库连接的时候,报这个错,java.sql.SQLException: No suitable driver found for jdbc.oracle.thin:@localhost:1521:ORCL。rn我已经把 classes12.jar,ojdbc.jar放到tomcat的lib目录下,但是还是不行。为什么,要怎么样修改?
连接数据库错误:No suitable driver!
连接数据库错误:No suitable driver!数据库是mdb,以下是相关代码,大家帮忙看看,谢谢!rnrnrnclass Conn rnrn protected String DriverName;rn protected String DBURL;rn protected Connection cn;rn protected Statement stmt;rn protected ResultSet rs;rn //Data data=new Data();rn public Conn()rn rn DriverName="sun.jdbc.odbc.JdbcOdbcDriver";rn DBURL="jdbc:odbc:PhoneBook";rn cn=null;rn rn rn public void DBConnect()rn rn try rn rn cn=DriverManager.getConnection(DBURL);//提示错误就在这一行rn rn catch (SQLException e) rn rn // TODO 自动生成 catch 块rn e.printStackTrace();rn rn rnrnrn小弟初学java,很多不懂,还望大家不吝赐教!谢谢!
一言难尽!Not suitable driver for jdbc
[color=#FF0000] <% rn String driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver";rn String url="jdbc:sqlserver://localhost:1433;DatabaseName=db_database08";rn String username="sa";rn String password="137";rn tryrn Class.forName(driverClass);rn catch(ClassNotFoundException e)rn System.out.println("加载数据库驱动时抛出异常,内容如下:");rn e.printStackTrace();rn rn Connection conn=DriverManager.getConnection(url,username,password);rn Statement stmt=conn.createStatement();rn ResultSet rs = stmt.executeQuery("select * from tb_user");rn while(rs.next())rn out.println(" 用户名:"+rs.getString(2)+"密码:"+rs.getInt(1));rn rn rs.close();rn stmt.close();rn conn.close();rn %>[/color]rn我已经把驱动包sqljdbc4.jar放进java/jre1.6.0_04/lib/ext里面且已近加进了工程里面,rnSQLServer 2005 的127.0.0.1端口我已开启,服务都重启了,rn上面的代码,应该没有错的。rn可是,提示显示,在Connection conn=DriverManager.getConnection(ur1,username,password);有个Exception 出现哦……rnNot suitable driver found for jdbcrnrn急!!rn
db2连接失败:no suitable driver
首先我把db2java.zip和db2jcc.jar都加到了类路径中,代码如下:但连接却报错。rn Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance();rn String url="jdbc:db2://127.0.0.1:5000/check";rn //sample为你的数据库名rn String user="sb";rn String password="111";rn Connection conn= DriverManager.getConnection(url,user,password);rn PreparedStatement ps=conn.prepareStatement("select * from administrator.user_info");rn ResultSet rs=ps.executeQuery();rn while (rs.next())rn System.out.println("user_no="+rs.getString("user_no")+rn "user_name="+rs.getString("user_name"));rn rnrn conn.close();rn catch (InstantiationException e) rn e.printStackTrace();rn catch (IllegalAccessException e) rn e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.rn catch (ClassNotFoundException e) rn e.printStackTrace();rn catch (SQLException e) rn e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.rn rnrn用这个驱动名的时候报错:com.ibm.db2.jcc.c.DisconnectException: [ibm][db2][jcc][t4][2043][11550] 异常 java.net.ConnectException:打开端口 5,555 上服务器 /127.0.0.1 的套接字时出错,消息为:Connection refused: connect。rnrn如果驱动类换成:COM.ibm.db2.jdbc.app.DB2Driver,则报标题的错。rnrn我怀疑监听端口不是5000,因为我运行netstat -an,查看不到5000端口。请问这是怎么回事?db2版本是9.1企业版
java.sql.SQLException: No suitable driver请教
在eclipse的java project中,在"Java Build Path"->"Libraries"中加入了oracle的jar包,运行的时候为什么提示: rnjava.sql.SQLException: No suitable driver rn??rn
jdbc for mssqlserver!(No suitable driver)
已经安装了驱动,也加载了jar包 rn.java可以连 rn.jsp不能连(jrun4) rnrn先谢谢了 :-)
no suitable driver 错误
jdk:jbuilder2005自带得 jdk1.4rntomcat 也是jbuilder2005 自带得 tomcat5.0rnoracle9.2.0.1 客户端!rnrn也下载了对应的jdbc的三个包!rnclasspath 也配置了 classess12.zip 和 jdbc的 ocrs12.zip 路径rnrn Connection connection = null;rn tryrn rn String forName = "oracle.jdbc.driver.OracleDriver";rn Class.forName(forName);rn String serverName = "192.168.2.2";rn String serverPort = "1521";rn String serverID = "MYTEST";rn String userName = "uffeng";rn String userpsw = "uf1981";rn String url = "jdbc:oracle.thin:@" + serverName + ":" + serverPort +rn ":" + serverID;rn connection = DriverManager.getConnection(url,userName,userpsw);rn rn出现了 这个错误!rn实在不知道 哪里还有问题了!!!谢谢rn
求救:java.sql.SQLException: No suitable driver
我用的是WinXP SP2 + MS SQL Server 2000 + JCreator 3.50 PrornrnClass.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver");rnConnection con = DriverManager.getConnection("jdbc:odbc:StudentGradeManage")rnrn上面两句放在try里rnrncatch(SQLException sqle) rn System.out.println(sqle.toString());rnrnrn然后运行起来就是提示java.sql.SQLException: No suitable driverrnrn我把三个*.jar都放好了, JCreator里也Add Archive了, 也设置了classpath, 学校里win2000用没问题, 同学的win xp也连上了, 就我家这不给面子的连不上, 巨郁闷, 所以请牛人们帮忙看看, 解决一下rnrn我只能明早再来看, 这里先谢过了....
与sql连接的问题No suitable driver
我已经把驱动放到D:\j2sdk\jre\lib\ext 目录下了rn路径的配置:PATH: D:\j2sdk\binrnCLASSPATH: .;D:\j2sdk\jre\lib;D:\j2sdk\librn加载驱动的语句rntryrn Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");rn catch(Exception e)rn System.out.println("加载数据库驱动程序失败,请检查数据库驱动");rn rnrn tryrn this.con=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;" +rn "DatabaseName=java","","");rnrn catch(SQLException ee)rn System.out.println("执行数据库查询失败,请检查连接");rn rn提示信息:rn加载数据库驱动程序失败,请检查数据库驱动rn执行数据库查询失败,请检查连接rnclass java.sql.SQLExceptionrnNo suitable driverrn试图连接数据库失败.rnrnrn数据库名为javarn错误的原因在那,rn苦思不得其解。希望高手指点。
No suitable driver是什么问题
报错为rnjava.sql.SQLException: No suitable driverrn at java.sql.DriverManager.getConnection(DriverManager.java:532)rn at java.sql.DriverManager.getConnection(DriverManager.java:171)rn at Photon.tr.DataBase.getConnection(DataBase.java:22)rn at Photon.tr.TdBean.(TdBean.java:26)rn at org.apache.jsp.Td_005fjsp_jsp._jspService(Td_005fjsp_jsp.java:75)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)rn at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)rn at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)rn at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)rn at java.lang.Thread.run(Thread.java:534)rn
jsp连接db2 出现No suitable driver
我使用的struts 2.0rndb2 版本是7.2rn登录页面提交时出现下面的错误信息:rnrn....rn....rn....rnCaused by: org.hibernate.exception.JDBCConnectionException: Cannot open connectionrn....rn....rn....rnCaused by: java.sql.SQLException: No suitable driver
求救!!链接MYSQL出现No suitable driver错误!!
如题,我用的驱动是mm.mysql-2.0.4-bin.jar文件。
Hibernate出现No suitable driver found for jdbc
出现Hibernate,出现连不上数据库,想知道咋办rn配置文件如下rnrnrnrn rn jdbc:mysql//localhost/studiorn com.mysql.jdbc.Driverrn rootrn adminrn org.hibernate.dialect.MySQLDialectrn rn rn rnrnUser类的配置如下rnrnrnrn rn rn rn rn rn rn rn rn rnrn谢谢!
新手问题:No suitable driver
本人使用一个bean来负责数据库的连接,可是每次都报告以下内容,不知道是怎么回事,请高手不吝赐教:rnsun.jdbc.odbc.jdbcodbcdriverrnNo suitable driverrnjava.lang.NullPointerExceptionrn其中连接是这样写的:rnString sdbdriver="sun.jdbc.odbc.jdbcodbcdriver";rnString sconnstr="jdbc:odbc:vote";rnConnection connect=null;rnResultSet rs=null;rnpublic conn()rntry rnClass.forName(sdbdriver);rnrncatch(java.lang.ClassNotFoundException e)System.err.println(e.getMessage());rnrnpublic ResultSet executequery(String sql)rnrs=null;rntryrnconnect=DriverManager.getConnection(sconnstr,"sa","");rnStatement stmt=connect.createStatement();rnrs=stmt.executeQuery(sql);
java.sql.SQLException: No suitable driver 错误
rnjava.sql.SQLException: No suitable driverrn at java.sql.DriverManager.getDriver(DriverManager.java:243)rn at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773)rn at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)rn at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)rn at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:298)rn at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:110)rn at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:88)rn at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1162)rn at org.hibernate.loader.Loader.doQuery(Loader.java:390)rn at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)rn at org.hibernate.loader.Loader.doList(Loader.java:1593)rn at org.hibernate.loader.Loader.list(Loader.java:1577)rn at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:111)rn at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1322)rn at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:300)rn at org.springframework.orm.hibernate3.HibernateTemplate$38.doInHibernate(HibernateTemplate.java:1012)rn at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)rn at org.springframework.orm.hibernate3.HibernateTemplate.findByExample(HibernateTemplate.java:1001)rn at org.springframework.orm.hibernate3.HibernateTemplate.findByExample(HibernateTemplate.java:994)rn at dao.UserDAO.findByExample(UserDAO.java:67)rn at service.Service.isValid(Service.java:16)rn at web.action.LoginAction.execute(LoginAction.java:54)rn at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)rn at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)rn at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:154)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)rn at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106)rn at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:173)rn at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)rn at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:274)rn at com.caucho.server.port.TcpConnection.run(TcpConnection.java:511)rn at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:520)rn at com.caucho.util.ThreadPool.run(ThreadPool.java:442)rn at java.lang.Thread.run(Thread.java:595)rnrn用myeclipse做的SSH,报的这个错误rnUserDAO.java代码是直接生成的rnapplicationContext.xmlrn[code=XML]rnrnrnrnrnrn rn rn com.mysql.jdbc.Driverrn rn rn rn jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=GBKrn rn rn rn rootrn rn rn eetrustrn rn rn rn rn rn rn rn rn rn org.hibernate.dialect.MySQLDialectrn rn rn rn rn rn vo/User.hbm.xmlrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn [/code]rn刚学spring不知道那里错了,大家帮忙看看rn
java.sql.SQLException:No suitable driver 求救
项目本来正常,rn拷贝到其他机器的tomcat后rn出现 java.sql.SQLException: No suitable driverrn我是把之前的程序整盘复制的,所以,里边的jar或xml等设置应该都是一样的rn为什么出现这个问题啊rn环境:rnSSHrntomcat6.0rn连接池proxoolrn数据库oracle 10grnrn2台机器唯一不一样的就是系统rn本来的是XP,后来的是2003rn不会是这个事吧
No suitable driver的问题
[code=Java]rnimport java.sql.Connection;rnimport java.sql.DriverManager;rnrnpublic class TestConn rn public static void main(String[] args)rn Connection conn = null;rn try rn Class.forName("com.mysql.jdbc.Driver");rn conn=DriverManager.getConnection("jdbc:mysql//127.0.0.1:3306/crm?usr=root&password=123");rnrn catch (Exception e) rn e.printStackTrace();rn rn rn rnrnrn[/code]rnrn写程序的时候总报No suitable driver的错误,我单独建立一个类就这么多他还报这个错误;rn先说明我的mysql一直都没重装过驱动也没有换过,系统也没有重装过,以前用的时候没有一点问题,今天不知道为什么就这样了,以往写得程序也不行了,我想好久期间就myeclipse自动升级过,还有就是ant换了新版本的 (与这个无关把),能想到的原因就这么多了,今天彻底无语了,希望大家发表下意见。rnps:驱动已经引入没有报java.lang.ClassNotFoundException: com.mysql.jdbc.Driver,所以不是驱动引入的问题rn看了以往的问题随便把我的驱动版本写上:mysql-connector-java-5.0.8-bin.jarrnrn
相关热词 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法