由买买提看人间百态

topics

全部话题 - 话题: jdbc
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
a****d
发帖数: 2
1
来自主题: Database版 - 我的oracle 怎么了?
我在windowXP 下安装了oracle8.1.5 for NT 和 Jbuilder6.
我写了一个jdbc 程序, 用的是oracle jdbc driver. 开始时
能连接到database, 并且能create table. 后来大概是在drop
table 时出了问题. oracle 整个不能启动, control panel
里的service status 是 "starting". 但是不能手动启动.
用sql+ 登陆失败, error message 是 ORA-01034. 请问各位
有什么办法解决? 非常感谢!!
c********x
发帖数: 93
2
来自主题: Database版 - 请教一个sql server的问题
我通过jdbc执行一条语句:
INSERT INTO OBJECT VALUES ( 'login' , 'pass' , 1)
结果每次都产生下面的exception:
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]No ResultSet set was
pr
oduced.
不过察看数据库,发现我的insert操作是成功的!!但是我的executeQuery是最后一条语
句啊!
请大侠给个提示是怎么回事,还有为什么会有这个exception, 谢谢先。
y****i
发帖数: 5690
3
【 以下文字转载自 Java 讨论区 】
【 原文由 yongqi 所发表 】
Except JDBC, are there any other solutions for Java-based technologies(such
as JSP, Servlets, etc) to connect to Databases including IBM DB2 and Oracle?
The major operations on the database will be information retrival, browsing,
or searching. I guess it's mainly web-based too. It's for an University Library project and not enterprise so
couldn't afford expensive solutions.
I can only think of JDBC. When I searched google, I found something named JDO
but J
h****e
发帖数: 204
4
JDBC is simple and good enough for normaly SQL queues.
in JSP, Servlet, u still use JDBC to connect with database layer
JDO? sounds like ADO's Java version? interesting :)
m*****g
发帖数: 8
5
来自主题: Database版 - HELP!!!Connect to MySQL in JSP
Hi thanks man
That what i did, the JDBC driver standalone testing code is working well when
it called by a JAVA main file, but not when called by JSP file. The code i use
is following:
try{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
con = DriverManager.getConnection(
"jdbc:mysql://localhost/mike ?user=mike&password=mike");
System.out.println("connected to database");
} catch(ClassNotFoundException cnfe){
error="ClassNotFoundException: Could not loc
l***r
发帖数: 459
6
来自主题: Database版 - question on JOIN on Oracle
Does JDBC support that?
I Google it and found this
http://www.roguewave.com/support/docs/xml/xdbug/1-1.html
It seems JDBC doesn't support it, right? Since my product is Java based, does
any XML package support this?
Thanks!

between
y**o
发帖数: 4
7
sqlj -codegen=oraclejdbc dbtest.sqlj
jdbc code run 起来没问题的环境(oracle9.0+jdbc driver)
用sqlj作traslate的时候,单独的connection码(Oracle.connect(...))通过,
但一加上 #sql 就出了以下错误:
java.lang.IncompatibleClassChangeError: sqlj.runtime.ExecutionContext and sqlj.e
at java.lang.Class.getDeclaringClass(Native Method)
at sqlj.framework.DefaultInnerClassDescriptor.getDeclaringClass(Default)
at sqlj.framework.JSClass$ClassWrapper.getDeclaringClass(JSClass.java:1)
at sqlj.framework.JSClass.reso
n********a
发帖数: 68
8
Your connection string seems to be missing port number 1521.
Try this as a start.
jdbc:oracle:thin:@xxx.xxx.x.xx:1521:ipoll

refused(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=12505)(ERROR_STACK=(ERROR=(CO

好像只要class12.jar就可以了,可是如果我只加这个,去掉别的,他就说找不到oracle.
oracle.jdbc.driver.OracleDriver(););
b****e
发帖数: 1275
9
【 以下文字转载自 SanFrancisco 讨论区 】
【 原文由 breeze 所发表 】
如何往mysql里面写中文啊?我读了半天RTFM, 把character set change to gbk,
collate to gbk_chinese_ci, jdbc string也加上了
jdbc:mysql://localhost/test?user=xxx&useUnicode=true&characterEncoding=gb2312
怎么读出来还是乱码? google找到一个台湾老大说set properties 也没用。搞得我觉
都没水好,早早起来了。请指教一二,不胜感激。
c*****s
发帖数: 214
10
来自主题: Database版 - 怎样让oracle不要fail on error
通过JDBC访问ORACLE,batch执行一批sql时,如果一个有错就当全错了。
在mysql里可以通过jdbc url上加continueBatchOnError=true来忽略batch里的错误。同
样的目的在Oracle上要怎样做?
t********k
发帖数: 808
11
另外我用jdbc接连oracle,好象上面的异常是不抛出了
但还是有点问题
用下面的测试代码
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection(
"jdbcracle:thin:@localhost:1521rcl",
"scott", "tiger");
String sql = "{?=call PckgStudSltCourse.addStudPreSltCourse(?,?,?,?)}";
ResultSet rs = null;
CallableStatement cs = con.prepareCall(sql);
cs.registerOutParameter(1,java.sql.Types.INTEGER);
String [] courseIDs = {"12","34","56"};
int count = 0;
cs.setString(2,years);
cs.setString(3,termID);
cs.setStri
h******e
发帖数: 150
12
来自主题: Database版 - oracle JDBC thin vs. JDBC OCI
不应该把. OCI应该更快点.
当然要看你如何用QUERY.
s***z
发帖数: 9
13
jdbc是有的,应该是可以把数据都用jdbc读出来在写到oracle里。但是oracle里不知道
有没有什么工具可以直接load他们。owb好像只支持odbc。
b***i
发帖数: 3043
14
mysql是在openshift上的cartridge,
spring的beams.xml
不好用,显
示连不上数据库。里面的127.2.xx.yy就是openshift告诉我的数据库的ip地址。
但是,改成localhost
,然后rhc
client里面port forwarding给127.2.xx.yy就好用,而显示的就是把127.0.0.1forward
给了127.2.xx.yy这个地址。
为什么呢?
k*z
发帖数: 4704
15
牛人,我彻底改成用AS400的JDBC了。 任何DB2-ODBC/JDBC都不work。
h********m
发帖数: 116
16
比如说:我jdbc连到数据库,然后我自己有个Scala写的字符串变换函数,对某表某列
的字符串进行特定操作。我怎样调用这个函数,应用到这一列呢?貌似Stored
Procdcure只能调用内部函数?
补充:是对Oracle数据库进行操作。有人建议用Groovy写一些function。我搜了半天,
还是没找到怎么调用。谁能给点建议?
举个简单例子,我有个groovy或者Scala的function f(x), return 2*x
那我想jdbc连到oracle的某个表,然后调用f(x), 把这个表某列的值全部变成2x
t*****s
发帖数: 124
17
来自主题: DotNet版 - .NET 新手 请教两个弱问题

JDBC connection? Do you really want to mean ODBC connection?
C# should have no means to use JDBC connection.
http://YourMachineNameOrIP/MY_APP/start.aspx
G***o
发帖数: 5158
18
my $.02
first, are you using OCI8 or THIN?
if OCI8,
make sure your URL string looks like this:
"jdbc:oracle:oci8:@"+< database >
the '@' in the URL string is required
is optional, make sure you
use SID.DOMAIN format if under Windows NT

if thin, sth like this:
jdbc:oracle:thin:@:1521:
m******t
发帖数: 2416
19
来自主题: Java版 - Re: OR mapping
So far TopLink is the most sophiscated one, not for free though.
The factors you need to consider whether to use a OR mapping tool
or to go directly through JDBC are:
1.learning curve. commercial tools like TopLink can handle very
complex schema, which implies complex OR mapping description scheme
that takes steep learning curve.
2.performance. if you feel like OR maping will be your bottleneck,
JDBC is probably the way to go.
3.budget. if you plan to deploy your product on client site, licens
y**o
发帖数: 4
20
来自主题: Java版 - sqlj 问题求教 急
sqlj -codegen=oraclejdbc dbtest.sqlj
jdbc code run 起来没问题的环境(oracle9.0+jdbc driver)
用sqlj作traslate的时候,单独的connection码(Oracle.connect(...))通过,
但一加上 #sql 就出了以下错误:
java.lang.IncompatibleClassChangeError: sqlj.runtime.ExecutionContext and sqlj.e
at java.lang.Class.getDeclaringClass(Native Method)
at sqlj.framework.DefaultInnerClassDescriptor.getDeclaringClass(Default)
at sqlj.framework.JSClass$ClassWrapper.getDeclaringClass(JSClass.java:1)
at sqlj.framework.JSClass.reso
xt
发帖数: 17532
21

This is probably the problem of Oracle JDBC itself. As I remember
if they string is too long (sth like more than 2 or 4k), you may
not use setString directly with Oracle thin driver.
This is one of the reasons why Oracle JDBC sucks
xt
发帖数: 17532
22

if
Oracle JDBC driver, especially the Oracle:thin driver, is the worst I know
amoungst
major DBMS's. It has many many problems. For example, if you define a CHAR[40]
field
in your schema, then set it to "hello". It works fine if you do a direct SQL
search
for WHERE field='hello'. However if you use JDBC with the very same string,
you will
never get the record back. You have to use "hello" padded with 34 spaces to
get the
record back. Talking about consistency! IMHO, Sybase has the best SQL
comp
xt
发帖数: 17532
23

You cannot connect to a DB2 database without database name.
I believe DB2 JDBC does offer features to create databases.
You need to look into their JDBC documentation, if they
do publish.
r***l
发帖数: 67
24
来自主题: Java版 - 求救
It's a security exception. The security manager on your machine does not allow
the Applet to access local IO. The end result is Applet will not make JDBC
connection.
Normally, no one tries to use Applet to insert data into database through JDBC
directly. It's not a good practice.
c***a
发帖数: 251
25
来自主题: Java版 - 求救
fist of all, I really appreciated your reply.
Actually, I didn't do any insertion about the data to the database.
just some retrieval.
Can you give me some hints about how can I realize it?
Thank you.

It's a security exception. The security manager on your machine does not allow
the Applet to access local IO. The end result is Applet will not make JDBC
connection.
Normally, no one tries to use Applet to insert data into database through JDBC
directly. It's not a good practice.
xt
发帖数: 17532
26
来自主题: Java版 - java数据库读取错误,请教

Quit complaining about Sybase. If you like Oracle, you should try
this:
define a table with a field like "foo CHAR(32)"
then use your JDBC to insert a row, set foo to be "hello".
Then use Oracle JDBC driver to retrieve it, with foo='hello'
See what you get.
We have been using JConnect5 all the time, except before
2001. We never had any surprises like this. DB2 has some,
Oracle has some.
xt
发帖数: 17532
27
来自主题: Java版 - java数据库读取错误,请教

Honestly I feel Sybase and IBM JDBC are much better. Oracle JDBC is not good.
I have no idea of NCR's Terabyte, since it is even more unpopular than
Sybase ASE.
xt
发帖数: 17532
28
来自主题: Java版 - java数据库读取错误,请教

It is not my fault that JDBC returns a different value than their own SQL
Plus.
Sir, this is getting ridiculous. When I add a string into a CHAR(32) with DB2
then use their JDBC to retrieve it, it does NOT give me the padding. So what
*is* the standard? Please understand English!
point
IBM
IBM JDK sucks for sure. Last time I used a relatively complicated boolean
method
and used if( !complicatedMethod() ) {}. The method returned true and it went
into
the scope! Then I just changed to if( !(compl
l***r
发帖数: 459
29
I met a strange problem on JDBCRealm:
In my server.xml, it looks like:
className="org.apache.catalina.realm.JDBCRealm"
debug="99"
driverName="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost/auth"
connectionName="user"
connectionPassword="password"
userTable="users"
userNameCol="user_name"
userCredCol="user_pass"
userRoleTable="user_roles"
roleNameCol="role_name"
digest="MD5"
/>
It works if I use FORM authentication. So I am sure
mysql driver and MD5 are working fine. But it d
d********r
发帖数: 199
30
see java sql API (java.sql.*.java) , 下面一大堆都是interface,
再找一个 free source的driver 驱动看一看,
比如mysql的jdbc驱动程序包,
弄明白应用程序是怎样使用mysql jdbc驱动程序了,
就应该明白了吧。
d****s
发帖数: 30
31
来自主题: Java版 - About Hibernate
I don't know why somebody are so confident with Hibernate.
I'd to admit it is famous in open source community. But
it is not a good architect in either academic or industry.
First of all, Hibernate is a light weight JDBC encapsulate
package, not ready for heavy loaded purpose
Second, Hibernate doesn't have its own transaction layer.
It relys on other transaction implementations, such as JTA
(you need set it in config file). By default it uses JDBC
Transaction. This makes Hibernate not a mission
c**g
发帖数: 274
32
来自主题: Java版 - About Hibernate
I am not a fan of Hibernater, but your first point and second
point are really not sound.
Are you saying JDBC is not ready for heavy loading? or a light
weight wrapper package is in general not ready for heavy loading?
Doesn't EJB itself also rely on JDBC as the underlying RDMS
access?
Talking about transaction, I doubt any framework/buzz tech
can do better than RDMS. As a matter of fact, mission critical
application existed long before 3/n-tier architecure born. Back
then, a lot of mission crit
c*****s
发帖数: 214
33
【 以下文字转载自 Database 讨论区,原文如下 】
发信人: cyclops (编程浪子), 信区: Database
标 题: 怎样让oracle不要fail on error
发信站: Unknown Space - 未名空间 (Wed Apr 13 13:16:34 2005) WWW-POST
通过JDBC访问ORACLE,batch执行一批sql时,如果一个有错就当全错了。
在mysql里可以通过jdbc url上加continueBatchOnError=true来忽略batch里的错误。同
样的目的在Oracle上要怎样做?
w*******g
发帖数: 9932
34
I guess the problem is with the type of the array elements.
you have an array of string and you want to pass to jdbc that accepts
an array of some other types.
can you find out the types used for the jdbc elements?
t********k
发帖数: 808
35
另外我用jdbc接连oracle,好象上面的异常是不抛出了
但还是有点问题
用下面的测试代码
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection(
"jdbcracle:thin:@localhost:1521rcl",
"scott", "tiger");
String sql = "{?=call PckgStudSltCourse.addStudPreSltCourse(?,?,?,?)}";
ResultSet rs = null;
CallableStatement cs = con.prepareCall(sql);
cs.registerOutParameter(1,java.sql.Types.INTEGER);
String [] courseIDs = {"12","34","56"};
int count = 0;
cs.setString(2,years);
cs.setString(3,termID);
cs.setStri
p***p
发帖数: 559
36
来自主题: Java版 - Java 面试常见问题!
http://blog.tomxp.com/view/186.html
Java基础方面:
1,作用域public,protected,private,以及不写时的区别
2,ArrayList和Vector的区别,HashMap和Hashtable的区别
3,char型变量能不能定义为一个中文?为什么?
4,多线程有几种表示方法,都是什么?同步有几种实现方法,都是什么?
5,继承时候类的执行顺序问题,一般都是选择题,问你将会打印出什么?
6,内部类的实现方式?
7,垃圾回收机制,如何优化程序?
8,float型float f=3.4是否正确?
Jsp方面
1,jsp有哪些内置对象?作用分别是什么?
2,jsp有哪些动作?作用分别是什么?
3,include的两种实现方式的区别?
4,两种跳转方式分别是什么?有什么区别?
Servlet方面
1,说一说Servlet的生命周期?
2,Servlet版本间(忘了问的是哪两个版本了)的不同?
Jdbc,Jdo方面
1,可能会让你写一段Jdbc连Oracle的程序.
2,Class.forName的作用?为什么要用?
3,Jdo是什么?
Xml
l********r
发帖数: 187
37
I am always getting a "Exception: No suitable driver found for jdbc:mysql://
localhost:3306/test" from the following program. I have installed mysql
connector for Java and ODBC driver. Could anyone tell me what might be wrong
? I am using Fedora Linux 6.. The source code is listed bewlow:
import java.sql.*;
public class DBJava {
public static void main(String args[]) {
Connection con = null;
String query = "SELECT * FROM temp";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriv
y********o
发帖数: 2565
38
Hey, I thought that the driver name for mysql jdbc is "com.mysql.jdbc.Driver
" instead.
A**o
发帖数: 1550
39
you have to release jdbc resources manually...
like statement.close()
and, you have to deal with exception conditions
in short, jdbc sucks.
A**o
发帖数: 1550
40
1, make sure you understand what's the expected result
2. excute the stored procedure using sql tools, check if it works at all
3. check your jdbc grammer, and intercept your jdbc call to the db
and check against what you have in 2
m*****k
发帖数: 731
41
【 以下文字转载自 Working 讨论区 】
发信人: madmonk (madmonk), 信区: Working
标 题: 你们的应用是如何存储数据库密码的
发信站: BBS 未名空间站 (Fri Sep 4 09:58:56 2009, 美东)
你们的应用是如何存储数据库密码的。不会是像如下hardcode在程序里吧?
Class.forName(“oracle.jdbc.driver.OracleDriver”);
String url = jdbc:oracle:thin:@hostname:1526:myDB;
Connection myConnection = DriverManager.getConnection(url, “username”, “
password”);
h*****0
发帖数: 4889
42
手头有一个access 2007的数据库文件database.accdb
现使用jdbc连接:
"jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=database.
accdb"
然后从库中读出某法语字符串System.out.println()打印出来显然为
Fran?ais
其中的?号应该是一个c下面加点的符号。
请问如何正确的获取该字符串?
i****e
发帖数: 913
43
RuntimeException是Exception的subclass, 可以catch,可以rethrow, 也可以
specify/declare在method的delaration上(注意楼主在这里有点概念不清, throws
exception不是signature的一部分, 只是告诉compiler如果是checked exception,
compile时候帮忙check一下; 还有就是subclass的overiding method只能throws同样或
inherited checked exceptions).
Spring JDBC/TopLink/JDO/H8既然跟JDBC反着干, 理应specify all their unchecked
exceptions on method declaration, 其实Spring JDBCTemplate也是这样做了.
http://static.springsource.org/spring/docs/2.0.x/api/org/spring
而且由于是throws RuntimeException, 不catch... 阅读全帖
d******y
发帖数: 244
44
I learn from a tutorial. I try run the example. errors happen.
something about session and hibernate.cfg.xml.
Here are files.
package roseindia.tutorial.hibernate;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
/**
* @author Deepak Kumar
*
* http://www.roseindia.net
* Hibernate example to inset data into Contact table
*/
public class FirstExample {
public static void main(String[] args) {
Session session = null;
try{
// This ste... 阅读全帖
e*****t
发帖数: 1005
45
来自主题: Java版 - 说说spring和ejb的差别
这篇是好文,讲的历史沿革,还有层次都很清晰。
吹毛求疵一点点:
1. ejb刚出来的时候,persistence tier主流不是hibernate,应该是jdbc,至于ORM,
应该最热的是iBais。当然hibernate是在ejb2年代热起来的,所以ejb3搞jpa就直接弄
来Gavin King,照搬了hibernate
2. Spring当初是lightweight,现在整个spring一点也不light,应该是比javaEE整个标
准加起来都庞大,只不过大家平日只是用到其中一部分而已:Spring core, Spring
security, Spring MVC, and etc...
3. Entity bean还是JavaEE的概念,Spring那帮人就是不好那个,所以搞POJO.所以提
到data object时,对于spring,还是说pojo来的比较好。
4. Hibernate是red hat的,jboss也是red hat的。不过hibernate至少现在不是jboss的。
5. Spring最初也不过是从POJO, IoC,和transaction搞起来的... 阅读全帖
c*********e
发帖数: 16335
46
来自主题: Java版 - programming那帮人好好玩啊
在eclipse用glassfish做java war,非常的容易啊,jdbc就在glassfish里设置一下,根
本就没咋写jdbc code.ejb,标明@stateful,@stateless就好,因为是session beans,
所以只在内存存在。和entity bean还不一样。
如果用spring,就不用管什么ejb了。
c*********e
发帖数: 16335
47
核心是servlet, httpRequest,httpResponse,forward,redirect之类,用serializable
的entity bean存入数据库。没啥特别不同的东西。
jdbc根本就不用学,这玩艺很老,code都能在网上copy到。在glassfish里面,直接设
置一个jdbc就好了,都不用管它。

xml
c*********e
发帖数: 16335
48
来自主题: Java版 - 不明白Spring Framework很正常
hibernate不难,比如用eclipse,glassfish,就只需要在glasfish里面设置一下jdbc,以
后就不用管jdbc了,超级简单。hibernate非常简单容易用,这是它普及的原因。ejb难
学难用,这是它不流行的原因。c++难学难用,这是它比不上java的原因。
c*****y
发帖数: 562
49
JSP是基础。JSF也是用JSP,它和JSP不是并列关系
Servlet和filter是MVC framework中controller的基础。基本知识要知道。
在真的project中如果用SpringMVC等MVC frameworks,你可能不需要写基本Servlet了。
DAO layer for relational database可能是:
- JDBC
- Spring JDBC template
- iBatis
- JPA (Hibernate或其它implementation)
- JPA + Hibernate
取决于你的需要
Spring Data更在JPA基础上加了一些东西,同时支持各种NoSQL
S*******C
发帖数: 822
50
J2EE的项目没高手指点自己苦逼配置真是太难了
当年我学Oracle JDBC花了6个月时间也没连上Oracle,一度都放弃了
2年后我走了狗屎运才连上的,难点就在找对Oracle JDBC URL中的SID
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)