JDBC In OSGI - Table Does Not Have Index
Oct 4, 2013
To insert 500 records into oracle my code is taking more than 1 minute.
I am using the below:
1) dbcp connection pool
2) Jdbc, autocommit off
3) preparestatment
4) batchupdate
5) deployed in fuse servicemix
Important thing : Table doesnot have index.
How to improve the performance. Below is the code snippet..
// Added for Transaction
conn.setAutoCommit(false);
conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
PreparedStatement dataStmt= null;
dataStmt= conn.prepareStatement("insert statement");
for (Value value : valueList){
[Code] .....
View Replies
ADVERTISEMENT
May 8, 2014
How can insert value into sql server column of data type 'datetime' with jdbc the methods in java.sql are 'setdate()' and 'setTime()'
How can I do this. I'm using java.time.LocalDateTime.
View Replies
View Related
Oct 6, 2014
I am new to java or at least the collection series. My job is to make a method like this:
public void frequency(int[] arr)
And should contain numbers like: [ 2,5,2,9,7,1,100,2,3,5,77,9,1,2,6,5 ]
Now the next part i should sort the tabel and show how many times each number shows in the array:
with the index.
What is the best easiest way in collection?
View Replies
View Related
Jun 17, 2014
I have to build a server application. My issue is that it can never shutdown/restart. But I still need to update it.After some research I learned about OSGI where I can add/remove a bundle of code while the application is running. (update to a new version)Can I use JavaWS to update my OSGI application without having to close and restart it? I'm new to OSGI/JavaWS.
View Replies
View Related
May 17, 2014
calling a parameterized stored procedure in java jdbc from sql server.The stored procedure goes like this in sql
create proc patientreg
@id int
as
begin
select [patient_id],[Psurname], [pFirstname], [pMiddlename], [reg_date], [DOB], [Sex], [Phone_num], [Addr],[Email],[dbo].[fncomputeage](DOB) from [dbo].[Patient_registration] where [patient_id] = @id
end
please note dbo.fncompute(DOB) is a function
To call it in jdbc it goes like this
try{
String str = "{call patientreg(?)}";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbcdbc:GeneralHospit al");
cstmt = con.prepareCall(str);
cstmt.setInt(1, Integer.parseInt(t.getText()));
[code]....
after doing it this way it throwing an exception: Error:java.sql.SQLException: Parameter 1 is not an OUTPUT parameter.
View Replies
View Related
Mar 23, 2015
How to define Cell in the table by table event?
I need to process one component drag to the table. I misunderstand, how I can see to which Cell fall the component. I tried to use Event and Mouse event handlers in my custom Cell, but they do not work. I can copy the drag event to the table and table handles it, but how to get needed Cell I cant understand.
View Replies
View Related
Mar 13, 2014
This is my codes in a button that if I click it . that information will send to Jtable but the problem is the jtable is in another frame so how can i connect this ?
DefaultTableModel model = (DefaultTableModel)
new admin().tableBagtags.getModel();
if (txtName.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Please fill out all fields.", "Error!", JOptionPane.ERROR_MESSAGE);
[Code] .....
View Replies
View Related
Apr 29, 2014
I'm trying to add some mysql table columns to JSF table. And I'm getting error:
/index.xhtml: The class 'logon.User' does not have the property 'description'.
User.java
package logon;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
[Code]...
View Replies
View Related
Aug 7, 2014
public class StudentJDBCTemplate implements StudentDao
above class giving error as
The type StudentJDBCTemplate must implement the inherited abstract method
StudentDao.listStudents()
Interface is as below
import java.util.List;
import javax.sql.DataSource;
public interface StudentDao {
public void setDataSource(DataSource ds);
public void Create(String Name,Integer age);
public void getStudent(Integer id);
public List<Student>listStudents();
public void delete(Integer id);
public void update(Integer id,Integer age);
}
View Replies
View Related
Aug 9, 2014
I'm trying to understand the relationship between JAAS and JDBC..In WebSphere, when setting up a Dynamic cluster I have to first define the JAAS..Then, the datasource..The JAAS has one account/password and the datasource another..I'm not getting the relationship between needing both JAAS and JDBC docs.oracle.com/cd/E19225-01/820-5594/ahteo/index.html
View Replies
View Related
Nov 25, 2014
I wish to retrieve just one value from db;
so I use this code:
@Transactional
public long getSequenceSedeB(Long id) {
BigDecimal seqValue = nu
String sql = "SELECT MAX(ID) FROM SEDE_B_ALLEGATI_A WHERE ID_SEDE=:id";
SQLQuery query = getSession().createSQLQuery(sql);
[Code] ....
But it do not works; this is the log.
type.NullableType (NullableType.java:182) - could not read column value from result set: ID; Invalid column name
2014-11-25 14:45:14,476 WARN [btpool0-2] util.JDBCExceptionReporter (JDBCExceptionReporter.java:77) - SQL Error: 17006, SQLState: null
2014-11-25 14:45:14,478 ERROR [btpool0-2] util.JDBCExceptionReporter (JDBCExceptionReporter.java:78) - Invalid column name
But in the database the query
SELECT MAX(ID) FROM SEDE_B_ALLEGATI_A WHERE ID_SEDE=:id
run correctly;
Also I need to rewrite the statement
query.setParameter("id", 923);
in this way
query.setParameter("id", AAA);
where AAA is gotten from out of the procedure;
View Replies
View Related
Feb 26, 2015
I'm having problem with my code when it comes to Restore Database in Java. This is my code:
public boolean restoreDB(String dbUserName, String dbPassword, String source) {
String[] executeCmd = new String[]{"C:Program Files (x86)MySQLMySQL Server 5.1inmysqldump ", "--user=" + "root", "--password=" + "1234" + source};
Process runtimeProcess;
try {
runtimeProcess = Runtime.getRuntime().exec(executeCmd);
int processComplete = runtimeProcess.waitFor();
[Code] ....
View Replies
View Related
Jul 22, 2014
So, first i search the id from table and all the fields are filled as in the screenshot. then i modify in the text boxes and click on button modify but exception comes-too few parameters. expected 6.
here is the code:
try
{
JOptionPane.showMessageDialog(null,"Record succefully modified!
ID is "+id.getText()+" Password is "+lname.getText());
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("Jdbc:Odbc:Employe eDB");
String str0=id.getText();
[Code] ....
View Replies
View Related
Mar 27, 2015
I have a batch process which does Bulk UPDATE statement.
After implementing batch support using Spring JDBC 4.1.6 and Oracle Jdbc Driver (ojdbc7 and ucp), the number of records affected for individual update requests (in the batch) are always retrieved as -2 (Statement.SUCCESS_NO_INFO).
Is there any way to know the rows affected for individual cases, as I have to retry the same argument with an INSERT statement after this. Technically trying to develop this as an UPSERT implementation
I tried this batch update in Three Different Ways, and in all three methods the results are same -- (It just tells me Statement.SUCCESS_NO_INFO (-2) )
Method 1 -- Direct UCP Connection and PreparedStatement
connectionPoolMgr.startConnectionPool("mgr_pool");
Connection connection = pds.getConnection();
PreparedStatement pstmt = connection.prepareStatement(dmlSQL);
pstmt.setInt(1, pkId);
pstmt.setInt(2, idx * 10);
pstmt.addBatch();
[Code] .....
View Replies
View Related
Jun 25, 2015
What I have in my tnsnames.ora and verify it all works via sqlplus
CDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = cdb1)
[Code] ....
I am trying to get RJDBC to work so I can connect to Oracle from R doing some data analysis..
This connection string works for my local db which I have it running in my Virtual Box
con <- dbConnect(drv, "jdbc:oracle:thin:@//localhost:1521/orcl", "demo", "demo")
However, it does not work when I do it for the remote db that I really need to pull data from...
> con <- dbConnect(drv, "jdbc:oracle:thin:@//ymsdbppr-scan:1522/YMQCTPRD", "user_read", "user_read")
Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1], :
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12514, TNS: listener does not currently know of service requested in connect descriptor
View Replies
View Related
Feb 29, 2012
I am using a static initialization block to register the driver and a static synchronized method to get a connection. The problem is I need to run 15 threads but always only two threads get the connection. I want to know if there is a default maximum number of concurrent connections a DriverManager can provide or is it my threading logic that may be faulty.
CODE:
static {
try {
Class jdbcDriverClass = Class.forName( JDBC_DRIVER );
driver = (Driver) jdbcDriverClass.newInstance();
DriverManager.registerDriver( driver );
[Code] ....
View Replies
View Related
Feb 23, 2015
Trying to bind the value Double.POSITIVE_INFINITY in a prepared statement causes an IllegalArgumentException using ojdbc6 11.2.0.4.0 but it works fine in version 11.2.0.3.0:
Exception in thread "main" java.lang.IllegalArgumentException: Overflow
at oracle.jdbc.driver.OraclePreparedStatement.setDoubleInternal(OraclePreparedStatement.java:7605)
at oracle.jdbc.driver.OraclePreparedStatement.setDouble(OraclePreparedStatement.java:7513)
at
[Code]....
The database used is 'Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production'. I don't see any mention regarding changes to this in the 11.2.0.4.0 change log. Is this a bug in the driver or is there some other explanation?
View Replies
View Related
Apr 24, 2014
I created a database in mysql, but I have problems communicating with the DB in java.
Here is the error :
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/books
at java.sql.DriverManager.getConnection(DriverManager.java:604)
at java.sql.DriverManager.getConnection(DriverManager.java:221)
at displayauthors.DisplayAuthors.main(DisplayAuthors.java:30)
java.lang.NullPointerException
[Code] ....
HERE IS THE CODE
public class DisplayAuthors {
// database URL
static final String DATABASE_URL = "jdbc:mysql://localhost:3306/books";
// launch the application
public static void main( String args[] )
[Code] ....
View Replies
View Related
Aug 21, 2014
I have failed with all possibilities that I know to make this program success. Getting error as :
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Program goes like this.
import java.sql.*;
public class ExcelConnection {
public static void main (String[] args){
try {
Connection conn = getConnection("TEST.xls");
Statement stmt = conn.createStatement();
[Code] ....
View Replies
View Related
Mar 13, 2015
This question is not about syntax but a best way to handle something. What is the best way to store a image into a database? For example converting it into binary etc. I just wanted to get some opinions.
View Replies
View Related
Aug 27, 2014
I have a problem where i cant seem to get this simple delete command working. Everytime i run it it just locks the database and crashes
The id parameter exists in the database the database is small. Only a few tables. update commands work completely fine.
The id is an in and resulting command is - DELETE from Employees where ID = 2;
public static void EmployeeDeleteByID(int idIn){
Connection c = null;
Statement stmt = null;
try {
c = Connect();
c.setAutoCommit(false);
System.out.println("Opened database successfully");
[code]....
Error after running : java.sql.SQLException: database is locked
View Replies
View Related
Jan 15, 2015
I'm working on an application I made a few years ago. At that time I connected to a local database so my address was 'jdbc:mysql://localhost:3306/'. That database is long gone so I recreated it on one of my hosted servers but I'm a little unsure of how to connect to it. At the moment I'm trying "jdbc:mysql://www.mydomain.com:3306/" but it is giving me an access denied error.
java.sql.SQLException: Access denied for user 'myusername'@'c-[my-ip].hsd1.pa.comcast.net' (using password: YES)Every result on Google seems to use localhost so I'm having a little difficulty figuring out the correct format.
View Replies
View Related
Mar 19, 2014
i have a page where username is displayed...i want to uodate my table based on the page value i. e username..how can this be done
String sql;
sql = "UPDATE test SET username=? WHERE password=?";
PreparedStatement statement = conn.prepareStatement(sql);
statement.setString(1, "jumbomail@com");
statement.setString(2, "password");
View Replies
View Related
Dec 30, 2014
I am trying to connect to an oracle rac using jdbc thin . when i use the scan as the host, like this
String url = "jdbc:oracle:thin:@//<scan>:port/servicename;
I get error 1153, connection refused
but when i use the ip of the rac instead of the scan
String url = "jdbc:oracle:thin:@//<ip>:port/servicename;
The connection is successful
Is the issue at the application level? or is the problem with the server ....
View Replies
View Related
Jun 23, 2015
This the output of java from my PC under linux platform (rhel 6.5).
[pentaho@vertica-srv1 Downloads]$ java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
[Code] ....
But the problem is while trying to open ETL program under linux platform [pentaho@vertica-srv1 data-integration]$ ./spoon.sh .... I received the following error messages.
[pentaho@vertica-srv1 data-integration]$ ./spoon.sh
Trying to add database driver (JDBC): RmiJdbc.RJDriver - Warning, not in CLASSPATH?
Trying to add database driver (JDBC): jdbc.idbDriver - Warning, not in CLASSPATH?
Trying to add database driver (JDBC): org.gjt.mm.mysql.Driver - Warning, not in CLASSPATH?
Trying to add database driver (JDBC): com.mckoi.JDBCDriver - Warning, not in CLASSPATH?
[KnowledgeFlow] Loading properties and plugins...
View Replies
View Related
May 24, 2010
I have installed and configured Oracle Business Intelligence Applications on top of one demo eBS instance as a source. Now I would like to change the OLTP to a different eBS instance but am not sure which steps to take. I don't know if I can add new EBS connection pool and a new DataWarehouse Connection Pool in the administration and have old ones preserved or I need to overwrite the old ones? Or (ideally) can I just change the OLTP and overwrite the old DWH?
Any document supporting the process of changing the eBS OLTP database without new installation of the OBIAPPS?
View Replies
View Related