java 连接oracle
Anerroroccurredatline:6inthejspfile:/wdkj/../pub/db_inc.jspdbConcannotberesolvedtoaty...
An error occurred at line: 6 in the jsp file: /wdkj/../pub/db_inc.jsp
dbCon cannot be resolved to a type
3: <%
4: /**************数据库连接**************/
5: String sIniFile ="public";
6: dbCon conn= connectManager.getInstance(sIniFile).getDbconnect(sIniFile);
7: dbHand db = new dbHand(conn.stmt);
8: /**************数据库连接**************/
9: tools pub = new tools (conn.getProp ()); //公用方法
JSP FileName:/wdkj/../pub/db_inc.jsp
Java FileName:/D:/erqijavaOOp/erqiJSPWeb/ZHONGYOA/apache-tomcat-5.5.25/work/Catalina/localhost/3gdisk//org/apache/jsp/wdkj\mySpace_jsp.java
An error occurred at line: 6 in the jsp file: /wdkj/../pub/db_inc.jsp
connectManager cannot be resolved
3: <%
4: /**************数据库连接**************/
5: String sIniFile ="public";
6: dbCon conn= connectManager.getInstance(sIniFile).getDbconnect(sIniFile);
7: dbHand db = new dbHand(conn.stmt);
8: /**************数据库连接**************/
9: tools pub = new tools (conn.getProp ()); //公用方法
JSP FileName:/wdkj/../pub/db_inc.jsp
Java FileName:/D:/erqijavaOOp/erqiJSPWeb/ZHONGYOA/apache-tomcat-5.5.25/work/Catalina/localhost/3gdisk//org/apache/jsp/wdkj\mySpace_jsp.java
An error occurred at line: 7 in the jsp file: /wdkj/../pub/db_inc.jsp
dbHand cannot be resolved to a type
4: /**************数据库连接**************/
5: String sIniFile ="public";
6: dbCon conn= connectManager.getInstance(sIniFile).getDbconnect(sIniFile);
7: dbHand db = new dbHand(conn.stmt);
8: /**************数据库连接**************/
9: tools pub = new tools (conn.getProp ()); //公用方法
10: ResultSet rs=null;
为什么啊 展开
dbCon cannot be resolved to a type
3: <%
4: /**************数据库连接**************/
5: String sIniFile ="public";
6: dbCon conn= connectManager.getInstance(sIniFile).getDbconnect(sIniFile);
7: dbHand db = new dbHand(conn.stmt);
8: /**************数据库连接**************/
9: tools pub = new tools (conn.getProp ()); //公用方法
JSP FileName:/wdkj/../pub/db_inc.jsp
Java FileName:/D:/erqijavaOOp/erqiJSPWeb/ZHONGYOA/apache-tomcat-5.5.25/work/Catalina/localhost/3gdisk//org/apache/jsp/wdkj\mySpace_jsp.java
An error occurred at line: 6 in the jsp file: /wdkj/../pub/db_inc.jsp
connectManager cannot be resolved
3: <%
4: /**************数据库连接**************/
5: String sIniFile ="public";
6: dbCon conn= connectManager.getInstance(sIniFile).getDbconnect(sIniFile);
7: dbHand db = new dbHand(conn.stmt);
8: /**************数据库连接**************/
9: tools pub = new tools (conn.getProp ()); //公用方法
JSP FileName:/wdkj/../pub/db_inc.jsp
Java FileName:/D:/erqijavaOOp/erqiJSPWeb/ZHONGYOA/apache-tomcat-5.5.25/work/Catalina/localhost/3gdisk//org/apache/jsp/wdkj\mySpace_jsp.java
An error occurred at line: 7 in the jsp file: /wdkj/../pub/db_inc.jsp
dbHand cannot be resolved to a type
4: /**************数据库连接**************/
5: String sIniFile ="public";
6: dbCon conn= connectManager.getInstance(sIniFile).getDbconnect(sIniFile);
7: dbHand db = new dbHand(conn.stmt);
8: /**************数据库连接**************/
9: tools pub = new tools (conn.getProp ()); //公用方法
10: ResultSet rs=null;
为什么啊 展开
4个回答
展开全部
给你一个能看懂的。
记得给兄我多加点分。谢谢了啊。
# 1、Oracle8/8i/9i数据库(thin模式)
# Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
# String url="jdbc:oracle:thin:@localhost:1521:orcl";
# //orcl为数据库的SID
# String user="test";
# String password="test";
# Connection conn= DriverManager.getConnection(url,user,password);
#
# 2、DB2数据库
# Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance();
# String url="jdbc:db2://localhost:5000/sample";
# //sample为你的数据库名
# String user="admin";
# String password="";
# Connection conn= DriverManager.getConnection(url,user,password);
#
# 3、Sql Server7.0/2000数据库
# Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
# String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb";
# //mydb为数据库
# String user="sa";
# String password="";
# Connection conn= DriverManager.getConnection(url,user,password);
#
# 4、Sybase数据库
# Class.forName("com.sybase.jdbc.SybDriver").newInstance();
# String url =" jdbc:sybase:Tds:localhost:5007/myDB";
# //myDB为你的数据库名
# Properties sysProps = System.getProperties();
# SysProps.put("user","userid");
# SysProps.put("password","user_password");
# Connection conn= DriverManager.getConnection(url, SysProps);
#
# 5、Informix数据库
# Class.forName("com.informix.jdbc.IfxDriver").newInstance(); String url =
# "jdbc:informix-sqli://123.45.67.89:1533/myDB:INFORMIXSERVER=myserver;
# user=testuser;password=testpassword";
# //myDB为数据库名
# Connection conn= DriverManager.getConnection(url);
#
# 6、MySQL数据库
# Class.forName("org.gjt.mm.mysql.Driver").newInstance();
# String url ="jdbc:mysql://localhost/myDB?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"
# //myDB为数据库名
# Connection conn= DriverManager.getConnection(url);
#
# 7、PostgreSQL数据库
# Class.forName("org.postgresql.Driver").newInstance();
# String url ="jdbc:postgresql://localhost/myDB"
# //myDB为数据库名
# String user="myuser";
# String password="mypassword";
# Connection conn= DriverManager.getConnection(url,user,password);
记得给兄我多加点分。谢谢了啊。
# 1、Oracle8/8i/9i数据库(thin模式)
# Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
# String url="jdbc:oracle:thin:@localhost:1521:orcl";
# //orcl为数据库的SID
# String user="test";
# String password="test";
# Connection conn= DriverManager.getConnection(url,user,password);
#
# 2、DB2数据库
# Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance();
# String url="jdbc:db2://localhost:5000/sample";
# //sample为你的数据库名
# String user="admin";
# String password="";
# Connection conn= DriverManager.getConnection(url,user,password);
#
# 3、Sql Server7.0/2000数据库
# Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
# String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb";
# //mydb为数据库
# String user="sa";
# String password="";
# Connection conn= DriverManager.getConnection(url,user,password);
#
# 4、Sybase数据库
# Class.forName("com.sybase.jdbc.SybDriver").newInstance();
# String url =" jdbc:sybase:Tds:localhost:5007/myDB";
# //myDB为你的数据库名
# Properties sysProps = System.getProperties();
# SysProps.put("user","userid");
# SysProps.put("password","user_password");
# Connection conn= DriverManager.getConnection(url, SysProps);
#
# 5、Informix数据库
# Class.forName("com.informix.jdbc.IfxDriver").newInstance(); String url =
# "jdbc:informix-sqli://123.45.67.89:1533/myDB:INFORMIXSERVER=myserver;
# user=testuser;password=testpassword";
# //myDB为数据库名
# Connection conn= DriverManager.getConnection(url);
#
# 6、MySQL数据库
# Class.forName("org.gjt.mm.mysql.Driver").newInstance();
# String url ="jdbc:mysql://localhost/myDB?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"
# //myDB为数据库名
# Connection conn= DriverManager.getConnection(url);
#
# 7、PostgreSQL数据库
# Class.forName("org.postgresql.Driver").newInstance();
# String url ="jdbc:postgresql://localhost/myDB"
# //myDB为数据库名
# String user="myuser";
# String password="mypassword";
# Connection conn= DriverManager.getConnection(url,user,password);
展开全部
dbCon dbHand connectManager 这三个东西他不认识哈。。
你需要把相应的类导入到这个jsp里面来。。
你需要把相应的类导入到这个jsp里面来。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
java连接Oracle数据库常用的有三种方式 type2,type3,type4
常用的是type4的方式
使用type4的方式时,你需要一个java与oracle数据库通信的jar文件
该jar文件包含在Oracle的目录中你可以自己去找也可以去网上下一个
接着将jar包导入到你的java项目中
Class.forName("oracle.jdbc.driver.OracleDriver");
//加载驱动类,该类的位置就是你在前面导入的jar包中
String url="jdbc:oracle:thin:@localhost:1521:orcl";
//jdbc,oracle指通信协议
//thin指的是连接的类型就是type4
//localhost ip地址 1521端口号
//orcl为数据库的SID
String user="system";
String password="******";
//使用的用户角色以及密码
Connection conn= DriverManager.getConnection(url,user,password);
常用的是type4的方式
使用type4的方式时,你需要一个java与oracle数据库通信的jar文件
该jar文件包含在Oracle的目录中你可以自己去找也可以去网上下一个
接着将jar包导入到你的java项目中
Class.forName("oracle.jdbc.driver.OracleDriver");
//加载驱动类,该类的位置就是你在前面导入的jar包中
String url="jdbc:oracle:thin:@localhost:1521:orcl";
//jdbc,oracle指通信协议
//thin指的是连接的类型就是type4
//localhost ip地址 1521端口号
//orcl为数据库的SID
String user="system";
String password="******";
//使用的用户角色以及密码
Connection conn= DriverManager.getConnection(url,user,password);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
dbCon dbHand connectManager这三个类名首字母需要大写,且在jsp中需要import。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询