I have a plain Java application which is supposed to connect to the database. I don't want to store database connection url and username/password in a properties file or hardcode it in application. What is a common way to solve this problem? How a Java application can connect to database without revealing username/password?
...
I'm getting the error:
the multi-part identifier "IC.industry" could not be bound
when making this SQL query from a JSP page via JDBC:
select C.company, C.shname, C.fullname, count(d_to_c.designer)
from companies C
left join ind_to_c IC on C.company = IC.company
left join d_to_c on C.company= d_to_c.company
where IC.indust...
I am using JDBC to connect to a MySQL server (no connection pooling I think). In the connection URL I have autoReconnect=true
But my connection still times out. I've even checked conn.isClosed() and its false. But when I try to use the connection I get the following exception.
com.mysql.jdbc.CommunicationsException: Communications ...
Hi Im new to Applets and I am trying to set up a login applet that connects to my mySQL database.... It shows in Netbeans but not when I load it.... Can someone have a look and give back any suggestions?
P.S.Do I need to place my file in Tomcat?
/*
* To change this template, choose Tools | Templates
* and open the template in the edi...
I've got a simple stored procedure that does an insert to a table with an identity primary key column. I need to get the key that was generated by the insert. I would prefer to use the standard JDBC getGeneratedKeys method but I'm not sure what the stored procedure needs to do/return to build that result set. My end goal is to do this ...
I had a really huge problem recently which took me a lot of time to debug. I have an update statement which updates 32 columns in table. I did that with PreparedStatement. Accidentaly I deleted one setParameter() call so update could not be finished successfully.
I got exception from JDBC (Apache Derby) telling: "At leas one parameter ...
I have encountered a strange "Invalid Packet Lenght" (that is how the error is spelled) error when I run an automated bulk test on some of my Java code and I hope that someone has either encountered this error before or can point me in the right direction.
I do not encounter this error when testing my code via JUnit unit tests or from...
I'm trying to create a simple connection using the jdbc-odbc bridge:
public static Connection getConnection() {
Connection con =null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String conStr = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" +
"c:\\myfolder\\accesdbfile.ac...
I have the following query (column log is of type CLOB):
UPDATE table SET log=? where id=?
The query above works fine when using the setAsciiStream method to put a value longer than 4000 characters into the log column.
But instead of replacing the value, I want to append it, hence my query looks like this:
UPDATE table SET log=log||...
As part of upgrading JRun, we are moving from a 1.4 JVM to a 1.6 JVM. Now I am getting a really strange oracle db error: "OALL8 is in an inconsistent state". I have pinned down the problem to insert queries that do not use bind variables at all - all inline parameters. If I run the query without any bind variables, I get the above error....
I can't seem to get the right magic combination to make this work:
OracleDataSource ods = new oracle.jdbc.pool.OracleDataSource();
ods.setURL("jdbc:oracle:thin:app_user/pass@server:1521:sid");
DefaultContext conn = ods.getConnection();
CallableStatement st = conn.prepareCall("INSERT INTO tableA (some_id) VALUES (1) RETURNING ROWID INTO...
Oracle pads values in char columns so if I insert "a" in a CHAR(2) column then I cannot get that record by comparing that column to "a", I should get it by comparing it to "a ". Right?
To solve this problem the Oracle jdbc driver has the property fixedString but I cannot make it work. (look for fixedString here)
I'm using ojdbc14.jar d...
In Tomcat (and some other servlet containers) I can store information about my JDBC DataSource in META-INF/context.xml. This is very useful.
However, the settings for my JDBC DataSource can be different in my development and production environments. I'd like to know how other people deal with these differences in an elegant way, specifi...
With java.sql.ResultSet is there a way to get a column's name as a String by using the column's index? I had a look through the API doc but I can't find anything.
...
I am seeing the above error when running a small number of stored procs in our application. The actual error that we get is sqlcode=-930, which according to the db2 documentation is: 'There is not enough storage available to process the statement.'
Question: how can i increase the storage available to these procs? has anyone else enco...
There are two ways to load a driver:
Class.forName()
DriverManager.registerDriver()
Method 1 internally also calls DriverManager.registerDriver and method 1 is the preferred way.
But why? Is there any small difference or is performance etc. better?
Any views are appreciated..
...
Quick question what's the correct way to use ResultSet and PreparedStatement to access an ENUM field in MySQL?
...
Hello,
I have an scenario with two MySQL databases (in UTF-8), a Java code (a Timer Service) that synchronize both databases (reading form first of them and writing/updating to second) and a Web application that lets modify data loaded in the second database.
All database access are made using IBATIS (but I detect that I have the sam...
I recently migrated an older application we have at work from Java 1.5 to 1.6. I noticed that during the build, I now get a (new) compiler warning:
... DatabaseSession.java:[9,20] sun.jdbc.odbc.JdbcOdbcDriver is Sun proprietary API and may be removed in a future release
So I understand what that means, but is there a well-known alt...
I am work on a project in oracle 9i. I was having a problem with toplink 10.1.3 loading a particular row in a table. It turns out the jdbc driver that toplink is relying on is acting very funny. Perhaps someone here can help...
I have a table named: crazytable. It has a column: "ver_num number(19) not null default 0". This column w...