spark jdbc连接impala报错Method not supported 40C

各位好

我的spark是2.1.0,用的hive-jdbc 2.1.0,现在写入impala的时候报以下错:
java.sql.SQLException: Method not supported
at org.apache.hive.jdbc.HivePreparedStatement.addBatch(HivePreparedStatement.java:75)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$.savePartition(JdbcUtils.scala:589)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anonfun$saveTable$1.apply(JdbcUtils.scala:670)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anonfun$saveTable$1.apply(JdbcUtils.scala:670)
at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$29.apply(RDD.scala:925)
at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$29.apply(RDD.scala:925)
at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:1944)
at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:1944)
at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
at org.apache.spark.scheduler.Task.run(Task.scala:99)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:322)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Driver stacktrace:
at org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGScheduler$$failJobAndIndependentStages(DAGScheduler.scala:1435)
at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1423)
at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1422)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:1422)
at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:802)
at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:802)
at scala.Option.foreach(Option.scala:257)
at org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:802)
at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.doOnReceive(DAGScheduler.scala:1650)
at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1605)
at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1594)
at org.apache.spark.util.EventLoop$$anon$1.run(EventLoop.scala:48)
at org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:628)
at org.apache.spark.SparkContext.runJob(SparkContext.scala:1918)
at org.apache.spark.SparkContext.runJob(SparkContext.scala:1931)
at org.apache.spark.SparkContext.runJob(SparkContext.scala:1944)
at org.apache.spark.SparkContext.runJob(SparkContext.scala:1958)
at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1.apply(RDD.scala:925)
at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1.apply(RDD.scala:923)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
at org.apache.spark.rdd.RDD.withScope(RDD.scala:362)
at org.apache.spark.rdd.RDD.foreachPartition(RDD.scala:923)
at org.apache.spark.sql.Dataset$$anonfun$foreachPartition$1.apply$mcV$sp(Dataset.scala:2305)
at org.apache.spark.sql.Dataset$$anonfun$foreachPartition$1.apply(Dataset.scala:2305)
at org.apache.spark.sql.Dataset$$anonfun$foreachPartition$1.apply(Dataset.scala:2305)
at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:57)
at org.apache.spark.sql.Dataset.withNewExecutionId(Dataset.scala:2765)
at org.apache.spark.sql.Dataset.foreachPartition(Dataset.scala:2304)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$.saveTable(JdbcUtils.scala:670)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:77)
at org.apache.spark.sql.execution.datasources.DataSource.write(DataSource.scala:518)
at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:215)
at org.apache.spark.sql.DataFrameWriter.jdbc(DataFrameWriter.scala:446)
at com.aoyou.data.CustomerVisitProduct$.saveToHive(CustomerVisitProduct.scala:281)
at com.aoyou.data.CustomerVisitProduct$.main(CustomerVisitProduct.scala:221)
at com.aoyou.data.CustomerVisitProduct.main(CustomerVisitProduct.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:738)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:187)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:212)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:126)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.sql.SQLException: Method not supported
at org.apache.hive.jdbc.HivePreparedStatement.addBatch(HivePreparedStatement.java:75)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$.savePartition(JdbcUtils.scala:589)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anonfun$saveTable$1.apply(JdbcUtils.scala:670)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anonfun$saveTable$1.apply(JdbcUtils.scala:670)
at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$29.apply(RDD.scala:925)
at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$29.apply(RDD.scala:925)
at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:1944)
at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:1944)
at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
at org.apache.spark.scheduler.Task.run(Task.scala:99)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:322)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

以下是代码实现
val sparkConf = new SparkConf().setAppName("save").set("spark.sql.crossJoin.enabled", "true");

val sparkSession = SparkSession
  .builder()
    .enableHiveSupport()
    .getOrCreate();
val dataframe = sparkSession.createDataFrame(rddSchema, new Row().getClass())

val property = new Properties();
property.put("user", "xxxxx")
property.put("password", "xxxxx")
dataframe.write.mode(SaveMode.Append).option("driver", "org.apache.hive.jdbc.HiveDriver").jdbc("jdbc:hive2://xxxx:21050/rawdata;auth=noSasl", "tablename", property)

请问这是怎么回事啊?感觉是驱动版本问题

2个回答

方法不支持,版本问题

换个jar包,jdbc的jar包不对

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
采用jdbc连接Impala
简单的代码,采用JDBC连接Impala。内容有需要的lib包和一个TestImpala.java的类。需要自己创建一个java工程,并导入包运行。
jdbc 连接impala或者jdbc连接hive
jdbc 连接impala或者jdbc连接hive所需的jar包。
python连接impala报错
背景 连接器一般使用impyla,但是我发现这个库问题不少,关键报错了看不出来哪里出问题了,着实令人蛋疼!! 问题 常见的难以解决的报错有: 1. AttributeError: 'TBufferedTransport' object has no attribute 'trans' 2. TypeError: expecting list of size 2 for struct
impala连接kudu数据库(jdbc)
1.驱动包 https://download.csdn.net/download/u012448904/10663555  也可以在这里下。 <!--可以去官网下载--> <dependency> <groupId>owinfo</groupId> <artif...
impala jdbc
https://www.cloudera.com/downloads/connectors/impala/jdbc/2-6-3.html
Request method 'POST' not supported
rn rn rn rn :rnrn rn rn rnrn rn :rnrn rn rn rnrn rn rnrn rn rn rn rn rn rn为什么提交不了form 表单 一提交 就报题目那个错误
method '' not supported by automation object
method 'AAA' not supported by automation object rnrn总是提示这个错误,该从哪方面去找原因啊rnrn
jdbc 通过impala 连接hive库
一直在网上找不到impalajdbc的pom依赖,项目是maven的,所以整理了所用的pom
spark连接cassandra报错
[img=https://img-bbs.csdn.net/upload/201406/11/1402475020_902266.jpg][/img]
java通过jdbc连接impala所需jar
博客中所需jar包,提供下载。java通过jdbc连接impala的方式之一
用jdbc连接impala(kerberos认证)
上代码import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import org.apache.hadoop.conf.Configuration;import org.apac...
HTTP method GET is not supported by this URL
我想在select的onchange事件中提交servlet可是出现如题所示的错误!rn我的servlet中的方法是dopostrnjs中的提交代码是:rnfunction selectName() rnvar projectName=document.saleform.contractnum.value; rnwindow.location="chaxunServlet?projectName= "+document.saleform.contractnum.value; rnrn点击按钮后提示:rnHTTP method GET is not supported by this URLrn这是怎么回事?怎么解决?rn
Method 'SaveAs' not supported by automation object
varrn oXL, oWB, oSheet, oRng, VArray : Variant;rn SysPath:string;rnbeginrn SysPath:=ExtractFilePath(application.exename);rn Aq.Close;rn Aq.SQL.Add('psp_goodtype');rn Aq.Open;rn while not Aq.Eof dorn beginrn // Start Excel and get Application Objectrn oXL := CreateOleObject('Excel.Application');rn oXL.Visible := false;rn // Get a new workbookrn oWB := oXL.Workbooks.Add;rn oSheet := oWB.ActiveSheet;rnrn // Add table headers going cell by cellrn rn ……rn //get the classrn [color=#FF0000]oXL.SaveAs(SysPath[/color]+'\'+Aq.Fields[3].AsString+'_'+Aq.Fields[4].AsString+'_'+Aq.Fields[5].AsString+'.xls');rn oXL.Workbooks.Close;rn oXL.Close;rn Memo1.Lines.Insert(0,[color=#FF0000]Aq.Fields[3].[/color]AsString+'---'+Aq.Fields[4].AsString+'---'+Aq.Fields[5].AsString);rn Aq.Next;rn end;rnend;rn运行提示Method 'SaveAs' not supported by automation object,难道Delphi操作Excel自动保存还有什么玄机?rn另外读取数据库时如果我不使用fidlds[0]这样的序号来读,使用字段名应该使用哪个方法呢?请举例说明,谢谢!
springmvc Request method 'GET' not supported
@RequestMapping("/aa")rn@Controllerrnpublic class EmployeesHandler rn rn rn @Autowiredrn private EmployeeDao employeeDao;rn @Autowiredrn private DepartmentDao departmentDao;rn rn @RequestMapping(value="/insert/id",method=RequestMethod.DELETE)rn public String delete(@PathVariable("id")Integer id)rn employeeDao.delete(id);rn System.out.println(1);rn return "redirect:emps";rn rn rn @RequestMapping(value="/insert",method=RequestMethod.POST)rn public String insertList(Employee employee)rn employeeDao.save(employee);rn return "redirect:emps";rn rn rn @RequestMapping(value="/insert",method=RequestMethod.GET)rn public String inset(Map map)rn map.put("departments",departmentDao.getDepartments());rn map.put("employees", new Employee());rn return "insert";rn rn rn rn @RequestMapping(value="/emps")rn public String list(Map map)rn map.put("employees", employeeDao.getAll());rn return "list";rn rnrnrnrnemployeeDao.delete(id);System.out.println(1);;可以在控制台输出1,rn但是在redirect:emps后就提示Request method 'GET' not supportedrn
HTTP method POST is not supported by this URL ??
孙鑫的书, servlet/jsp深入详解,网上参见http://www.qijan.com/bbs/viewthread.php?action=printable&tid=10063 rnrn书上67页请求转发的例子, 例2-16 PortalServlet.java和例2-17 LoginServlet2.javarn网上请通过ctrl+F去查找rnrn点登陆后出现错误: HTTP method POST is not supported by this URLrnrn把例2-17 LoginServlet2.java第21行代码form method=post改成form method=get后运行正常.rn请问是为什么?rnrnrnrn附两个程序:rn例2-16 PortalServlet.javarn1. package org.sunxin.ch02.servlet;rnrn2. rn3. import java.io.IOException;rn4. import java.io.PrintWriter;rn5. rn6. import javax.servlet.RequestDispatcher;rn7. import javax.servlet.ServletContext;rn8. import javax.servlet.ServletException;rn9. import javax.servlet.http.HttpServlet;rn10. import javax.servlet.http.HttpServletRequest;rn11. import javax.servlet.http.HttpServletResponse;rn12. rn13. public class PortalServlet extends HttpServletrn14. rn15. public void doGet(HttpServletRequest req, HttpServletResponse resp)rn16. throws ServletException,IOExceptionrn17. rn18. resp.setContentType("text/html;charset=gb2312");rn19. rn20. PrintWriter out=resp.getWriter();rn21. rn22. out.println(" ");rn23. out.println("登录页面");rn24. out.println("");rn25. rn26. String name=req.getParameter("username");rn27. String pwd=req.getParameter("password");rn28. rn29. if("zhangsan".equals(name) && "1234".equals(pwd))rn30. rn31. ServletContext context=getServletContext();rn32. RequestDispatcher rd=context.getRequestDispatcher("/welcome");rn33. rd.forward(req,resp);rn34. rn35. elsern36. rn37. RequestDispatcher rd=req.getRequestDispatcher("login2");rn38. rd.include(req,resp);rn39. rn40. out.println("");rn41. out.close();rn42. rn43. public void doPost(HttpServletRequest req,HttpServletResponse resp)rn44. throws ServletException,IOExceptionrn45. rn46. doGet(req,resp);rn47. rn48. rnrnrnrnrn例2-17 LoginServlet2.javarn1. package org.sunxin.ch02.servlet;rnrn2. rn3. import java.io.IOException;rn4. import java.io.PrintWriter;rn5. rn6. import javax.servlet.ServletException;rn7. import javax.servlet.http.HttpServlet;rn8. import javax.servlet.http.HttpServletRequest;rn9. import javax.servlet.http.HttpServletResponse;rn10. rn11. public class LoginServlet2 extends HttpServletrn12. rn13. public void doGet(HttpServletRequest req, HttpServletResponse resp)rn14. throws ServletException,IOExceptionrn15. rn16. rn17. resp.setContentType("text/html;charset=gb2312");rn18. rn19. PrintWriter out=resp.getWriter();rn20. rn21. out.println(" ");rn22. rn23. out.println(" ");rn24. rn25. out.println(" ");rn26. out.println(" 请输入用户名");rn27. out.println(" ");rn28. out.println("");rn29. rn30. out.println(" ");rn31. out.println(" 请输入密码");rn32. out.println(" ");rn33. out.println("");rn34. rn35. out.println(" ");rn36. out.println(" ");rn37. out.println(" ");rn38. out.println("");rn39. rn40. out.println("");rn41. out.println("");rn42. rn43. rn44. public void doPost(HttpServletRequest req,HttpServletResponse resp)rn45. throws ServletException,IOExceptionrn46. rn47. doGet(req,resp);rn48. rn49. rn
The method 'SelectMany' is not supported 错误求教
[b]Error :[/b]rnThe method 'SelectMany' is not supportedrnrn[color=#FF0000]Line 54: Response.Write(CommentsAfterJanuary1st.Count());[/color]rnLine 55: rnLine 56: //foreach (var k in CommentsAfterJanuary1st)rnrnrn[b]CODE:[/b]rnrnvar postsWithCommentsAfterJanuary1st = from p in collection.Linq()rn where p.Comments.Any(c => c.TimePosted >rn new DateTime(2009, 1, 1)) rn select newrn rn Title = p.Title,rn Body = p.Bodyrn ;rnrn foreach (var p in postsWithCommentsAfterJanuary1st)rn rn Response.Write(p.Title + " " + p.Body + " "); rn rn//以上执行成功rn var CommentsAfterJanuary1st = from p in collection.Linq()rn from c in p.Commentsrn where p.CharCount > 10 && c.TimePosted > new DateTime(2010, 1, 1)rn select newrn c.Email;rn Response.Write(CommentsAfterJanuary1st.Count());rn//错误发生rn
HTTP method POST is not supported by this URL
一个很简单的网页,提交一个选项,让后返回建议,但是一点提交就出错,下面是html xml 和servlet的代码rn![图片说明](https://img-ask.csdn.net/upload/201806/25/1529927309_326821.png)rn![图片说明](https://img-ask.csdn.net/upload/201806/25/1529927323_40723.png)rn![图片说明](https://img-ask.csdn.net/upload/201806/25/1529927334_893242.png)rn网页能够正常打开,但是一点提交就405rn![图片说明](https://img-ask.csdn.net/upload/201806/25/1529927377_549407.png)
Property or Method not supported by layers of this type.
我在MapX中添加一个UserLayer,功能是添加个比例尺显示在地图左上角,那段代码是从别人的源码考过来的,地图单位和我的不一样,我的是Km,运行后可以显示比例尺,但弹出个对话框说Property or Method not supported by layers of this type.点击确定又弹出,就这样不断地弹出来,程序没法使用了,那位知道这是怎么回事,帮帮忙啊,谢谢了!!rn下面是代码rnvoid CWLDispView::OnDrawUserLayer(LPDISPATCH Layer, long hOutputDC, long hAttributeDC, rn LPDISPATCH RectFull, LPDISPATCH RectInvalid)rnrn float barWidth =(float)0.5, barHeight =(float)0.08;rn float startX =(float).3, startY =(float).3;rn long x1, y1;rn int i;rnrn // attach to dc that mapx passed us so we can use rn // mfc CDC object. (we will detach before exiting this methodrn CDC dc;rn CPen pen;rn CBrush brushRed, brushWhite, *pOldBrush;rn CFont *pOldFont;rn rn pen.CreatePen(0,1,(COLORREF)0);rn brushRed.CreateSolidBrush(255);rn brushWhite.CreateSolidBrush(16777215);rnrn dc.Attach((HDC)hOutputDC);rn dc.SetAttribDC((HDC)hAttributeDC);rnrn //Set map mode to HI-Englishrn dc.SetMapMode(MM_HIENGLISH);rn //Set pen to blackrn CPen *pOldPen = dc.SelectObject(&pen);rn pOldBrush = dc.SelectObject(&brushRed);rnrn //convert to HiEnglish, Conversion needed because one HIENGLISH unit is .001 inchrn x1=(long)(startX*1000);rn y1=(long)(startY*1000);rn barWidth*=1000;rn barHeight*=1000;rnrn for (i=0; i<=1; i++) rn long x2 =(long)(barWidth+x1);rn long y2 =(long)(barHeight+y1);rn rn /*** First Section ***/rn if (i==0) rn dc.SelectObject(&brushRed); //Redrn rn else rn dc.SelectObject(&brushWhite); //Whitern rnrn // with mapMode HIENGLISH, positive is x to the right, positive y is uprn dc.Rectangle(x1, -y1, x2, -y2);rnrn /*** Second Section ***/rn x1=x2;rn x2=(long)(barWidth+x1);rn if (i==0) rn dc.SelectObject(&brushWhite); //Whitern rn else rn dc.SelectObject(&brushRed); //Redrn rn dc.Rectangle(x1, -y1, x2, -y2);rnrn /*** Third Section ***/rn x1=x2;rn x2=(long)(barWidth*2+x1);rn if (i==0) rn dc.SelectObject(&brushRed); //Redrn rn else rn dc.SelectObject(&brushWhite); //Whitern rn dc.Rectangle(x1, -y1, x2, -y2);rn rn /*** Reset Values for bottom bar pass***/rn x1=(long)(startX*1000);rn y1=y2;rn // End Forrnrn // Calculate Pixels Per Inchrn CPoint pt(1000, 1000); // In HIENGLISH 1000 units = 1 inchrn dc.LPtoDP(&pt); // Convert inch to pixelrn long lPixPerInch = pt.x;rnrn CRect rc;rn CView::GetClientRect(&rc);rnrn float screenX, screenY;rn double mapX1, mapY1;rn // subtract lPixPerInch from center to get 1 inch to left of Centerrn screenX = (float)(rc.right/2-lPixPerInch);rn screenY = (float)(rc.bottom/2);rn try rn m_ctrlMapX.ConvertCoord(&screenX, &screenY, &mapX1, &mapY1, miScreenToMap);rn rn catch (COleDispatchException *e) rn e->ReportError();rn e->Delete();rn rn catch (COleException *e) rn e->ReportError();rn e->Delete(); rn rn rn double mapX2, mapY2;rn // add lPixPerInch to center to get 1 inch to right of Centerrn screenX = (float)(rc.right/2+lPixPerInch);rn screenY = (float)(rc.bottom/2);rn try rn m_ctrlMapX.ConvertCoord(&screenX, &screenY, &mapX2, &mapY2, miScreenToMap);rn rn catch (COleDispatchException *e) rn e->ReportError();rn e->Delete();rn rn catch (COleException *e) rn e->ReportError();rn e->Delete(); rn rn CFont font;rn font.CreatePointFont(100, "Arial", &dc);rnrn pOldFont = dc.SelectObject(&font);rn dc.SetTextColor(0); //Blackrn dc.SetBkMode(TRANSPARENT);rnrn // Output ScaleBar start Label = 0rn x1=(long)(startX*1000);rn y1=(long)((startY-.2)*1000);rn dc.TextOut(x1,-y1,"0");rnrn // Output label for distance of 1 inchrn x1=(long)(barWidth*2+startX*1000);rnrn CString str;rn str.Format("%.0f",m_ctrlMapX.Distance(mapX1, mapY1, mapX2, mapY2)/2);rn // Need to center text over center line. will move it 60 units for each characterrn int iCenterAdjustment = 60*str.GetLength();rn dc.TextOut(x1-iCenterAdjustment,-y1,str);rnrn // Output label for distance of 2 inchesrn x1=(long)(barWidth*4+startX*1000);rnrn str.Format("%.0f",m_ctrlMapX.Distance(mapX1, mapY1, mapX2, mapY2));rn // Need to center text over end line. will move it 60 units for each characterrn iCenterAdjustment = 60*str.GetLength();rn dc.TextOut(x1-iCenterAdjustment,-y1,str);rnrn // Output label for Units "Miles"rn x1=(long)(barWidth*2+startX*1000);rn y1=(long)((startY+.2)*1000);rn // Need to center text over center line. will move it 60 units for each characterrn str.Format("Miles");rn iCenterAdjustment = 60*str.GetLength();rn dc.TextOut(x1-iCenterAdjustment,-y1,str);rnrn dc.SelectObject(pOldBrush);rn dc.SelectObject(pOldPen);rn dc.SelectObject(pOldFont);rnrn // detach dc so destructore won't call Release itrn dc.ReleaseAttribDC();rn dc.Detach();rn
impala jdbc driver
impala jdbc driver 2.6.3.1004 - 2018.07.06 java利用jdbc方式连接impala所需要的驱动jar包。
Impala的JDBC编程驱动
impala的驱动下载,com.cloudera.impala.jdbc41.Driver
JDBC连接sqlserver2005报错
报错信息:rn2009-3-19 7:20:51 com.microsoft.sqlserver.jdbc.AuthenticationJNI rn警告: Failed to load the sqljdbc_auth.dllrnrn网上说只要把sqljdbc_auth.dll放到system32目录下就可以了。。。 rnsqljdbc_auth.dll 去那里下载啊?
jdbc连接sqlserver2005,报错...
我已经启用了混合模式,加载了msbase.jar,mssqlserver.jar,msutil.jar,sqljdbc.jar这四个jar。rn测试代码:rnpublic static void main(String[] args) throws Exception rn Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");rn String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb";rn Connection conn = (Connection) DriverManager.getConnection(url,"sa","root"); rn String sql = "INSERT INTO user (id ,name, password) VALUES (1,'test', 'test')"; rn Statement stmt = (Statement) conn.prepareStatement(sql); rn stmt.executeUpdate(sql);rn conn.close(); // 关闭数据库连接rn stmt.close();rn rnrn[color=#FF0000]报错:rnException in thread "main" java.lang.ClassCastException: com.microsoft.jdbc.sqlserver.SQLServerConnection cannot be cast to com.mysql.jdbc.Connection[/color]rn求解???
jdbc连接Oracle报错
import java.sql.*;rnrnpublic class TestJDBC rnrn public static void main(String[] args) throws Exception rn Class.forName("oracle.jdbc.driver.OracleDriver");rn Connection conn = DriverManager.getConnection("jdbc:Oracle:thin:@127.0.0.1:1521:orcl", "scott", "tiger");rn rnrn[img=https://img-bbs.csdn.net/upload/201504/25/1429941537_131571.png][/img]rnrn为什么用127.0.0.1可以连接上,用192.168.1.102报错:rnException in thread "main" java.sql.SQLException: The Network Adapter could not establish the connectionrn at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)rn at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:531)rn at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:221)rn at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)rn at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)rn at java.sql.DriverManager.getConnection(DriverManager.java:664)rn at java.sql.DriverManager.getConnection(DriverManager.java:247)rn at TestJDBC.main(TestJDBC.java:8)rnCaused by: oracle.net.ns.NetException: The Network Adapter could not establish the connectionrn at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:359)rn at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422)rn at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:672)rn at oracle.net.ns.NSProtocol.connect(NSProtocol.java:237)rn at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)rn at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)rn ... 7 morernCaused by: java.net.ConnectException: Connection refused: connectrn at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)rn at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)rn at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)rn at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)rn at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)rn at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)rn at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)rn at java.net.Socket.connect(Socket.java:589)rn at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:141)rn at oracle.net.nt.ConnOption.connect(ConnOption.java:123)rn at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:337)rn ... 12 morern
jdbc连接sql报错
环境是XP系统,已经安装SP4补丁,3个包已经放在/lib下,sql2000的登录模式是混合登录,用户名和密码均为"sa",驱动数据库没有报错,连接数据库却不行,具体代码如下rn<%@page contentType="text/html;charset=gbk"%>rn<%@page import="java.sql.*"%>rn<%!rn String dbdriver="com.microsoft.jdbc.sqlserver.SQLServerDriver";rn String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=bookmanage";rn String user="sa";rn String password="sa";rn Connection conn=null;rn String sql=null;rn PreparedStatement pstat=null;rn%>rn<%rn //启动数据库驱动rn tryrn rn Class.forName(dbdriver);rn rn catch(Exception e)rn rn out.println(e);rn rn //注明:没写以上代码是没有报错也没有异常的rn //连接数据库rn tryrn rn conn=DriverManager.getConnection(url,user,password);rn rn catch(Exception e)rn rn out.println(e);rn rn rn%>rn在浏览器运行时报错如下:rnorg.apache.jasper.JasperException: An exception occurred processing JSP page /databasedemo/sqldemo.jsp at line 25rnrn22: //连接数据库rn23: tryrn24: rn25: conn=DriverManager.getConnection(url,user,password);rn26: rn27: catch(Exception e)rn28: rnrnrnStacktrace:rn org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rnrn
impala jdbc hive
impala jdbc hive只要新建 DriverManager 并将 Impala的JDBC Jar包加载进来就可以 这个方法也可以应用于其他支持JDBC连接的数据库,如Hive等
Impala学习-JDBC配置
Impala学习-JDBC配置 0x01 摘要 本文介绍了使用JDBC方式访问Impala时的一些常用配置。 0x02 JDBC-URL格式 jdbc格式的基本格式如下: jdbc:impala://[Host]:[Port] 当加入了一些配置参数后,jdbc-url格式如下: jdbc:impala://[Host]:[Port]/[Schema];[Property1]=[Value];[P...
impala jdbc 41.jar
简单的代码,采用JDBC连接Impala。内容有需要的lib包。需要自己创建一个java工程,并导入包运行。
impala jdbc jar
连接impala的两种jdbc方式:hive jdbc\impala jdbc ,所需的jar包,包括ImpalaJDBC41.jar、hive-jdbc-1.1.0.jar
Cloudera JDBC Driver for Impala
Cloudera JDBC Driver for Impala ,jdbc连接cdh impala 官方驱动
一个简单servlet+jsp+javabean报错 405 HTTP method POST is not supported by this URL
本人菜鸟,求高手帮帮忙。要做毕业设计了。。。。。rnrnCheckAdmin:rnpackage com.tyhg.action;rnrnimport java.io.IOException;rnimport java.io.PrintWriter;rnrnimport javax.servlet.ServletException;rnimport javax.servlet.http.HttpServlet;rnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnpublic class CheckAdmin extends HttpServletrnrn protected void processRequest(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletExceptionrn response.setContentType("text/html;charset=UTF-8");rn PrintWriter out = response.getWriter();rn String name = request.getParameter("username");rn String pass = request.getParameter("password");rn if(name.equalsIgnoreCase("admin") && pass.equals("12345"))rn response.sendRedirect("http://www.baidu.com");rn rn elsern response.sendRedirect("http://www.baidu.com");rn rn out.close();rn rn rn protected void doPost(HttpServletResponse response,HttpServletRequest request) throws IOException,ServletExceptionrn processRequest(request,response);rn rn protected void doGet(HttpServletResponse response,HttpServletRequest request) throws IOException,ServletExceptionrn doPost(request,response);rn rnrnrnweb.xml:rn rn CheckAdminrn com.tyhg.action.CheckAdminrn rn rn CheckAdminrn /CheckAdminrn rnjsp:rn
报错:HTTP Status 405 - HTTP method GET is not supported by this URL
import java.io.*;rnimport javax.servlet.*;rnimport javax.servlet.http.*;rnrnpublic class HelloServlet extends HttpServlet rnrn //从HttpServlet类的帮助文档中复制service方法的声明部分可避免书写错误rn //private static final long serialVersionUID = 1L;rn protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException rn // TODO Auto-generated method stub rn doPost(request,response); rn rn rn public void Service(HttpServletRequest request,rn HttpServletResponse response)rn throws IOException, ServletExceptionrn rn PrintWriter out = response.getWriter();rn out.println("");rn out.println("www.it315.org ");rn out.println(""+ new java.util.Date() +"");rn out.println("");rn rn rnrn请高手们帮帮忙看看,用浏览器运行时,出现错误:rnHTTP Status 405 - HTTP method GET is not supported by this URLrnrn--------------------------------------------------------------------------------rnrntype Status reportrnrnmessage HTTP method GET is not supported by this URLrnrndescription The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).rnrn是怎么回事呢?我是新手菜鸟,很想学好java,希望大家帮我看看哦~~
Delphi 控制 CodeSoft 报错 Method 'Dialogs' not supported by automation object
Method 'Dialogs' not supported by automation objectrn[code=Delphi(Pascal)]rnunit Unit1;rnrninterfacernrnusesrn Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,rn Dialogs,ShellApi,Comobj,OleServer, StdCtrls, LabelManager2_TLB, jpeg,rn ExtCtrls,Clipbrd, DB, ADODB;rnrntypern TForm1 = class(TForm)rn OpenDialog1: TOpenDialog;rn CheckBox1: TCheckBox;rn Image1: TImage;rn Button7: TButton;rn Button8: TButton;rn Button9: TButton;rn Button1: TButton;rn procedure Button7Click(Sender: TObject);rn procedure Button8Click(Sender: TObject);rn procedure Button9Click(Sender: TObject);rn procedure Preview();rn procedure FormClose(Sender: TObject; var Action: TCloseAction);rn procedure FormCreate(Sender: TObject);rn procedure Button1Click(Sender: TObject);rn privatern Private declarations rn publicrn Public declarations rn end;rnrnvarrn Form1: TForm1;rn BarApp,BarDoc,BarVars:Variant;rn OpenEd:boolean;rnrn MyApp:LabelManager2_TLB.Application;rn MyDoc:LabelManager2_TLB.Document;rn MyVars:LabelManager2_TLB.Variables;rnrnimplementationrnrn$R *.dfmrnprocedure TForm1.Preview();rnbeginrn if not opened thenrn exit;rn BarDoc.CopyToClipboard;rn image1.Picture.Bitmap.Assign(Clipboard);rnend;rnrn预览rnprocedure TForm1.Button1Click(Sender: TObject);rnbeginrn Preview;rnend;rnrn打开并打印rnprocedure TForm1.Button7Click(Sender: TObject);rnVar rn slab:string;rnbeginrn if not opendialog1.Execute thenrn exit;rn slab:=opendialog1.FileName;rnrn BarApp := CreateOleObject('lppx.Application');rn opened:=true;rn BarApp.Visible:=false;rn BarDoc:=BarApp.ActiveDocument;rn BarVars:=BarDoc.Variables;rn BarDoc.Open(slab);rn BarDoc.Variables.Item('Data1').Value:='ABCD';rn BarDoc.Variables.Item('Data2').Value:='111';rn BarDoc.Variables.Item('Data3').Value:='111ABCD';rn Bardoc.Printlabel(1);rn BarDoc.FormFeed;rnEnd;rnrn设置打印机rnprocedure TForm1.Button8Click(Sender: TObject);rnbeginrn if not opened thenrn exit;rn BarApp.Dialogs.Item(lppxPrinterSelectDialog).Show;rn ================================================rn 运行到这一句出错:Method 'Dialogs' not supported by automation objectrn ================================================rnrnend;rnrn关闭rnprocedure TForm1.Button9Click(Sender: TObject);rnbeginrn close;rnend;rnrn窗体关闭rnprocedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);rnbeginrn if not opened thenrn exit;rn Bardoc.Close;rn BarApp.Quit;rnend;rnrn窗体创建rnprocedure TForm1.FormCreate(Sender: TObject);rnbeginrn opened:=false;rnend;rnrnrnrnend.rn[/code]
Impala查询报错
[test:21000] default&amp;gt; select * from tt_user where key like '1%' limit 1; Query: select * from tt_user where key like '1%' limit 1 Query submitted at: 2018-09-25 10:47:53 (Coordinator: http://test:...
impala SQL插入报错
impala插入数据的时候,出现报错: [hs-170:21000] &amp;amp;gt; insert into test_abc(fund_account, client_name, client_sex) values('1234567890123456789001', 'name1', '0'); Query: insert into test_abc(fund_account, client_nam...
运行时报错“capability not supported”?
我写了如下语句,运行时报错“capability not supported”,请指教。rnwith datamodule1.table1 dornbeginrndelete;rndatamodule1.database1.startTransaction;rntryrnApplyUpdates;rndatamodule1.database1.commit ;rnexceptrndatamodule1.database1.rollback;//用step over检查,就在此行显示蓝条rnraise;rnend;rncommitupdates;rnend;
关于JDBC连接MSSQL2000 的报错
朋友做了个JSP项目其中有连接MSSql2000的 可是每次连接DAO类的报错都是rn[color=#FF0000][Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序[/color]rn这是为什么了?我根本没有用到ODBC啊rn 其他地方我看了代码也没有错 就是连接不上 JAR包也全打上了SQL2000的SP3补丁也打上了 端口也没有问题 rn 望高手帮忙解惑,连接05和Mysql都么有遇到这个事情 奇怪了。
jdbc连接sql server2008报错
[code=Java]rnimport java.sql.*;rnrnpublic class JdbcSqlServer rnrn public static void main(String[] args) throws Exception rn Connection con = null;rn Statement stmt = null;rn ResultSet rs = null;rn String connectionURL = "jdbc:sqlserver://127.0.0.1:1433;DatabaseName=TEST_DB_RENAME"; //为数据库的地址rn rn Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //加载驱动rn rn con = DriverManager.getConnection(connectionURL,"pengliang","1989923"); //建立与数据库的连接rn rnrn stmt = con.createStatement();rn rn rn rs = stmt.executeQuery("select * from student"); //ResultSet对象来存储查询的结果rn rn rn while(rs.next()) rn System.out.println("***********************"rn +"\n"+"sno:"+"\t"+rs.getString("sno")+"\t"+"sname:"+" \t"+rs.getString("sname")+"\t"+"sgrade:"+"\t"+rs.getString("sgrade")rn );rn rn rn con.close();rn rn rnrnrnrn[/code]rn显示的错误信息为rn[color=#FF0000]Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class filern at java.lang.ClassLoader.defineClass1(Native Method)rn at java.lang.ClassLoader.defineClass(Unknown Source)rn at java.security.SecureClassLoader.defineClass(Unknown Source)rn at java.net.URLClassLoader.defineClass(Unknown Source)rn at java.net.URLClassLoader.access$100(Unknown Source)rn 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 JdbcSqlServer.main(JdbcSqlServer.java:11)[/color]rn
JDBC连接SQL server报错
弄了几天,也没找出原因。报错如下: rn[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]无法打开登录 'spring-hibernate' 中请求的数据库。登录失败。 rnhibernate配置文件: rn rn sa rn rnjdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=spring-hibernate rn rn rnorg.hibernate.dialect.SQLServerDialect rn rn rncom.microsoft.jdbc.sqlserver.SQLServerDriver rn rn sa rn rncom.microsoft.jdbc.sqlserver.SQLServerDriver rn rn rn rnrn rnrnUser配置文件: rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnLog配置文件: rnrn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rnrn创建表的方法: rnpublic static void main(String[] args) rnrnConfiguration cfg = new Configuration().configure(); rnrnSchemaExport export = new SchemaExport(cfg); rnrnexport.create(true, true); rn rnrn使用自定义连接数据库方法可以访问数据库。不知道问题出在哪?哪位大哥知道麻烦说下。 rn下面方法可以访问数据库: rnpublic class DatabaseConn rnrnprivate Connection conn; rnprivate static Statement stmt; rnprivate String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=spring_hibernate"; rnprivate String classforname = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; rnprivate String uid = "sa"; rnprivate String pwd = "sa"; rnrnpublic DatabaseConn() rn rnpublic Connection getConnection() rntry rnClass.forName(classforname); rnif (conn == null ¦ ¦ conn.isClosed()) rnconn = DriverManager.getConnection(url, uid, pwd); rn catch (ClassNotFoundException ex) rnex.printStackTrace(); rn catch (SQLException ex) rnex.printStackTrace(); rn rnreturn conn; rn rnrnpublic static void main(String[] args) throws SQLException rnrnDatabaseConn conn = new DatabaseConn(); rnConnection con = conn.getConnection(); rnstmt = con.createStatement(); rnResultSet rs = stmt.executeQuery("select * from test"); rnif(rs.next()) rnwhile (rs.next()) rnSystem.out.println(rs.getString(1)); rnSystem.out.println(rs.getString(2)); rn rnelse rnSystem.out.println("无法获取数据"); rn rn rn
JDBC连接MYSQL老是报错
package com.shake.database.dao;rnimport java.sql.DriverManager;rnimport java.sql.SQLException;rnimport java.sql.Connection;rnpublic class DataSource rnrn private static String driver = "com.mysql.jdbc.Driver";rn private static String url = "jdbc:mysql://localhost:3306/shake";rn private static String userName = "root";rn private static String passWord = "123456"; //密码rn /**rn * 获得数据库连接rn */rn //这里获取数据库的链接rn public static Connection getConnection()rn //加载驱动rn tryrn Class.forName(driver);rn //打开并返回数据库连接rn Connection connection = DriverManager.getConnection(url,userName,passWord);rn return connection;rn catch(ClassNotFoundException e)rn rn e.printStackTrace();rn catch(SQLException e)rn rn e.printStackTrace();rn rnrn return null;rn rnrnrnrnrn这是报错rn[color=#FF0000]java.sql.SQLExceptionrn at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:254)rn at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)rn at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:699)rn at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:631)rn at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:485)rn at org.apache.tomcat.jdbc.pool.ConnectionPool.(ConnectionPool.java:143)rn at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)rn at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)rn at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127)rn at com.shake.database.dao.UserDao.queryUserList(UserDao.java:23)rn at com.shake.servlet.UserServlet.userIsExist(UserServlet.java:56)rn at com.shake.servlet.UserServlet.doPost(UserServlet.java:42)rn at com.shake.servlet.UserServlet.doGet(UserServlet.java:31)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)rn at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:931)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)rn at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)rn at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)rn at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)rn at java.lang.Thread.run(Unknown Source)rnCaused by: java.lang.NullPointerExceptionrn at java.lang.Class.forName0(Native Method)rn at java.lang.Class.forName(Unknown Source)rn at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:246)rn ... 30 morern[/color]rnrnrn求帮助
通过jdbc连接SQLServer2000报错
package jspstudy.test;rnimport com.microsoft.jdbc.sqlserver.SQLServerDriver;rnimport java.sql.*;rnimport java.util.*;rnrnrnpublic class JDBCTestrnrn private java.sql.Connection con;rnrnrn public JDBCTest() throws ClassNotFoundException rn Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");rnrn String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=lxw";rnrn String user="sa";rnrn String password="sa";rnrnrn tryrn rn con = java.sql.DriverManager.getConnection(url, user, password);rn rn catch (SQLException ex)rn rn ex.printStackTrace();rn rnrnrnrn rnrn public void addMessage() throws Exceptionrn rn java.sql.PreparedStatement stm = con.prepareStatement("insert into jdbcTest values(?,?)");rn stm.setString(1,"lxw");rn stm.setDate(2,new java.sql.Date(new java.util.Date().getTime()));rn con.close();rnrn rn public static void main(String arg[]) throws Exception rn try rn JDBCTest jd = new JDBCTest();rn jd.addMessage();rn rn catch (ClassNotFoundException ex)rn rn ex.printStackTrace();rn rnrnrnrn rnrnrn报错信息如下rnjava.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.rn at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)rn at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)rn at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)rn at com.microsoft.jdbc.sqlserver.tds.TDSConnection.(Unknown Source)rn at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)rn at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)rn at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)rn at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)rn at java.sql.DriverManager.getConnection(DriverManager.java:512)rn at java.sql.DriverManager.getConnection(DriverManager.java:171)rn at jspstudy.test.JDBCTest.(JDBCTest.java:24)rn at jspstudy.test.JDBCTest.main(JDBCTest.java:45)rnjava.lang.NullPointerExceptionrn at jspstudy.test.JDBCTest.addMessage(JDBCTest.java:37)rn at jspstudy.test.JDBCTest.main(JDBCTest.java:46)rnException in thread "main" rnrn 菜鸟请求大家帮忙!
相关热词 c#部署端口监听项目、 c#接口中的属性使用方法 c# 昨天 c#func链接匿名方法 c#怎么创建文件夹 c#从键盘接收空格 c#da/ad c#部门请假管理系统 c#服务器socket c# 默认的访问修饰符