I swear I'm going insane.
JDeveloper runs my project with not a single complaint.
If I do "java -cp /usr/share/java/mysql.jar:. MAIN.java", it works like a charm.
But Eclipse says "[censored] you" and ignores my classpath settings.
I open the Run > Run... menu, and add the mysql jar in the classpath tab, but time and time again, I ke...
What is the best way to set up connection with mysql's jdbc?
And execute simple statement. How to do that?
Thank you.
...
Hi all,
I have an token class file in an jar file. The token class files is the class that uses jdbc to retrieve data from the database. However when I call the jar file it does not seem to recoginize the external mysql driver jar file.
The error is pointed to this line
Class.forName(driver);.
I have referenced the mysql driver in...
I've found numerous posts about reading CSV with Java and the APIs they were pointing at all had a line-oriented approach when it came to reading a CSV file. Something like "while you get a line, get the values of every column".
I'd appreciate a higher-level API, like in Perl where DBI allows you to use SQL on CSV like if it where a DB ...
I am working on a project that previously used Hibernate. Honestly, it seems like Hibernate complicates it more than JDBC would have. Also, it seems that a lot of the power of the relational database is lost. What are the advantages of using Hibernate over JDBC?
...
I'm running a query against a table in a postgresql database. The database is on a remote machine. The table has around 30 sub-tables using postgresql partitioning capability.
The query will return a large result set, something around 1.8 million rows.
In my code I use spring jdbc support, method JdbcTemplate.query, but my RowCallbackH...
We have a Prepared Statement in Java and we hear that it is different from Statement in the Way that this prepared statement need not be compiled every time it is used.
My question is where is this Compiled Statement stored ? In the Client code that uses it or is it stored by the Database ?
Why would a DB Store a Compiled statement and...
Does anyone have any information comparing performance characteristics of different ConnectionPool implementations?
Background: I have an application that runs db updates in background threads to a mysql instance on the same box. Using the Datasource com.mchange.v2.c3p0.ComboPooledDataSource would give us occasional SocketExceptions:
...
What is a Connection Object in JDBC ? How is this Connection maintained(I mean is it a Network connection) ? Are they TCP/IP Connections ? Why is it a costly operation to create a Connection every time ? Why do these connections become stale after sometime and I need to refresh the Pool ? Why can't I use one connection to execute multipl...
Hi,
I have a java application which is doing multiple concurrent CRUD operations on a database. I'm adding support for SQLServer but am having problems with deadlocking during concurrent deletes. After some investigation it appeared that the problem may be due to lock escalation on a particular table.
In an attempt to fix it, I decide...
I'd like to change the application information that is shown when inspecting
Oracle 10g sessions using the Oracle Enterprise Manager application:
Application Information
Program 'my program'
Module 'something'
Command UNKNOWN
I'm using the JDBC thin driver to connect, and I have to admit I'd rather not
use the OC...
I'm trying to determine the best way to ping a database via JDBC. By 'best' I mean fast and low overhead. For example, I've considered executing this:
"SELECT 1 FROM DUAL"
but I believe the DUAL table is Oracle-specific, and I need something more generic.
Note that Connection has an isClosed() method, but the javadoc states that this...
Is it possible somehow to create in-memory database in SQLite and then destroy it just by some query?
I need to do this for unit testing my db layer. So far I've only worked by creating normal SQLite db file and delete if after all tests, but doing it all in memory would be much better.
So is it possible to instanciate database only i...
Is there a general, cross RDMS, way I can have a key auto generated on a JDBC insert? For example if I have a table with a primary key, id, and an int value:
create table test (
id int not null,
myNum int null
)
and do an insert
PreparedStatement statement = connection.prepareStatement("insert into test(myNum) values(?)", Statem...
This one has me stumped.
I've got a java.sql.ResultSet and I'm pulling string values out of it like so:
address.setAddressLine1(rs.getString("AddressLine1"));
address.setAddressLine2(rs.getString("AddressLine2"));
When I debug and inspect rs.getString("AddressLine1"), the debugger says I've got a 30 character string: "ATTN: ACCOUNTS ...
Does DB2 UDB v6 supports JDBC Type 4 drivers?
Where can I get that JDBC Type 4 driver?
...
Hello,
I'm using JDBC to insert a row into a MYSQL database. I build a parameterized command, execute it and attempt to retrieve the auto generated keys as follows:
String sql = "INSERT IGNORE INTO `users` (`email`, `pass-hash`) VALUES (?, ?)";
Connection conn = SQLAccess.getConnection();
PreparedStatement ps = conn.prepareStatement(...
Hello,
I would like to connect to a clustered Oracle database described by this TNS:
MYDB=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host1)(PORT = 41521))
(ADDRESS = (PROTOCOL = TCP)(HOST = host2)(PORT = 41521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME= PDSALPO)
...
I have some Java code that accesses SQL Server 2005 which looks something like this:
CallableStatement cstmt = ...;
... // Set input parameters
cstmt.registerOutParameter(11, Types.INTEGER);
cstmt.execute();
int out = cstmt.getInt(11);
And the following exception is thrown from the last line:
com.microsoft.sqlserver.jdbc.SQLServerExc...
Is there any way of copying a database from oracle to sqlserver 2005? Thanks
...