Originally posted by Guillaume Compagnon:
What is your opinion on the new release of JDBC API 3.0 ?
A good start point to know about JDBC 3.0 is: http://www-106.ibm.com/developerworks/java/library/j-jdbcnew/
for my part, the RETURN_GENERATED_KEYS function has been waited for a long time
The other features are aimed to improve performance with applications talking with DB. (connection & prepared statement pooling). That is SO important because the bottleneck is always (almost) with the communication with DB.
Originally posted by Thomas Kyte:
Well, I would tend to disagree with the Object database comment as a "pointer" as you call it is really a step backwards somewhat in data integrity (we had that with network databases way back when). You lose the referential integrity rule the user wants. You can "point" to a user or a group but there is nothing stopping the system from deleting that user or group (leaving you with a dangling pointer that points to nothing). We can do that with REFs and UDTs as you point out but you have that nasty dangling ref issue.
In a pure relational world (as would be true in an OO world), the data model would involve some super type (suppose we call it "ENTITY"). The USER table would be a child table of ENTITY as would the GROUP table. Now the MESSAGE_TABLE has a foreign key to ENTITY (as the OO model would have a pointer to an ENTITY instance but the pointer might be the USER or GROUP as ENTITY is probably an abstract class)..
So, one method to solve this is to have tables such as:
create table entity( id int primary key, data varchar2(10) );
create table users
( id primary key references entity, other_data varchar2(10) );
create table groups
( id primary key references entity, other_data varchar2(10) );
create table messages
( msg_id int primary key, who_from references entity );
Originally posted by Jamie Robertson:
If you are using statements you can do the following:
String query = "select * from emp";
System.out.println(query);
rs = stmt.executeQuery(query);
Unfortunately with PreparedStatements you can only print out the individual parts of it:
String query = select * from emp where id = ?";
PreparedStatement ps = con.prepareStatement(query);
System.out.println(query);
System.out.println(value1);
ps.setString(1,value1);
...
Hope this helped a little bit. If you are looking for a method like ResultSet.getQueryString(); I think you're out of luck.
Jamie
Originally posted by karim qazi:
Can anyone explain to me how to use the ConnectionPoolDataSource vs. DataSource.
I know how to get a connection using the DataSource interface how can you get a ConnectionPoolDataSource instead?
Originally posted by Robin Richardson:
I've checked all those sites already. They all seem to be geared toward Windows only, of course since I'm not very familiar with Solaris I may be missing something, and I need to know exactly how to add the driver to the Solaris CLASSPATH (/user/....) so that it will work on this system. I have not been able to find the correct settings.
Thank you
Robin
Originally posted by Raghav Subramanian:
Hi,
I am trying to insert multiple values into multiple tables at a single instance.I have a HTML form and Servelt that connects me to the MSAccess database . i have 4 different tables in the database.and i want to enter the values in the form to these tables in a single submit button click. i tried doing
Statement st = conn.createStatement();
st.addBatch("insert into table 1");
st.addBatch("insert into table 2");
st.addBatch("insert into table 3");
st.addBatch("insert into table 4");
int [] count = st.executeBatch();
but i am getting a error all the time i do it this way , is this any other way to carry out this type of operation.
thanks
raghav
Originally posted by justin deming:
Hi,
I want to check if the resultset from my jdbc/oracle query contains anything so I say:
if(resultSet.next() == false) {
tell the user there were no results using jsp1
}
else {
while(resultSet.next()) {
print the results using jsp2
}
The problem occurs when the resultSet is not empty and else is executed. Since resultSet.next() has been called in the if statement the results start printing at the second record. I tried calling resultSet.previous() before the while loop but it is a forward only resultSet.
Can anyone think of a better way to check this condition or how the make the resultSet traverseable in two directions?
Originally posted by Sophia Oscario:
I try to use Pool Manager 2.0 to handle database connection to MySQL from JSP.
But it returns an execption :
Exception Report:
javax.servlet.ServletException: javax/sql/ConnectionEventListener
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:442)
at org.apache.jsp.JDBCtest_jsp._jspService(JDBCtest_jsp.java:123)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:200)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:453)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:254)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:194)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:255)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:225)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2252)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:875)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:952)
at java.lang.Thread.run(Thread.java:484)
Here's My code :
<html>
<head>
<title>JDBC - MySQL</title>
</head>
<%@ page language="java" import="java.sql.*,com.codestudio.util.*" %>
<body>
<% SQLManager myManager = SQLManager.getInstance(); Connection myConn = myManager.requestConnection(); Statement st = myConn.createStatement(); ResultSet rs = st.executeQuery("select * from employee"); if (rs != null) { while (rs.next()) { String eid = rs.getString("empid"); String name = rs.getString("lastname") + ", " + rs.getString("firstname"); String extention = rs.getString("extention"); %> ID Name Extention <% } } st.close(); myManager.returnConnection(myConn); %> <%=eid %> <%=name %> <%=extention %>
</body>
</html>
Please anybody can tell me what's wrong ...
Thanks
Originally posted by JiaPei Jen:
Is the class12.zip bundled with the Oracle8i? Where should I place the class12.zip in my directory?
Originally posted by Farooq Ali:
Another question..
Can MS Ole-Db be used somehow instead of the standard ODBC/DSN technique?? to connect to a java program??
FArooq
Originally posted by Robin Richardson:
Hello, I'm working on a project that requires that the program I'm working on runs on a Solaris 7 server. I have written the program on Windows 2000 due to problems getting a driver for AS400 (DB2, or so I'm told) to work on the Solaris 7 box. Can anyone tell me if there is a driver available? If so, please direct me to that site, and the appropriate download/installation instructions
Thank you
Robin Richardson
Originally posted by Chetan,Mehta:
Hi,
Can someone please tell me what are the differences between avaliable types?
How do we identify for a given scenario which is the best suitable driver for use?
I understand that we have type1, type2 , type3 and type4 driver avaliable by Specification.
I needed help understanding scenario where particular driver can be the best fit.
Thanks,
Chetan