convert « SQL « Java Database Q&A

1. How to convert old data to a new system? using sql or managed code?

Let say a company are building a brand new application. The application are following the DDD principles. The old codebase has alot of products (or another "entity" for the company) that they ...

2. Convert java.util.List into java.sql.Array

How would you convert a java.util.List<String> instance into a java.sql.Array?

3. How to convert 08:48 PM time into SQL unixtime?

How do I convert 08:48 PM formatted string into SQL Unixtime? Java 1.5

4. How do I convert this sql string into an ibatis sql string?

My sql string looks like this. And What I'd like to do is change it into a format ibatis can use

SELECT distinct( dbo.vwChangeMgmt1.number ) 
  FROM dbo.vwChangeMgmt1, dbo.vwChangeMgmtTask1
 WHERE dbo.vwChangeMgmt1.Asgn_Group ...

5. Simpler CSV to SQL java file converter

Is there simpler way to convert CSV files to SQL file than this?:

BufferedReader input = new BufferedReader(new FileReader(new File("c:\\file.csv")));     
Writer output = new BufferedWriter(new FileWriter(new File("c:\\file.sql")));

try {

6. Java 6 - Mapping java.sql.Types to Java types

I'm looking for a link to a table with the mappings between SQL types (java.sql.Types) to Java types. Do you know where I can find one ?

7. SQL User Defined Java Function (Character conversion between CCSID 65535 and CCSID 1200 not valid)

I have been having a problem with an iSeries Function whereby it is not connverting data properly becuase my default user profile is using CCSID 65535. I can change the ...

8. Java converting a cell to string

I have the following Java code: (the parameters are the login data aswell as the query for the database)

public static String connectDB(String configFile, String query) throws FileNotFoundException, IOException, SQLException, ClassNotFoundException {

9. SQL to XML converters

10. SQL to XML conversion

Working on a project at the moment... I'm querying an Oracle DB, and I want to generate XML from my query result. Basicly im gonna get a very small table back as a result of my query of what is a large DB, but I want the XML to show the paths taken in the DB. ======================================== For example: QUERY RESULT: ...

12. java.sql.exception : Failed to Convert Internal Representation

Hi, Iam facing this strange problem after a got a new set of data. Its a SQL exception with message "Failed to convert internal representation", now what I could make out is that some part of the data is not compatible with my web application, may be jdbc is not able to take care of that particular data. The reason I ...

13. How to Convert type in sql or jasper i report

kaustubh sharma wrote:select case casedetails.[re-openindicator] when 1 then 'Yes' when 0 then 'No' else casedetails.[re-openindicator] end from casedetails If the bit is neither 0 not 1 (this will not happen but the SQL engine cannot see that) the returned column will still be of type bit. Instead of converting this into a varchar the "Yes" and "No" are attempted to be ...

14. string convert in to Sql ate format

15. how to convert ArrayListto sumthing that suite in sql

private void update(ArrayList list, int uid) { //count data in list int i; for (Iterator it = list.iterator(); it.hasNext();) { i++; } //convert ArrayList to Array String []list_result = new String[i]; list.toArray(list_result); try { Connection con=null; Class.forName ("com.mysql.jdbc.Driver").newInstance (); con= DriverManager.getConnection("jdbc:mysql://localhost/t-way","root",""); PreparedStatement ps = con.prepareStatement("UPDATE `input` SET `check`=1, `result`=? WHERE `check`=0 AND `userid`=?"); ps.setArray(1,list_result); ps.setInt(2,uid); ps.executeUpdate(); ps.close(); con.close(); } catch (Exception ...

16. iBatis error: Caused by: java.sql.SQLException: Fail to convert to internal representation

I got this exception in testing environment: Caused by: java.sql.SQLException: Fail to convert to internal representation at oracle.jdbc.driver.DatabaseError.throwSqlException( at oracle.jdbc.driver.DatabaseError.throwSqlException( at oracle.jdbc.driver.DatabaseError.throwSqlException( at oracle.jdbc.driver.CharCommonAccessor.getInt( at oracle.jdbc.driver.OracleResultSetImpl.getInt( at oracle.jdbc.driver.OracleResultSet.getInt( at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.getInt(Unknown Source) at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke( at java.lang.reflect.Method.invoke( at com.ibatis.common.jdbc.logging.ResultSetLogProxy.invoke( at $Proxy77.getInt(Unknown Source) at com.ibatis.sqlmap.engine.type.IntegerTypeHandler.getResult( at com.ibatis.sqlmap.engine.mapping.result.ResultMap.getPrimitiveResultMappingValue( at com.ibatis.sqlmap.engine.mapping.result.ResultMap.getResults( at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults( at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults( at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery( at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery( at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback( ... 96 ...

17. Convert SQL getDate to String.

I am trying to convert a date that I am pulling from a SQL database to a String. Some of the date fields are blank. How can I check to see if the date field is blank before trying to convert it to a string? When I try to convert a date from a result set, that was blank in the ...

18. Convert byte[] to java.sql.Bolb

19. Convert the Chinese in SQL_Latin1_General_CP1_CI_AS to UTF-8

An existing system written in ASP uses UTF-8 in Web page, and stores the data as SQL_Latin1_General_CP1_CI_AS in SQL Server 2000. It can display the chinese on web page properly. Now I am developing a Java programe to read the data from that system's database directly. What a pity, the chinese cannot display on the web page correctly. After trying convert ...

20. converting sql result objec to java

21. java.sql.SQLException: Fail to convert to internal representation

public static final ArrayList getInvDetails(User employee) throws Exception { ArrayList investDetails = new ArrayList(); String sql = "SELECT m.*, " +" aid.dec_amount, aid.act_amount, aid.rebate_amount, " +" CASE WHEN aid.inv_code IS NULL THEN 't' ELSE 'f' END AS new_record " +" from ana_inv_rate_map map, ana_inv_master m " +" LEFT OUTER JOIN ana_inv_details aid ON( " +" aid.inv_code = m.inv_code " +" AND ...

22. Converting String to java.sql.Time

23. Converting String to java.sql.Time