Oracle数据库连接失败,求怎么解决???报错如下,谢谢

状态: 失败 -测试失败: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

4个回答

有没更详细的信息?可以参考这里:http://www.jb51.net/article/73178.htm

tanpf123
tanpf123 回复mzx15069787571: 尝试按照这里修改试试:http://blog.csdn.net/u013479571/article/details/48004509
大约 2 年之前 回复
mzx15069787571
mzx15069787571 截图如下
大约 2 年之前 回复

图片说明

tnsnames.ora这个 文件 你需要配置一下,当年我也因为这个连不上oracle。
http://www.linuxidc.com/Linux/2014-01/94787.htm参考

看看是不是SID错了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Oracle数据库连接失败……
[color=#FF0000]java.sql.SQLException: Listener refused the connection with the following error:rnORA-12505, TNS:listener does not currently know of SID given in connect descriptorrnThe Connection descriptor used by the client was:rn127.0.0.1:1521:orcljava[/color]rn出错的代码是下面这行:rnDriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcljava","lisi", "lisi") ;rn我的oracle SID是orcljavarnrn谢谢……
Javaweb项目运行报错,报错如下!求解决!!!
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for...
MyEclipse连接Oracle数据库时报错 求解决
[img=https://img-bbs.csdn.net/upload/201604/24/1461429071_579957.jpg][/img]rnPLSQL Developer 连接数据库可以 SID IP 端口号都没问题 数据库的相关服务也启动了 但是myEclipse就是连不上Oracle数据库
tomcat链接oracle数据库报错 求大神解决
java.sql.SQLException: not support oracle driver 1.0rn at com.alibaba.druid.pool.DruidDataSource.initCheck(DruidDataSource.java:568)rn at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:390)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)rn at org.springframework.aop.support.AbstractBeanFactoryPointcutAdvisor.getAdvice(AbstractBeanFactoryPointcutAdvisor.java:80)rn at org.springframework.aop.aspectj.AspectJProxyUtils.isAspectJAdvice(AspectJProxyUtils.java:67)rn at org.springframework.aop.aspectj.AspectJProxyUtils.makeAdvisorChainAspectJCapableIfNecessary(AspectJProxyUtils.java:49)rn at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.extendAdvisors(AspectJAwareAdvisorAutoProxyCreator.java:101)rn at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:88)rn at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68)rn at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359)rn at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1426)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)rn at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:272)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:196)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)rn at org.apache.catalina.core.StandardService.start(StandardService.java:516)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:578)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rnrn
怎么连接失败,求解释
[code=C/C++]rn#include rn#pragma comment(lib,"ws2_32.lib")rn#include rn#include rnrn#include rnusing namespace std;rnrnrnint _tmain(int argc, _TCHAR* argv[])rnrn /*定义socket数据变量*/rn WSADATA wsd;rn SOCKET sHost; // 与服务器通信的socketrn SOCKADDR_IN serAddr; //服务器地址rn char buf[BUF_SIZE];rn int retVal;rnrn if(WSAStartup(MAKEWORD(2,2),&wsd) != 0)rn rn printf("初始化失败!\n");rn return -1;rn rnrn //创建Socketrn sHost=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);rn if(sHost == INVALID_SOCKET)rn rn printf("Socket failed!\n");rn WSACleanup();rn return -1;rn rnrn //设置服务器地址;rn serAddr.sin_family=AF_INET;rn serAddr.sin_addr.S_un.S_addr=inet_addr("192.168.5.205");rn serAddr.sin_port=htons(9990);//设置通信端口;rnrn //连接到服务器rn retVal=connect(sHost,(const sockaddr*)&serAddr,sizeof(serAddr));rn if(retVal == SOCKET_ERROR)rn rn printf("Connect failed\n");rn closesocket(sHost);rn return -1;rn rnrn //发送消息rn while(true)rn rn printf("Please input a string to send: ");rn string str;rn getline(cin,str);rn ZeroMemory(buf,BUF_SIZE);//清空缓冲队列;rn strcpy(buf,str.c_str());rn retVal=send(sHost,buf,strlen(buf),0);rnrn if(retVal == SOCKET_ERROR)rn rn printf("send faild\n");rn closesocket(sHost);rn WSACleanup();rn break;rn rn retVal=recv(sHost,buf,strlen(buf),0);rnrn printf("Recv from Server: %s\n",buf);rnrn if(strcmp(buf,"quit") == 0)rn rn printf("quit!\n");rn break;rn rnrnrn rn closesocket(sHost);rn WSACleanup();rn rn return 0;rnrnrn//刚学习网络编程,前辈们帮我指点一下,为什么会连接失败呢rn[/code]
记一次解决Oracle数据库连接失败
问题背景:使用PL/SQL Developer连接本地虚拟机(RedHat6.7)中的Oracle服务,报错如下:ERROR: ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux-x86_64 Error: 2: No such file or directory Additional
如下代码怎么报错?
如下是原始代码rn[code=c]rnrn //for (auto* e = m_vecItemList.begin();e != m_vecItemList.end(); e++)rn for (auto* e : m_vecItemList) rn rn if (e != NULL) rn delete e; rn rn rn[/code]rnrn报错内容如下rn1>MyColorCombox.cpp(54): error C2143: 语法错误 : 缺少“,”(在“:”的前面)rn1>MyColorCombox.cpp(54): error C3531: “e”: 类型包含“auto”的符号必须具有初始值设定项rn1>MyColorCombox.cpp(55): error C2143: 语法错误 : 缺少“;”(在“”的前面)rn1>MyColorCombox.cpp(57): error C2541: “delete”: 不能删除不是指针的对象rn1>MyColorCombox.cpp(60): fatal error C1903: 无法从以前的错误中恢复;正在停止编译rnrn我使用的工具是,VS2010。rnm_vecItemList是 vector m_vecItemList;rn"//"引用的是我百度的,一种方式,也不行。。rnrn请问这个该怎么改?
oracle数据库远程连接失败
客户端显示ora-28547.rn服务端日志显示tns-12535.rn之前是可以连接的。由于数据库、服务器做了一些加固措施,导致现在连接不上了。rn[img=https://img-bbs.csdn.net/upload/201806/12/1528790819_923444.png][/img][img=https://img-bbs.csdn.net/upload/201806/12/1528790846_202387.png][/img]
遇到如下问题,怎么解决。谢谢!
用java连接的oracle库,执行一段时间:大约两个半小时后,就报这个错误。猜想是连接时间过长,数据库连接断开。请问,如果处理这样的情况。具体是怎么回事?rn谢谢!rnrnjava.sql.SQLException: Listener refused the connection with the following error:rnrnORA-12519, TNS:no appropriate service handler foundrnThe Connection descriptor used by the client was:rn192.168.1.7:1521:orclrnrn at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.javarn:111)rn at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.javarn:260)rn at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:386)rn at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:rn440)rn at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:164)rn at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensiornn.java:34)rn at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)rn at java.sql.DriverManager.getConnection(DriverManager.java:579)rn at java.sql.DriverManager.getConnection(DriverManager.java:221)rn at com.base.OracleDb.Link(OracleDb.java:27)rn at com.opration.CalculateEx.Cal(CalculateEx.java:95)rn at com.opration.RunCal.RunCalDot(RunCal.java:48)rn at RunEx.main(RunEx.java:25)
数据库连接错误,提示如下,怎么解决?谢谢!
Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user: 'root@tomwang' (Using password: NO) in D:\KnowledgeTree\phplib\db_mysql.inc on line 73rnDatabase error: pconnect(172.16.10.152, root, $Password) failed.rnSQL Error: ()rnSession halted.
求大神解决,sybase 报错 怎么解决
求大神解决,已经两天了 没有弄出来
求解决如下查询语句
以知道表 "caiwu" 列 "使用时间"存储的格式为2006-7-23 6:39:53rn我想以下效果查询 2006-7-23 - 2006-10-23之间的数据
hibernate报错!求解决,谢谢大家
我做的一个DEMO(struts2+hibernate3),程序运行点提交后,报错rnjavax.servlet.ServletException: org.hibernate.HibernateException: createQuery is not valid without active transactionrnrn请问这是怎么回事?
如下错误怎么解决?
ompiling...rn2.cpprnE:\VC6.0_Pro\p2\2.cpp(35) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class String' (or there is no acceptable conversion)rnE:\VC6.0_Pro\p2\2.cpp(35) : fatal error C1903: unable to recover from previous error(s); stopping compilationrnError executing cl.exe.rnrnp2.exe - 2 error(s), 0 warning(s)rnrn请高手指点 谢谢 ;rn程序代码如下;rnrnrn#include rnusing namespace std;rn/*rnclass String;rnistream & operator >> (istream & String&)rnostream & operator << (ostream & const String &);rn*/rnclass Stringrnrnpublic:rn String();rn String(const char *);rn String(const String &);rnrn ~String();rnrn String & operator = (const String &);rn String & operator = (const char *);rn bool operator == (const String &);rn bool operator == (const char*);rn char & operator [] (int);rnrn int size() return _size;rn char * c_str() return _string ;rnprivate :rn int _size;rn char * _string;rn;rnrnvoid main()rnrn int aCnt = 0,eCnt = 0, iCnt = 0, oCnt = 0, uCnt = 0,rn theCnt = 0,itCnt = 0,wdCnt = 0,notVowel = 0;rn String buf,the("the"),it("it");rn while(cin>>buf)rn rn ++wdCnt;rn cout<
如下错误怎么解决
在view创建了几个窗口,其中一个窗口显示执行代码的内容,想在这个窗口中响应鼠标左键单击事件,得到相应窗口中相应代码所在的行号,供进一步使用。窗口中定义了一个CRichEditCtrl对象,它有自己的窗口过程函数,在此窗口函数中将左键单击事件发送到view中,在view处理相应的事件,做出相应的处理,程序在执行过程中有如下错误提示,这是怎么回事rnrndebug errorrnDAMAGE:after normal block(#358) at 0x00b63fd0rnrn附CRichEditCtrl窗口事件,及view对窗口中响应鼠标左键单击事件的处理,代码可以执行到view中对鼠标左键单击事件,并给出line结果,但会出现如上错误rnrnstatic LRESULT CALLBACK ConsoleRichEditProc(HWND hwnd, UINT uMsg,rn WPARAM wParam, LPARAM lParam)rnrn switch (uMsg)rn rn case WM_LBUTTONDOWN:rn ::PostMessage(GetParent(GetParent(hwnd)), WM_LBUTTONDOWN, wParam, lParam);rn .....rn rnrnrnrnvoid CRDViewView::OnLButtonDown(UINT nFlags, CPoint point) rnrn // TODO: Add your message handler code here and/or call defaultrn rn CView::OnLButtonDown(nFlags, point);rn if(b_wndText)rn rn CPoint pt(point); //Get current mouse coordinatesrn ClientToScreen(&pt); //Convert to screen coordinatesrnrn CRichEditCtrl& reTextSeg = m_wndTextSeg.GetRichEdit();rn rn // Get the dimensions of the richeditctrlrn CRect rectRichEdit;rn reTextSeg.GetWindowRect(&rectRichEdit);rn rn // Calculate the offset of the mouse into the richeditctrlrn CPoint Npt(pt.x-rectRichEdit.left, pt.y-rectRichEdit.top); //new point rnrn CString strText;rn LRESULT lRet = reTextSeg.SendMessage(EM_CHARFROMPOS, 0, (LPARAM)&Npt); rn int line = reTextSeg.LineFromChar(LOWORD(lRet)); //get the line where cursor locatedrnrn m_nLine = line; //store the cursor positionrnrnrn rn
如下怎么解决
一个表如下rnZBXH BHFL DWDM DWMC YGCL SGDWDM YEAR_Mrn---------------- ---------- ------ ---------------- ---------- ------ ------rn20030630B 109776 000001 信息部 50000 000001 200306rn20030630A 240 000001 信息部 50000 000001 200306rn20030630A 32 000001 信息部 50000 000001 200306rn20030630C 109776 000002 合同部 20000 000002 200306rn20030630A 240 000002 合同部 20000 000002 200306rn20030630B 109776 000002 合同部 20000 000002 200306rnrnrn我想剔除掉 dwdm,year_m 相同的数据rn就是最后只剩下rn----------------------------------------------------------------------rn20030630B 109776 000001 信息部 50000 000001 200306rn20030630C 109776 000002 合同部 20000 000002 200306
oracle数据库掉电怎么解决???
安装了oracle数据库的服务器突然停电了,再启动服务器连接oracle的时候提示ORACLE initialization or shutdown in progress,该如何解决???
报错:连接失败 -2147467259
Error: -2147467259 rnLine Number; 696rnDescription : 连接失败rnSource: Microsoft OLE DB Provider for SQL Serverrnmodule: modMain.EODLog rnrnrn之后提失我们软件中其中一个表有问题 ,进了后台发现有问题的表 无法访问 rnrn有什么解决的方法吗?
oracle数据库慢怎么解决?
总共分配了1G内存。rn发现数据缓存命中率只有75%rn查询一个m表很慢。m表大小有88兆,有50万个记录,大约40个字段。我应该怎么优化呢?或者怎么检测?rn
phpmyadmin报错如下,不知如何解决,谢谢大家
懂PHP的帮帮忙rnphpmyadmin报错如下rnPHP Warning: realpath() [function.realpath]: Unable to access F:\wwwphp\phpmyadmin in F:\wwwphp\phpmyadmin\libraries\Error.class.php on line 401rn这个是怎么回事呢?
python检查Oracle数据库是否连接失败
python检查Oracle数据库是否连接失败,如果失败发送给指定邮箱
android 报错,求解决
07-06 18:46:11.046: E/AndroidRuntime(624): FATAL EXCEPTION: mainrn07-06 18:46:11.046: E/AndroidRuntime(624): java.lang.RuntimeException: Unable to pause activity com.bookread/com.bookread.ItemActivity: java.lang.NullPointerExceptionrn07-06 18:46:11.046: E/AndroidRuntime(624): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3348)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3305)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3786)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.app.ActivityThread.access$2400(ActivityThread.java:125)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2037)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.os.Handler.dispatchMessage(Handler.java:99)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.os.Looper.loop(Looper.java:123)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.app.ActivityThread.main(ActivityThread.java:4627)rn07-06 18:46:11.046: E/AndroidRuntime(624): at java.lang.reflect.Method.invokeNative(Native Method)rn07-06 18:46:11.046: E/AndroidRuntime(624): at java.lang.reflect.Method.invoke(Method.java:521)rn07-06 18:46:11.046: E/AndroidRuntime(624): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)rn07-06 18:46:11.046: E/AndroidRuntime(624): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)rn07-06 18:46:11.046: E/AndroidRuntime(624): at dalvik.system.NativeStart.main(Native Method)rn07-06 18:46:11.046: E/AndroidRuntime(624): Caused by: java.lang.NullPointerExceptionrn07-06 18:46:11.046: E/AndroidRuntime(624): at android.support.v4.view.ViewPager.onSaveInstanceState(ViewPager.java:507)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.view.View.dispatchSaveInstanceState(View.java:6068)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:1180)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:1184)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:1184)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:1184)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.view.View.saveHierarchyState(View.java:6051)rn07-06 18:46:11.046: E/AndroidRuntime(624): at com.android.internal.policy.impl.PhoneWindow.saveHierarchyState(PhoneWindow.java:1430)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.app.Activity.onSaveInstanceState(Activity.java:1086)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.app.Activity.performSaveInstanceState(Activity.java:1036)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1180)rn07-06 18:46:11.046: E/AndroidRuntime(624): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3330)rn07-06 18:46:11.046: E/AndroidRuntime(624): ... 12 more
was6.1报错求解决。。。
java.lang.NoClassDefFoundError: com.sun.org.apache.xpath.internal.XPathAPIrn at com.yzj.cfg.rolemanage.RoleManageServlet.getCompInfo(RoleManageServlet.java:648)rn at com.yzj.cfg.rolemanage.RoleManageServlet.doPost(RoleManageServlet.java:116)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)rn at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1075)rn at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1016)rn at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:118)rn at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)rn at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:771)rn at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:679)rn at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:546)rn at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)rn at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)rn at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)rn at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1455)rn at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:115)rn at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)rn at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)rn at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)rn at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)rn at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)rn at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)rn at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)rn at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)rn at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)rn at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)rn at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)rn at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)rn at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)rn
报错ing,求解决
public class x rn public static void main(String[] args) rn private int x = 100;rn rnrn这个代码的第三行报错了,为虾米
dev-c++ 报错..,求解决
问题如下...rnrn[code=C/C++]编译器: Default compilerrnBuilding Makefile: "D:\Users\fk\Desktop\test\Makefile.win"rn执行 make cleanrnrm -f 未命名1.o 工程1.exernrngcc.exe -c 未命名1.c -o 未命名1.o -I"C:/Dev-Cpp/include" rnrngcc.exe: installation problem, cannot exec `cc1': No such file or directoryrnrnmake.exe: *** [未命名1.o] Error 1rnrn执行结束rn[/code]
snmpwalk 报错。求解决
#snmpwalk -c public -v 2c localhostnNo log handling enabled - turning on stderr loggingngetaddrinfo: localhost Temporary failure in name resolutionnsnmpwalk: Unknown host (localhost) (Resource temporarily unavailable)n
在IE6下报错,求解决!!!
[url=http://115.com/file/e6pvcb2t][/url]rn打开页面时有一错误,点击按钮式页面挂了,不动。rn如果把点击事件的第二行代码注视掉就能运行。不知道是IE6不兼容还是怎么的。着急呀。
JBOSS4.2.2-GA报错,求解决
我用的版本是4.2.2-GA,jboss部署在linux服务器上,但是运行的时候JBOSS老是会抛出这个错误,实在不知道怎么解决。。求高手指点。rnrn21:40:10,404 ERROR [[HtmlAdaptor]] Servlet.service() for servlet HtmlAdaptor threw exceptionrnjavax.servlet.ServletException: Original SevletResponse or wrapped original ServletResponse not passed to RequestDispatcher in violation of SRV.8.2 and SRV.14.2.5.1rn at org.apache.catalina.core.ApplicationDispatcher.checkSameObjects(ApplicationDispatcher.java:985)rn at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:316)rn at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)rn at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOpByName(HtmlAdaptorServlet.java:290)rn at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:102)rn at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doGet(HtmlAdaptorServlet.java:77)rn at javax.servlet.http.HttpServlet.doHead(HttpServlet.java:271)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)rn at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)rn at java.lang.Thread.run(Thread.java:662)rn21:40:12,494 ERROR [[jsp]] Servlet.service() for servlet jsp threw exceptionrnjava.lang.ClassNotFoundException: org.apache.jsp.zecmd_jsprn at java.net.URLClassLoader$1.run(URLClassLoader.java:202)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(URLClassLoader.java:190)rn at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)rn at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)rn at org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:598)rn at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:143)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)rn at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)rn at java.lang.Thread.run(Thread.java:662)
404报错。。。求解决。。。
index.jsp已经放在webroot文件夹下了。。附上我的index.jsp的代码...和web.xml代码。。。不知道为什么一直报404错误。。。郁闷的很啊。。。rnrnconsolo的报错信息是:严重: Parse error in application web.xml file at jndi:/localhost/waimaiwang/WEB-INF/web.xmlrnrn[color=#FF0000]index.jsp:[/color]rn<%@page contentType="text/html;charset=gb2312" %>rn<%@taglib prefix="s" uri="/struts-tags" %>rnrnrnrn rn rn My JSP 'index.jsp' starting pagernrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrn[color=#FF0000]rnweb.xml:[/color]rnrnrnrnrnrn struts2rn org.apache.struts2.dispatcher.FilterDispatcherrnrnrn struts2rn /*rnrnrn org.springframework.web.context.ContextLoaderListenerrnrn rn struts2rn rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilterrn rn rn rn struts2rn /*rn
jsp页面报错,求解决
exception rnrnorg.apache.jasper.JasperException: An exception occurred processing JSP page /startExam.jsp at line 177rnrn174: [ $ind+1 ]rn175: rn176: rn177: rn178: rn179: rn180: rnrnrn
datatables 报错 求解决
[img=https://img-bbs.csdn.net/upload/201703/06/1488782896_18669.png][/img]rn报错之后数据可以显示,这是为什么啊
报错求解决....
[img=http://img.my.csdn.net/uploads/201211/21/1353490985_9921.png][/img]rnrnrnrnrn
报错求解决
[code=C/C++]rnrn#include "stdafx.h" rn#include "stdio.h" rn#include "winsock2.h" rn#pragma comment(lib,"ws2_32.lib")rnint main(int argc, char* argv[]) rn rn SOCKADDR_IN saServer; rn LPHOSTENT lphostent; rn WSADATA wsadata; rn SOCKET hsocket; rn rn int nRet; rn char* host_name="www.******.com"; rn char* req=rn "POST /blog/comment.asp?act=save&logid=3560 HTTP/1.0/r/n" rn "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/QVOD, application/QVOD, */*/r/n" rn "Referer: http://www.******.com/blog/article.asp?id=3560/r/n" rn "Accept-Language: zh-cn/r/n" rn "Content-Type: application/x-www-form-urlencoded/r/n" rn "Accept-Encoding: gzip, deflate/r/n" rn "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; POTU(RR:28031409:0:5497353); SV1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; CIBA)/r/n" rn "Host: www.******.com/r/n" rn "Content-Length: 114/r/n" rn "Connection: Keep-Alive/r/n" rn "Cookie: babyhashkey=; babyuserid=; ASPSESSIONIDACBRSQBC=AFHPMPGBBCGPDDDNEDKGJHEJ/r/n/r/n" rn "e_ubb=true&e_autourl=true&e_smilies=true&comm_username=%E5%A4%A9%E4%BD%BF&comm_password=&message=www.******.net.cn"; rn rn // 初始化套接字 rn if(WSAStartup(MAKEWORD(2,2),&wsadata)) rn printf("初始化SOCKET出错!"); rn rn lphostent=gethostbyname(host_name); rn if(lphostent==NULL) rn printf("lphostent为空!"); rn hsocket = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); rn saServer.sin_family = AF_INET; rn saServer.sin_port = htons(80); rn saServer.sin_addr = *((LPIN_ADDR)*lphostent->h_addr_list); rn rn // 利用SOCKET连接 rn nRet = connect(hsocket,(LPSOCKADDR)&saServer,sizeof(SOCKADDR_IN)); rn if(nRet == SOCKET_ERROR) rn rn printf("建立连接时出错!"); rn closesocket(hsocket); rn return 0; rn rn rn // 利用SOCKET发送 rn nRet = send(hsocket,req,strlen(req),0); rn if(nRet==SOCKET_ERROR) rn rn printf("发送数据包时出错!"); rn closesocket(hsocket); rn rn char Dest[3000]; rn nRet=1;rn while(nRet>0) rn rn // 接收返回数据包 rn nRet=recv(hsocket,(LPSTR)Dest,sizeof(Dest),0); rn if(nRet>0) rn Dest[nRet]=0; rn else rn Dest[0]=0; rn rn // 显示返回数据包的大小、内容 rn printf("/nReceived bytes:%d/n",nRet); rn printf("Result:/n%s",Dest); rn rn return 0; rn rnrnrn[/code]
求问。eclipse运行时报错如下,如何解决
eclipse运行时报错sun/misc/BASE64Econder,就只有图片中的提示!有人遇到过这种问题吗?如何解决的,谢谢
在项目中mysql数据库访问不到,报错如下,求解决
我在配置文件里面配置好了,但是就是访问不到,先是配置文件的一部分:rn rn com.mysql.jdbc.Driverrn rn rn jdbc:mysql://localhost:3306/eap? autoReconnect=true&useUnicode=true&characterEncoding=gbkrn rn rn rootrn rn rn 111111rn rnrn会报如下错误:rnCannot create PoolableConnectionFactory (Server connection failure during transaction. Due to underlying exception: 'java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)'.rn
oracle数据库报错!
访问 PRODUCT_USER_PROFILE 时出现错误rn警告:未载入产品用户配置文件信息!rn您需要将 PUPBLD.SQL 作为 SYSTEM 运行rnrnrn这是我用一个新的用户登陆数据库,所以报错,应该怎么解决??谢谢!
mysql数据库连接失败!怎么回事?谢谢!
1、配置如下:rninclude filesrnC:\PROGRAM FILES\MYSQL\MYSQL SERVER 5.0\INCLUDErnlibrary filesrnC:\PROGRAM FILES\MYSQL\MYSQL SERVER 5.0\LIB\OPTrn2、在StdAfx.h头文件中加入下面的引用rn#include "mysql.h"rn#include "winsock.h"rn#pragma comment(lib, "ws2_32.lib")rn#pragma comment(lib,"libmySQL.lib")rn在编译libmySQL.dll,libmySQL.librn3、在mysql中建立zzshi,用户名root,密码123rn4、编译运行rn[code=c]BOOL CMySqlDemoDlg::OnInitDialog()rnrn CDialog::OnInitDialog();rn m_list.InsertColumn(0,"用户名",LVCFMT_CENTER,100);rn m_list.InsertColumn(1,"年龄",LVCFMT_CENTER,200);rn m_list.InsertColumn(2,"评论",LVCFMT_CENTER,100);rn m_list.InsertColumn(3,"成绩",LVCFMT_CENTER,100);rn m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT |LVS_EX_GRIDLINES);rnrn // TODO: Add extra initialization herern mysql_init (&mysql);rn mysql_options(&mysql,MYSQL_SET_CHARSET_NAME,"gbk"); //这一点是用来支持中文的rn if(!mysql_real_connect(&mysql,"localhost","root","123","zzshi",3306,NULL,0))rn rn AfxMessageBox("数据库连接失败"); rn return FALSE;rn rn rn RefreshList();rnreturn TRUE;rn[/code]rn运行结果显示:数据库连接失败!
重装系统后SQL数据源连接失败怎么解决
我重装系统后,ASP站点数据库Books用两种途径进行恢复:rn 先是建立空数据库后用原数据库的Books_data.mdf 和Books_data.ldf替换新数据库的这两个文件,但站点怎么也连不上了,提示错误是 global.asa文件找不到指定的数据库或拒绝访问;rn 于是我重新建立空数据库,并用原数据库的备份恢复它,这次还是global.asa文件提示错误:rnMicrosoft OLE DB Provider for ODBC Drivers 错误 '80004005' rn[Microsoft][ODBC 驱动程序 管理器] 未发现数据源名称并且未指定默认驱动程序rnrn 重装系统以前,数据库是用第二种方式建立的,而且站点一直正常工作。rn rn 程序中的连接语句如下:rn adoconn.Open "Driver = SQL Server;server=BEQUAN;database=Books;uid=sa;pwd=2718289;"rnrn 向各位请教以下问题:rn 1、这两种恢复数据库的方式有什么区别?rn 2、如何才能使站点正常运转?rn
如下makefile怎么写?谢谢
如下makefile怎么写?主要是怎样得到A.o,象这样:g++ -c A.cpp的话,错误:"undefined reference to "struct B";rn主要是B的go函数实现是在B.cpp的,怎样表达呢?象这样:g++ -c A.cpp B.cpp不行的。谢谢。rn******* A.h:rnclass B;rnclass Arnrnpublic:rn void test();rnrnprivate:rn B* m_pB;rn;rn******* A.cpp:rnvoid A::test()rnrn m_pB->go();rnrn******* B.h:rn#include "A.h"rnrnclass Brnrnpublic:rn void go();rn A a;rn;rnrn******* B.cpprnvoid B::go()rnrn
看如下报错的原因是什么?谢谢
代码如下:rn头文件:vector.hrn[code=C/C++]rn#ifndef VECTOR_Hrn#define VECTOR_Hrnrntemplate rnclass vectorrnrn public:rn explicit vector(int ini_size = 0);rn vector(const vector &rhs);rn ~vector();rn const vector & operator= (const vector &rhs);rn void size() const;rn void resize(int new_size);rn void reserve(int new_capacity);rn object & operator[](int index);rn const object & operator[](int index) const;rn void push_back(const object & x);rn enumSPARE_CACPCITY = 16;rnrn private:rn int the_size;rn int the_capacity;rn object *objects;rn;rnrn#endifrn[/code]rnrnvector.cpp文件rn[code=C/C++]rn#include "vector.h"rnvector::vector(int init_size):the_size(init_size),the_capacity(init_size + SPARE_CAPACITY)rn the_size = init_size;rn objects = new object[the_capacity];rnrnrnvector::vector(vector & rhs):objects(NULL)rn operator=(rhs);rnrnrn~vector::vector()rn delete [] objects;rnrnrnconst vector::vector & operator=(const vector & rhs)rn if(this != &rhs)rn delete [] objects;rn the_size = rhs.size();rn the_capactity = rhs.the_capacity;rnrn objects = object[the_capacity];rn for (int i = 0; i < the_size; i++)rn objects[i] = rhs[i];rn rn return *this;rn rnrnrnvoid size() constrn return the_size;rnrnrnvoid resize(int new_size)rn if(new_size > the_capacity)rn the_size = new_size * 2 + 1;rn reserve(the_size);rn rn the_size = new_size;rnrnrnvoid reserve(int new_capacity)rn if(new_capacity < the_capacity)rn return;rn rn object * old_objects = objects;rn objects = new object[new_capacity];rn for(int i=0; i < old_objects.size(); i++)rn objects[i] = old_objects[i];rn rn the_capacity = new_capacity;rn delete [] old_objects;rnrnrnobject & operator[](int index)rn return objects[index];rnrnrnvoid push_back(object & x)rn if(the_size == the_capacity)rn reserve(2 * the_capacity + 1);rn rn objects[the_size++] = x;rnrn[/code]rnrnmain.cpp文件rn[code=C/C++]rn#include "vector.h"rn#include rn#include rnrnusing namespace std;rnrnint main()rn string str("abc");rn vector vc;rn vc.push_back(str);rn cout << vc[0] << endl;rn return 0;rnrn[/code]rnrn三个文件在同一个目录rn使用下面的命令编译 g++ main.cpp -o mainrnrn报错信息如下:rn/tmp/cc93OlsO.o: In function `main':rnmain.cpp:(.text+0x66): undefined reference to `vector, std::allocator > >::vector(int)'rnmain.cpp:(.text+0x79): undefined reference to `vector, std::allocator > >::push_back(std::basic_string, std::allocator > const&)'rnmain.cpp:(.text+0x8a): undefined reference to `vector, std::allocator > >::operator[](int)'rnmain.cpp:(.text+0xb5): undefined reference to `vector, std::allocator > >::~vector()'rnmain.cpp:(.text+0xc8): undefined reference to `vector, std::allocator > >::~vector()'rncollect2: ld returned 1 exit statusrnrn请问rn1、报错是什么意思rn2.代码那里有问题导致报错?
相关热词 c++和c#哪个就业率高 c# 批量动态创建控件 c# 模块和程序集的区别 c# gmap 截图 c# 验证码图片生成类 c# 再次尝试 连接失败 c#开发编写规范 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数