I need to copy data into an MSSQLServer 2005 database table which has an identity column.
I've seen how to disable the identity column by executing
SET IDENTITY_INSERT <table> ON
before the insert queries.
How can I do this when I'm using PreparedStatements to do batch inserts and I can't change the statement during the operation?
...
I am looking for a tool that Logs SQL statemetns fired in the application as I use the application.
I found p6spy. But there is an issue with that. It doesnt seem to be compatible with XA Datasources.
Is there a way to make p6spy work on Websphere 6.1 OR is there an alternative to p6spy ?
Also, if anyone has any AspectJ code that inte...
I have the host, port, user id and password but missing SID for connecting to Oracle DBMS. How can I find the list of SIDs on that server?
...
I user the java.sql.Statement.excecuteUpdate method to create a table and insert some values into the database through JDBC. However, it gives me MySQL syntax exceptions for no reason. I copied and pasted the same code into command prompt. it worked.
I'm wondering why it's doing that??
...
Hello
Is there any way of insert a row in a table and get the new generated ID, in only one statement? I want to use JDBC, and the ID will be generated by a sequence or will be an autoincrement field.
Thanks for your help.
John Pollancre
...
Why are batch inserts faster? Is it because the connection and setup overhead for inserting a single row is the same for a set of rows? What other factors make batch inserts faster?
How do batch updates work? Assuming the table has no uniqueness constraints, insert statements don't really have any effect on other insert statements in th...
I am trying to get info from an embedded db called NexusDB using java.
Alternative 1:
I've read in NexusDB website that there is an ODBC driver so I might use it with unixODBC. Then I need to do a JDBC-ODBC Bridge as stated here.
Alternative 2:
Get some sort of application to migrate NexusDB db to another db.
Would like to know one.
...
There are two databases, the local one (damn MYOB data file, can only read locally via JDBC-ODBC connection), the other one is mysql which runs on another server.
what is the best way to synchronize the two databases?
is it possible to execute "insert into _mysql.table1 select * from _myob.table1" or do something similar?
I hate to s...
Is there a Java equivalent to PHP's mysql_real_escape_string() ?
This is to escape SQL injection attempts before passing them to Statement.execute().
I know I can use PreparedStatement instead, but let's assume these are one shot statements so preparing them will result in lower performance. I've already changed the code to use Prepare...
import java.sql.* ;
import java.util.* ;
import java.io.* ;
class DataBaseFactory{
public static Connection getConnection() {
// ...
}
}
class Demo{
public static void main(String []args) throws SQLException {
Connection con = DataBaseFactory.getConnection() ;
// This is throwing exception
/...
I have a method ... where I can't find the error:
public String getUsernameforID(int id) {
String statment = "SELECT USERNAME FROM `BENUTZER` WHERE `ID` = ? ;";
String username = null;
try {
PreparedStatement ps = dbCommunicator.getStatment(statment); // HERE : NULL POINTER EXECTION
ps.setInt(1, id);
...
I am working on a java app that uses Spring IOC and JDBC Template classes. I have a DAO class that has 4 methods : m1() to m4(). m1 performs multiple inserts and updates on table t1, m2 on table t2, m3 on t3, etc.
The dao methods are used as follows:
while(true)
{
//process & generate data
dao.m1(data1);
dao.m2(data2);
dao.m3(...
I am working on a project, which is having huge database. [ around 32gb data in one week ]. We are using DB2, and spring-framework + jdbc. I just wanted to know is JDBC capable of handling this much of data? Or should i use something else? Or if JDBC is capable of doing this then should i use some specific technique for this thing.
...
When I ran my web application under Eclipse IDE everything worked fine.
But when I exported my project into war-file and deployed in tomcat I've got following message:
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc
I've tried putting sqljdbc4.jar everywhere:
catalina-home\lib dir
WEB-INF\lib dir
both of them
What I...
I've got the following function that I wish to call:
CREATE OR REPLACE PACKAGE utils AS
TYPE item_list IS TABLE of items.item_id%TYPE;
FUNCTION getParentsForItem(p_item_id IN items.items_id%TYPE)
RETURN item_list;
END utils;
But I'm unsure of how to bind a java Collection to the return type of getParentsForItem.
...
Few questions on JDBC coding:
For a single client application, do we need a Connection pool?
Is it a good idea to create a Connection at beginning and keep it alive without close it until application exit? Why?
PreparedStatement is associated with Connection, if my connection is not closed after each query, why not keep the PreparedSta...
How can I use a JTable to display & edit attribute properties for entities retrieved from an entity,attribute,value (EAV) store (a relational DBMS)?
I know this is a question with a lot of possible answers, so PLEASE look at the requirements I have below before answering.
I promise to vote up answers that show you've read & understa...
I am starting to use MySQL with JDBC.
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql:///x", "x", "x");
stmt = conn.createStatement();
stmt.execute( "CREATE TABLE amigos" +
"("+
"id int AUTO_INCREMENT not null,"+
"nombre char(20) ...
I'm trying to connect to a MS SQL Server 2005 Express database that is running on the local host from a java program.
I have tried the same connect URL (below) that I used on another system (same jave code) that was running MS SQL Server 2000. But that does not work.
jdbc:jtds:sqlserver://127.0.0.1:1433/Finance
Any ideas?
...
Anyone know of a free/open source OLEDB/ODBC/JDBC driver against DataEase?
...