当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

 ·实现条目的上下滚动()    »显示摘要«
    摘要: 在一个固定高度的区域内,只显示5条记录。 如果有多余的,在区域的下方显示一标志(如图片),当鼠标放在标志上时,实现条目的下滚动 同时在顶部出现向上的标志。可以向上滚动。 求原码,马上可用,马上给分! ......
 ·关于helloworld的web service问题    »显示摘要«
    摘要: 我仿照以下文章试着做一个helloworld的web service,结果在操作的过程中出错了。。 网址:http://www-900.ibm.com/developerworks/cn/webservices/ws-startaxis/index.shtml 当我按照它上面说的进行到: c:\>java -djava.ext.dirs=lib org.apache.axis.wsd......


求教 Application和数据库连接的资料

这方面的技术俺不懂,请教各位帮忙了

NO.1   作者: hydric

用jdbc连,资料很多的

NO.2   作者: totodo

一样的。faq   里看一下就知道了。

NO.3   作者: Keepers

Connecting   to   an   Oracle   Database  
  This   example   uses   an   Oracle   JDBC   driver   to   connect   to   an   Oracle   database   instance   located   at   128.0.0.0:1521   with   an   sid   called   mydatabase.    
          Connection   connection   =   null;  
          try   {  
                  //   Load   the   JDBC   driver  
                  String   driverName   =   "oracle.jdbc.driver.OracleDriver";  
                  Class.forName(driverName);  
           
                  //   Create   a   connection   to   the   database  
                  String   serverName   =   "127.0.0.1";  
                  String   portNumber   =   "1521";  
                  String   sid   =   "mydatabase";  
                  String   url   =   "jdbc:oracle:thin:@"   +   serverName   +   ":"   +   portNumber   +   ":"   +   sid;  
                  String   username   =   "username";  
                  String   password   =   "password";  
                  connection   =   DriverManager.getConnection(url,   username,   password);  
          }   catch   (ClassNotFoundException   e)   {  
                  //   Could   not   find   the   database   driver  
          }   catch   (SQLException   e)   {  
                  //   Could   not   connect   to   the   database  
          }  
   
   
   
  Connecting   to   a   MySQL   Database  
  This   example   connects   to   a   MySQL   database   using   the   MM   JDBC   driver   for   MySQL.   You   need   to   have   an   account   in   MySQL   database   to   run   this   example.   To   create   an   account,   you   can   connect   to   MySQL   database   on   your   platform   as   root,   and   run   the   following   command:    
          mysql>   GRANT   ALL   PRIVILEGES   ON   *.*   TO   username@localhost  
          IDENTIFIED   BY   password   WITH   GRANT   OPTION;  
           
   
          Connection   connection   =   null;  
          try   {  
                  //   Load   the   JDBC   driver  
                  String   driverName   =   "org.gjt.mm.mysql.Driver";   //   MySQL   MM   JDBC   driver  
                  Class.forName(driverName);  
           
                  //   Create   a   connection   to   the   database  
                  String   serverName   =   "localhost";  
                  String   mydatabase   =   "mydatabase";  
                  String   url   =   "jdbc:mysql://"   +   serverName   +     "/"   +   mydatabase;   //   a   JDBC   url  
                  String   username   =   "username";  
                  String   password   =   "password";  
                  connection   =   DriverManager.getConnection(url,   username,   password);  
          }   catch   (ClassNotFoundException   e)   {  
                  //   Could   not   find   the   database   driver  
          }   catch   (SQLException   e)   {  
                  //   Could   not   connect   to   the   database  
          }  
   
  Connecting   to   a   SQLServer   Database  
  This   example   connects   to   a   SQLServer   database   using   the   NetDirect   JDBC   driver.   For   information   about   this   driver,   see   e232   Getting   JDBC   Drivers   for   a   Database.    
          Connection   connection   =   null;  
          try   {  
                  String   driverName   =   "com.jnetdirect.jsql.JSQLDriver";   //   NetDirect   JDBC   driver  
                  String   serverName   =   "127.0.0.1";  
                  String   portNumber   =   "1433";  
                  String   mydatabase   =   serverName   +   ":"   +   portNumber;  
                  String   url   =   "jdbc:JSQLConnect://"   +   mydatabase;   //   a   JDBC   url  
                  String   username   =   "username";  
                  String   password   =   "password";  
           
                  //   Load   the   JDBC   driver  
                  Class.forName(driverName);  
           
                  //   Create   a   connection   to   the   database  
                  connection   =   DriverManager.getConnection(url,   username,   password);  
          }   catch   (ClassNotFoundException   e)   {  
                  //   Could   not   find   the   database   driver  
          }   catch   (SQLException   e)   {  
                  //   Could   not   connect   to   the   database  
          }  
   
   
   
 

NO.4   作者: Keepers

如果不在jb中,那么就直接放在你的java-home/jre/lib/ext/目录中就可以了  
  如果在jb中,那么加到项目中引用就可以了  
  我上边的帖子中有三种连接mysql\oracle\sqlserver,你一定没有仔细看。  
  我把sql放在下边。  
  Connecting   to   a   SQLServer   Database  
  This   example   connects   to   a   SQLServer   database   using   the   NetDirect   JDBC   driver.   For   information   about   this   driver,   see   e232   Getting   JDBC   Drivers   for   a   Database.    
          Connection   connection   =   null;  
          try   {  
                  String   driverName   =   "com.jnetdirect.jsql.JSQLDriver";   //   NetDirect   JDBC   driver  
                  String   serverName   =   "127.0.0.1";  
                  String   portNumber   =   "1433";  
                  String   mydatabase   =   serverName   +   ":"   +   portNumber;  
                  String   url   =   "jdbc:JSQLConnect://"   +   mydatabase;   //   a   JDBC   url  
                  String   username   =   "username";  
                  String   password   =   "password";  
           
                  //   Load   the   JDBC   driver  
                  Class.forName(driverName);  
           
                  //   Create   a   connection   to   the   database  
                  connection   =   DriverManager.getConnection(url,   username,   password);  
          }   catch   (ClassNotFoundException   e)   {  
                  //   Could   not   find   the   database   driver  
          }   catch   (SQLException   e)   {  
                  //   Could   not   connect   to   the   database  
          }  
 

NO.5   作者: csdnzl

一般的都行啦


 ·stl问题当场结帐    »显示摘要«
    摘要: 我用using namespace std; 结果编译时提示错误: error c2871: std : does not exist or is not a namespace ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE