I have an application that uses JDBC to connect to Oracle 11g. Unfortunately, the machine my app is running on and the Oracle machine are connected via a somewhat low bandwidth connection. I haven't sniffed the connection, but I am pretty sure the data streaming across the connection is not compressed. For my application, I'm more con...
Hi All,
How can I import a mysql database dump file (contains insert and create table statements) programmatically through a java program. I need this as the setup phase of a unit test.
Unfortunately this doesn't work:
Connection conn = dbConnectionSource.getConnection();
Statement stmt = conn.createStatement();
stmt.execute(FileUtil...
import java.sql.*;
public class NewConnection{ private static Connection con;
private static ResultSet rs;
private static Statement sm;
private static final String DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";
private static final String URL = "jdbc:odbc:Driver={Microsoft Access driver (*.mdb)};DBQ=E:\\Database.mdb;";
pr...
import java.sql.*;
// I think this is a poor abstraction
public class NewConnection {
/*very important: dont use statics for your Connection, Statement and Query objects,
since they can and will be overriden by other Instances of your NewConnection.*/
// There's no need at all for having class members here. It's actually
// a ...
I want to convert my Resultset to List in my JSP page. and want to display all the values. This is my query:
SELECT userId, userName
FROM user;
I have executed that using preparedstatement and got the Resultset. But how to convert it as a List and want to display the result like this:
userID userName
------------------
1001 ...
## This is the code i m runnig in linux ubuntu.. ##
import java.sql.*;
/**
*
* @author spk
*/
public class Connectionsetting {
private static Connection con;
private static java.sql.Statement sm;
private static ResultSet rs;
public void close()
{
try
{
sm.close();
con.clo...
I have a ResultSet object that I need to turn into an OracleResultSet so that I can call the getOPAQUE(String) method on it. I'm using c3p0 as my connection pool. The problem is that c3p0 wraps ResultSets in NewProxyResultSet objects.
This shouldn't be a problem because I should just be able to call unwrap on the ResultSet like this:
r...
Is there some way to get a value from the last inserted row?
I am inserting a row where the PK will automatically increase due to sequence created, and I would like to get this sequence number. Only the PK is guaranteed to be unique in the table.
I am using Java with a JDBC and Oracle.
I forgot to add that I would like to retrieve thi...
Greetings,
I'm looking for a good solution for externalizing the JNDI connection pool information in context.xml of a war so that as the application moves from dev to QA to prod, the war file won't need to be recompiled. Ideally the url, driver, username and password would be variablized and then populated by means of a properties file...
I have an MS-Access database ( A English-telugu Dictionary database) which contains a table storing English words and telugu meanings.
I am writing a dictionary program in Java which queries the database for a keyword entered by the user and display the telugu meaning.
My Program is working fine till I get the data from the database, b...
/**
*
*/
package ORM;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
* @author Gwilym
* @version 0.0
*/
public class DatabaseConnection {
private String userName="";
private String password="";
private String host="";
Connection conn;
/**
* @param userName
* @param passwo...
How do I convert Resultset object to a paginated view on a JSP?
For example, this is my query and result set:
pst = con.prepareStatement("select userName, job, place from contact");
rs = pst.executeQuery();
...
How to catch a specific exceptions in JDBC? Examples: primary key exception or foreign key exception.
...
SEVERE: javax.naming.NamingException: Lookup failed for 'jdbc:mysql://localhost:3306/sample ' in SerialContext [Root exception is javax.naming.NameNotFoundException: jdbc:mysql:]
what to do to rectify?
i am running jsp code in netbeans and i am using mysql as dbms
...
Hello,
I am trying to connect to mysql database from jsp page. The
connection code is as below
InitialContext ic=new InitialContext();
DataSource ds=(DataSource)ic.lookup("jdbc:mysql://localhost:3306/");
Connection con=ds.getConnection();
Statement stmt = con.createStatement();
when i open the page i get the foll...
hi,
i am looking for best aproach from perfomance point of view , to show Resultset on webpage partially , lets say by 10 item per page and if user want to see more result, he pressing "next" btn .
i think (probablly wrong) it should be new request to the Server when "Next" button is pressed ??
currentlly i trying to learn Java,GWT
...
I have enterprise project, but all queries are implemented using oracle stored procedures, I use jbdc and Spring framework to get results like this :
public class HoaDonDAOimpl extends JdbcDaoSupport implements HoaDonDAO {
public List<HoaDon> getDsTatcaHoadonPhathanh(int vthang, int vnam,
String vmaDvqltb) throws Exception {
Ca...
I am facing ORA-01000: maximum open cursors exceeded although I am closing the resultsets in finally block. But I suspect there is some trouble with my legacy code, below is my pseudo-code
while (someCondition) {
rs1=executePreparedStatementNew(query1,param1,"");
//do something with rs1
rs1=executePreparedStatementNew(query2,param2,"")...
I am attempting to add an "export to CSV" feature to a webapp that displays data from a MySQL database. I have a written a "queryExecuter" class to execute queries from my servlet. I have used this to successfully execute insert queries so I know the connection works etc however queries with the "into outfile" statement are simply not ...
I am being required to use a postgreSQL database and it will replace my current use of berkeleyDB. Although; I realize this is not an ideal situation, it is beyond my control.
So the question is... If you were required to make postgreSQL into a key value store how would you go about doing this, while making it as efficient as possible?...