Mysql数据库时常连接问题

时常出现:2013 - Lost connection to MySQL server at 'waiting' for initial communication packet',system error: 0

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
access数据库时常连接出错
如果使用频率不高,没有问题,但如果连续的连接,就会出现不能连接的问题rn代码如下:rnpublic static OleDbConnection con()rn rn string strConnection = System.Configuration.ConfigurationSettings.AppSettings["connstr"] + System.Web.HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["dbpath"]);rn OleDbConnection connect = new OleDbConnection(strConnection); rn return connect;rn rnrn public static string sel(string i)rn rn string strConnection = System.Configuration.ConfigurationSettings.AppSettings["connstr"] + System.Web.HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["dbpath"]);rn OleDbConnection connect = new OleDbConnection(strConnection);rn connect.Open();rn OleDbCommand command = new OleDbCommand(i, connect);rn OleDbDataReader reader = command.ExecuteReader();rn reader.Read();rn return (reader[0].ToString());rn connect.Close();rn rnrn下面是web.config的代码rnrn rn rn rn出错的时候,抱错信息是在 connect.Open();高亮
kettle 连接mysql数据库 问题
新手连接kettle数据库问题    1.连接 主机名称如果数据库在本机上  主机名称是  localhost    2.jar包 mysql-connector-java-3.1.12-bin.jar 没有导入 应该倒入到  data-integration\lib 下    3.如果还不行 可能是mysql远程连接权限问题    进入cmd         进行如下操作 my
连接MYSQL数据库的问题
我安装MYSQL4.0.10后从MYSQL网站上下了odbc_net.EXE安装后,在VB.NET连接数据库中始终找不到MYSQL的数据源驱动程序,请问什么原因,怎么才能解决连接问题。 谢谢
jsp连接mySQL数据库的问题
如题,请给出具体步骤,谢谢(包括mysql下载,相关驱动程序下载等等)rn
kylix下连接mysql数据库的问题
本人用linux下的kylix 编写数据库客户端,服务器程序rn我用的是mysql 数据库管理系统rn当我用dbexpress中的组件SQLCONNECTION连接数据库时rn出现错误rn提示说Failure to connect:unable to load libmysqlclient.so.10.0.0rn我的/usr/lib 下有libmysqlclient.so.10.0.0这个文件呀rn我想可能是LD_LIBRARY_PATHDE的问题rn可是我还是不知道该怎办呀?rn那位大虾知道rn望不吝赐教!!!!!!!!!!!!!!! rnrn最后弱弱的问:我装了kylix后就不用再装mysql驱动了吧也不用再单独装dbexpress吧rn我连接其他的数据库也不行(DB2)rnrn
c# 连接mysql数据库的问题
添加了 MySQLDriverCS的引用 VS2010rnrnusing MySQLDriverCS;rnrnrnMySQLConnection conn = new MySQLConnection( new MySQLConnectionString("localhost","test","root","1234").AsString );rnrnconn.Open();rnrnrn错误信息:"MySQLDriverCS Error: can't connect.Can't connect to MySQL server on 'localhost' (10061)"rnrn请问各位这是怎么回事呀?如何解决?用phpmyadmin 可以正常登陆。 rnrn
struts连接mysql数据库的问题
我用下面的url连接数据库时,中文一切正常rnurl="jdbc:mysql://localhost/gz?useUnicode=true&characterEncoding=gb2312"rnrn可在struts的struts-config.xml中,定义数据源时,像下面这样定义会报错。rnrnrn所以只好写成:rnrnrnrn这时,中文就全成乱码了!是不是上面这种写法有问题?要达到第一个url的效果,应该怎么写啊!
请教连接mysql数据库的问题?
rn运行结果如下:rnFatal error: Call to undefined function: mysql_connect() in I:\wp\INDEX.php on line 2rn不知是哪个出了问题?rn
ASP连接MySQL数据库的问题
通过ODBC连接MySQL数据库,连接成功,但不能查询数据,不知道为什么rn '连接mysql数据库rn str = "dsn=test;driver=MySQL odbc 3.51 Driver;server=localhost;port=3306;uid=root;pwd=;database=officesystem4"rn Set Conn = Server.CreateObject("ADODB.Connection")rn on error resume nextrn Conn.open strrn If Err Thenrn System.halt("对不起,数据连接错误! " & Err.description)rn elsern response.write("数据连接成功!")rn End Ifrnrn查询语句rn strUserName = "select id from lq_employee where userName = 'admin'"rn set rs = conn.execute(strUserName)rnrnrs.count的值总是为0rnrn是什么原因呢
JDBC连接MySql数据库的问题
我有一个jdbctest.jsp的程序,源码如下:rn<%@ page contentType="text/html;charset=gb2312" %> rn<%rnjava.sql.Connection sqlConn;rnjava.lang.String strConn;rnClass.forName("org.gjt.mm.mysql.Driver").newInstance(); rnsqlConn= java.sql.DriverManager.getConnection("jdbc:mysql://localhost/test","test",""); rn%>rn运行后却出现如下错误:rnApache Tomcat/4.0.3 - HTTP Status 500 - Internal Server Errorrnrn--------------------------------------------------------------------------------rnrntype Exception reportrnrnmessage Internal Server Errorrnrndescription The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.rnrnexception rnrnjavax.servlet.ServletException: org.gjt.mm.mysql.Driverrn at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:463)rn at org.apache.jsp.jdbctest$jsp._jspService(jdbctest$jsp.java:72)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)rn at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)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:243)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)rn at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)rn at java.lang.Thread.run(Thread.java:536)rnrnrnroot cause rnrnjava.lang.ClassNotFoundException: org.gjt.mm.mysql.Driverrn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1394)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1243)rn at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:198)rn at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:132)rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)rn at java.lang.Class.forName0(Native Method)rn at java.lang.Class.forName(Class.java:130)rn at org.apache.jsp.jdbctest$jsp._jspService(jdbctest$jsp.java:61)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)rn at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)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:243)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)rn at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)rn at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)rn at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)rn at java.lang.Thread.run(Thread.java:536)rnrn不知道是什么原因,请高手指教!
连接MySql数据库的问题??????????
我下载了个网站源码,安装时出现You do not have the proper PHP extension installed to run a MySQL 4.1.x installation.错误,我的php.ini中说:;Windows Extensionsrn;Note that MySQL and ODBC support is now built in, so no dll is needed for it.rn我的php版本是4.3.8,mysql版本是4.1.10-nt,那位大虾知道是什么原因,如何解决?
jsp连接MySQL数据库的问题
我的代码如下:rnrn<%@ page contentType="text/html; charset=" language="java" import="java.sql.*" errorPage="error.jsp" %>rnrnrn rn JDBCrnrnrnrn Connect MySOLrn rn rn 用户名rn 姓名rn 电子邮箱rn 住址rnrn<%rn tryrn Class.forName("org.gjt.mm.mysql.Driver").newInstance();rn Connection conn=DriverManager.getConnection("jdbc:mysql://localhost/test?user=admin&useUnicode=true&characterEncoding=8859_1");rn Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);rn ResultSet rs=stmt.executeQuery("select * from Users");rn while(rs.next())rn rn out.println("TestName:"+rs.getString(2));rn rn rs.close();rn stmt.close();rn conn.close();rn rn catch(Exception ex) rn rn%> rnrnrnrnrnrn报错如下:rnrnHTTP Status 500 - rnrn--------------------------------------------------------------------------------rnrntype Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnorg.apache.jasper.JasperException: Unsupported encoding: rn org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)rn org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:404)rn org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:154)rn org.apache.jasper.compiler.JspUtil.getReader(JspUtil.java:1062)rn org.apache.jasper.compiler.ParserController.doParse(ParserController.java:253)rn org.apache.jasper.compiler.ParserController.parse(ParserController.java:139)rn org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:237)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)rn org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:856)rnrnrnnote The full stack trace of the root cause is available in the Tomcat logs.rnrnrn--------------------------------------------------------------------------------rnrnApache Tomcat/5.0.19rnrn我用java去连接,可以运行
关于连接MySql数据库的问题
以前的网站是用的Access数据库,现在想把数据库改成MySqlrnrn以前的网站程序中使用的是标准SQL语句,连接用的是OleDb,现在能不能不修改原码就直接使用同表名的MySql数据库?rn我在网上找到的OleDb的连接语句:rn"Provider=MySQLProv;Data Source=mydb;User Id=myUsername;Password=myPassword;"rn其中的user id和password该填什么?我只有在安装MySql时输入了一个密码,在每次启动时都要输入这个密码,password是不是要填这个?user id该填什么?rn我装了个MySql-Font,但启动时要填用户名和密码,我也不知道填什么?rnrn另外,data source要填数据库名,我是在C盘装的MySql,但我用了在C盘的MySql文件夹下建一个sym文件的方式将数据库地址指向了F盘,现在建的表都是在F盘,但确找不到数据库文件,请问在哪里可以找到?
连接mysql数据库的问题
import java.sql.*;rnclass sql rnrn java.sql.Connection sqlCon; //数据库连接对象 rn java.sql.Statement sqlStmt; //SQL语句对象 rn java.sql.ResultSet sqlRst; //结果集对象 rn java.lang.String strCon; //数据库连接字符串 rn java.lang.String strSQL; //SQL语句 rn public static void main(String[] args) rn rn try rn rn Class.forName(org.gjt.mm.mysql.Driver);rn sqlCon = java.sql.DriverManager.getConnection("jdbc:mysql://localhost/wind","root","123"); rn sqlStmt = sqlCon.createStatement();rn strSQL = "select * from thread"; rn sqlRst = sqlStmt.executeQuery(strSQL);rn while(sqlRst.next())rn System.out.println(sqlRst.getString("title"));rn rn catch (ClassNotFoundException e) rn catch (SQLException ex)rn rn rnrnrn出错信息:rne:\java\sql.java:13: package org.gjt.mm does not existrn Class.forName(org.gjt.mm.mysql.Driver);rn ^rnE:\java\sql.java:14: non-static variable sqlCon cannot be referenced from a static contextrn sqlCon = java.sql.DriverManager.getConnection("jdbc:mysql://localhost/wind","root","123"); rn ^rnE:\java\sql.java:15: non-static variable sqlStmt cannot be referenced from a static contextrn sqlStmt = sqlCon.createStatement();rn ^rnE:\java\sql.java:15: non-static variable sqlCon cannot be referenced from a static contextrn sqlStmt = sqlCon.createStatement();rn ^rnE:\java\sql.java:16: non-static variable strSQL cannot be referenced from a static contextrn strSQL = "select * from thread"; rn ^rnE:\java\sql.java:17: non-static variable sqlRst cannot be referenced from a static contextrn sqlRst = sqlStmt.executeQuery(strSQL);rn ^rnE:\java\sql.java:17: non-static variable strSQL cannot be referenced from a static contextrn sqlRst = sqlStmt.executeQuery(strSQL);rn ^rnE:\java\sql.java:17: non-static variable sqlStmt cannot be referenced from a static contextrn sqlRst = sqlStmt.executeQuery(strSQL);rn ^rnE:\java\sql.java:18: non-static variable sqlRst cannot be referenced from a static contextrn while(sqlRst.next())rn ^rnE:\java\sql.java:19: non-static variable sqlRst cannot be referenced from a static contextrn System.out.println(sqlRst.getString("title"));rn ^rn10 errorsrn输出完成 (耗时 1 秒) - 正常终止
vs2005连接mysql数据库的问题!
我装了MySQL Connector Net 5.1.6rn添加数据源的时候测试连接是成功的rn但是往下的时候就报错了rnrn"无法检索到此连接的数据库架构.请确保连接设置正确且数据库处于联机状态.rn输入的字符串格式不正确.不能在VERSION列中存储.所需类型是Int64."rn这个错误是什么意思?
perl 连接mysql数据库的问题
代码如下:rnrnuse DBI;rn$dbh = DBI->connect('DBI:mysql:mydata') or die $DBI::errstr;rnrn#####rn我在win2k下使用activeperl,然后安装dbi和dbd-mysqlpp,但程序运行的结果说rn我的dbd::mysql模块没有正确安装,出错。rnrn我安装dbd-mysqlpp是因为我在ppm下search了dbd模块后只发现了一个dbd-mysqlpprn模块,而没有dbd-mysql模块。请问到哪里出错了?如何解决。rnrn程序以前运行的非常正常,我重新安装了系统和一个最新版本的activeperl。rnrn
连接MYSQL数据库的问题。
import java.io.BufferedInputStream;rnimport java.io.BufferedOutputStream;rnimport java.io.DataInputStream;rnimport java.io.IOException;rnimport java.io.PrintStream;rnimport java.net.Socket;rnimport java.net.UnknownHostException;rnimport java.sql.Connection;rnimport java.sql.DriverManager;rnimport java.sql.ResultSet;rnimport java.sql.ResultSetMetaData;rnimport java.sql.SQLException;rnimport java.sql.Statement;rnrnrnpublic class NetClient rn rn private static int Port = 8088;rn private String url="jdbc:mysql://localhost:3306/meal";rn private String username="root";rn private String password="111";rn private Connection conn=null;rn private Statement statement=null;rn private ResultSet result=null;rn rn public NetClient()rn rn rn ConnectData();rn System.out.prinln("connect success");rn rn rn rn public void ConnectData()rn rn try //下面这行就出错了。rn Class.forName( "com.mysql.jdbc.Driver" );rn conn = DriverManager.getConnection( rn url,username,password ); rnrn catch (ClassNotFoundException e) rn // TODO 自动生成 catch 块rn System.err.println( rn "装载 JDBC/ODBC 驱动程序失败。" ); rn e.printStackTrace(); rn System.exit( 1 ); rn catch (SQLException e) rn // TODO 自动生成 catch 块rn System.err.println( "无法连接数据库" ); rn e.printStackTrace(); rn System.exit( 1 ); rn rn rn public static void main(String args[])rn rn new NetClient();rn rnrn报错:========================================================rnrn装载 JDBC/ODBC 驱动程序失败。rnjava.lang.ClassNotFoundException: com.mysql.jdbc.Driverrn at java.net.URLClassLoader$1.run(Unknown Source)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClassInternal(Unknown Source)rn at java.lang.Class.forName0(Native Method)rn at java.lang.Class.forName(Unknown Source)rn at NetClient.ConnectData(NetClient.java:55)rn at NetClient.(NetClient.java:43)rn at NetClient.main(NetClient.java:219)rnrn
jsp连接Mysql数据库的问题
前台的HTML页面接收用户输入的内容:rnrnrnrn rn MySQL 调用实例rnrnrnrn rn 学生姓名: rn 学生年龄: rn 学生介绍: rn rn rn rnrnrnrn后台具体的JAVA程序实现代码:rn// Java Documentrn/*Insert.java*/rnimport java.io.*;rn//导入JDBC相关的类rnimport java.sql.*;rn//导入Mysql的JDBC的相关类rnimport org.gjt.mm.mysql.*;rn//导入servlet的相关类rnimport javax.servlet.*;rnimport javax.servlet.http.*;rnpublic class Insert extends HttpServletrnrn//Servlet的dopost方法,来处理用户POST表单的请求rn public void doPost(HttpSerletRequest request,HttpServletResponse response)rn throws IOException,ServletExceptionrn rn //设置输出类型text/html,并且编号GB2312,这样才不会出现中文的乱码rn response.setContentType("text/html;charset=gb2312");rn //定义输出对象rn PrintWriter out=response.getWriter();rn java.sql.Connection conn=null;rn java.sql.Statement st=null;rn //将用户输入转换为8859-1编码的字节,然后再转换成字符,这样就不会出现中文乱码了rn String name=new String(request.getparameter("name").getBytes("8859-1"));rn String age=new String(request.getparameter("age").getBytes("8859-1"));rn String introduce=new String(request.getparameter("introduce").getBytes("8859-1")); rn tryrn //查找Mysql的JDBC驱动程序,如果找不到会出错rn Class.forName("org.gjt.mm.mysql.Driver");rn //连接数据库rn conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/person","root","123");rn out.println("与Mysql数据库连接成功! ");rn //生成数据库执行对象rn st=conn.createStatement();rn //执行添加学生的sql语句rn st.executeQuery("insert into student values('"+name+"','"+age+"','"+introduce+"')");rn out.println("学生添加成功! ");rn //关闭数据库rn conn.close();rn out.println("数据库关闭成功! ");rn rn rn //捕获错误rn catch(Exception e)rn rn rn //打印出错误信息rn out.printin("发生了如下错误: ");rn out.println(e.getMessage());rn rn rn
perl连接mysql数据库的问题?
[code=Perl]rn  #!c:\perl\binrn use DBI;rn # Connect to target DBrn my $dbh = DBI->connect("DBI:mysql:database=mydata;host=localhost","root","root", 'RaiseError' => 1);rn # queryrn my $sqr = $dbh->prepare("SELECT user FROM address");rn $sqr->execute();rn while(my $ref = $sqr->fetchrow_hashref()) rn print "$ref->'user'\n";rn rn $dbh->disconnect();rn[/code]rn上面的是在windows下perl连接mysql代码。rn问题是:连接mysql有问题。rnrn安装的软件及版本:perl5.10、 apache2.0.55、mysql5.0.18rn通过ppm安装了dbd-mysql,但是安装DBI时,提示no missing packages to installrn安装如图:rn[img=http://www.11pg.com/uploadfile/200903/20090312151857521.gif][/img]rn请大家给予帮助,谢谢!
vb.net连接MYSQL数据库的问题
1.我用vb.net连接MySQL数据库,版本是MYSQL 4.0.18-nt,有些老,我最初安装的是最新版驱动Connector/Net 6.9.6,但连接时提示不支持MYSQL 4X的版本,我只好去下载老版本Connector/Net 6.1.3。rnrn2.安装完毕后,连接目标数据库,由于MYSQL登陆用户名是root,密码是空的,我的登陆语句就是rndim conn as new mysql.data.mysqlclient.mysqlconnection("server=192.168.1.2;Database=test;uid=root;pwd=")rnConn.open()rn结果报错显示:未处理 NOTSUPPORTEXCEPTION only byte lengths of 2,4,or 8 are supported。rnrn3.请问这是什么问题啊?驱动的问题?是不是字符集的问题?搞不懂,急啊!rnrn4.我本机安装了MYSQL5.5 server ,在cmd里可以正常连接目标MYSQL啊。请各位大侠指点,不胜感激,痛哭流涕rnrn[img=https://img-bbs.csdn.net/upload/201503/07/1425701596_963006.jpg][/img]
不能连接mysql数据库的问题?
rn * org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) at com.lanyuer.util.DataConnectionManager.getConnection(DataConnectionManager.java:73) at org.apache.jsp.login.login_005fctlr_jsp._jspService(org.apache.jsp.login.login_005fctlr_jsp:109) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) Caused by: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:243) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773) ... 23 morernrn * 错误类型class org.apache.tomcat.dbcp.dbcp.SQLNestedExceptionrn
jsp连接mysql数据库的问题。
连接mysql数据库。rn出现一下错误rnaccessDb(): org.gjt.mm.mysql.DriverrnaccessDb().executeQuery: No suitable driverrn请问是什么问题。rn
php5连接mysql数据库的问题!!!
$link = mysql_connect("localhost", "root", "19821125")rn or die("Could not connect: " . mysql_error());rn print ("Connected successfully");rn mysql_close($link);rn我用上面的代码连接我本机的mysql数据库,但是提示:rnrnFatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\datatest.php on line 2rn请高手们赐教!!!rn
asp连接mysql数据库的问题
asp连接mysql数据库,可不可以不用安装mysql数据库的驱动,具体的代码怎么写啊,请高手帮忙!谢谢
PHP连接MYSQL数据库的问题!
使用PHP连接数据库时rnrn $result=$db->query("select count(*) from users");rnrn用什么 来 读取 select count(*)这个 语句的返回值呀rnrn$result返回的值 始终是1rnrn无论 数据库多少记录 都是1rnrn还有 返回 影响行数 要用那个函数来接 谢谢了
jdbc问题:连接MySql数据库
我想用JBuiler 连接MySql数据库rnrn但不知道该怎么用jdbcrnrn请求支援
MYSQL数据库的连接问题
PHPrnMySQLrnMySQL ODBC driver rnMySQL Control Center rnrn如上4个在我本机上安装一切正常,可以正常使用(本机XP系统)rnrn我安装到服务器上确出问题(2000系统),一直提示无法连接数据库。rn因为以前服务器上安装了极限OA系统,也使用的是MYSQL。导致在我安装MYSQL的时候提示默认的3306端口已经使用,我自己把端口换成了3406,会不会是这个原因导致我无法连接数据库呢。rn如果是应如何解决?rn不是应如何解决?rn
.net 连接mysql数据库的问题
一个小问题。我的程序以前连mysql数据库,端口是3306,可以连接,可是端口改成4506后,就连接不上了。程序如下:rn连接字符串:rn"Server=172.16.0.11:4506;persist security info=true;database=zbz_db;charset=gb2312;user id=root;password="rnrntryrnrn MySqlConnection dbconnection0=new MySqlConnection(connections);rn dbconnection0.Open();rn mydataset=new DataSet ();rn MySqlCommand sqlcmd = new MySqlCommand(sqlstr,dbconnection0);rn adapter=new MySqlDataAdapter(sqlstr,dbconnection0);//连接到 SQL SERVER 数据库rn rn adapter.SelectCommand = sqlcmd;rn if (bpage)rn rn adapter.Fill (mydataset,ctindex*pagesize,pagesize,"AA");rn rn else rn rn adapter.Fill (mydataset);rn rn rn adapter.Dispose();rn sqlcmd.Dispose();rn rn return mydataset.Tables[0];rnrncatchrnrn return null;rn
MYSQL数据库的连接mysql_real_connect问题
请教一个MYSQL数据库的连接问题,我用rnmysql_real_connect(&mysql,"192.168.2.2","root","123456","database",3306,NULL,0))连接数据库,rn可是出现如下的错误:rnClient does not support authentication protocol requested by server; consider upgrading MySQL clientrn是版本太低的原因吗,可是我的版本是5.0的啊,我用Navicat却可以连上,为什么用这个函数就连不上呢,还请高手赐教rnrnmysql_real_connect(&mysql,"127.0.0.1","root","123456","database",3306,NULL,0))这样可以连接数据库,rnrn远程连接的时候也不行,但是用Navicat却可以连上,用这个函数就是不行rnif(!mysql_real_connect(&mysql,"192.168.2.2","root","123456","database",3306,NULL,0)) rn rn CString strError;rn strError.Format("Failed to connect to database: Error: %s\n",mysql_error(&mysql));rn AfxMessageBox(strError); rn return FALSE;rn
Java连接Mysql数据库的问题
       前段时间有空闲就尝试了一下使用sharding-jdbc来实现分库分表的功能,在实现的过程中,其他都没有问题后,启动测试代码时却报错: ERROR pool.DruidDataSource - create connection error, url: jdbc:mysql://127.0.0.1:3306/sharding_0?useUnicode=true&amp;amp;serve...
tomcat连接mysql数据库的问题?
在不断快速刷新页面的后,无法连接上mysql,那位大侠知道怎么回事?rnrnrnlog里面有一个错误:rnApache Tomcat/4.1.18rnjava.sql.SQLException: Syntax error or access violation: You have an error in yornur SQL syntax. Check the manual that corresponds to your MySQL server version frnor the right syntax to use near '蔐~D1?(P^B:~D1?' at line 1rnrn
vb连接mysql数据库的问题
用vb连接mysql数据库,好像只能通过odbc建立连接,然后通过ado调用,现在的问题是,odbc的连接能不能通过vb的代码段写出来,而不是让用户自己去控制面版里自己设定呢?我想可以,但是我不知道怎么写,望大家给一些帮助!
jdbc连接mysql数据库的问题?
我想做一些java数据库方面的程序,可在进行mysql驱动程序的连接时出现了问题?rn我下载的驱动名是:mysql-connector-java-3.1.10.rn 在classpath中做了设置,E:\database\mysql-connector-java-3.1.10.jarrn写的测试程序是如下:(mysql数据库已经启动)rnimport java.sql.*; rnrnpublic class DBTest rnpublic static void main(String[] args) rnString driver = "org.git.mm.mysql.Driver";rnString url = "jdbc:mysql://localhost:3306/test";rnString user = ""; rnString password = ""; rntry rnClass.forName(driver); rnConnection conn = DriverManager.getConnection(url, user, password); rnif(!conn.isClosed()) rnSystem.out.println("数据库连接成功!"); rnconn.close(); rn rncatch(ClassNotFoundException e) rnSystem.out.println("找不到驱动程序"); rne.printStackTrace(); rn rncatch(SQLException e) rne.printStackTrace(); rn rn rnrn数据库名为:test,用户名和密码都为空.rn可是老是出现异常:java.lang.ClassNotFoundException: org.git.mm.mysql.Driverrnmysql的版本是:5.0.22rn
java连接mysql数据库的问题
为什么我在mysql命令控制台能执行的Insert语句放到java代码里只能insert数字了?rn代码如下:rn...rnString name = "abc";//这里改为数字可以通过,如"123"rn...rnString sql = "Insert into sms(TaskID,Discribe,Code,Number,Type,State1,State2,Pname,Usertype) values("+name+","+discribe+","+code+","+number+","+type+','+state1+','+state2+','+pname+','+user+");";rnstatement.executeUpdate(sql);rn...rn报错rnjava.sql.SQLException: Column not found: Unknown column 'abc' in 'field list'rnrn这里的TaskID,Discribe等是char型rnrn求教rn
关于连接mysql数据库的问题???
我从www.mysql.com下载了一个mysql的数据库驱动,文件名为mm.mysql-2.0.4-bin.jar.我把它放到jdk的安装目录下的lib目录里,也就是dt.jar和tools.jar一起的目录,并且在autoexec.bat文件中加入了classpath,rn现在我写一个程序访问mysql数据库rn如何用这个driver?rnimport java.sql.*;rnClass.forName("org.git.mm.mysql.Driver");rn这样可以么???rn请各位帮忙看看,多谢
连接mysql数据库遇到的问题
Table 'performance_schema.session_variables' doesn't exist 解决方法:mysql -u app -p mysql> set @@global.show_compatibility_56=ON;
JDBC连接mysql数据库的问题
JDBC连接mysql数据库,下载mysqljdbc.jar后可以随意放在任何目录下吗,需要设置相关的classpath吗;如果需要,该如何设置;rn然后在程序中写:Class.forName("com.mysql.jdbc.Driver");这个驱动程序“com.mysql.jdbc.Driver”是在哪里的,在哪个目录下面,需要把路径全部写出吗,比如“Class.forName("c:\users\book\com.mysql.jdbc.Driver")”,还是不用理会具体路径,就直接写“Class.forName("com.mysql.jdbc.Driver");”,系统会自动查找这个驱动;rn然后在程序中有语句:“Connection connection = DriverManager.getConnectionrn("jdbc:mysql://localhost/test");”,这里localhost是指本机,也就是说需要连接的数据库test就在本机上,是这样吗;rn如果要连接到网络中别的计算机上的数据可test就必须写出该机的IP地址,比如“Connection connection = DriverManager.getConnectionrn("jdbc:mysql://192.168.8.2/test");”,是这样吗;rntest就是要连接的数据库的名字,这里不需要给出test的具体路径吗,比如rn”Connection connection = DriverManager.getConnectionrn("jdbc:mysql://192.168.8.2/c:\sql\test");这样的;系统会自动查找到test这个数据库,是这样吗;rn本人是新手,正在学习JDBC,请各位多指教
dreamweaver与MySQL数据库的连接问题
各位有谁用过Dreamweaver与MySQL连接过,帮忙告诉一下,不胜感激,要详细一点的,谢谢
有关连接mysql数据库的问题
网上初步了解bcb可以连接mysql4.0的数据库rn但是,假如远程的服务器是mysql5.0的数据库,那就不能用BCB写的程序了?
.net 连接MySql数据库的问题
数据库版本:MySql 5rn.net 版本:2.0rnPHP版本:5rnWEB服务器:Server 2003;rnrn在客户端命令行连接数据库,正常;rn使用PHP连接数据库,正常;rn使用.net连接数据库,失败;
相关热词 c++和c#哪个就业率高 c# 批量动态创建控件 c# 模块和程序集的区别 c# gmap 截图 c# 验证码图片生成类 c# 再次尝试 连接失败 c#开发编写规范 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数