nalamati satyanarayana

Ranch Hand
+ Follow
since Dec 16, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by nalamati satyanarayana

I dnot have much idea on database so you guide me
7 years ago
I am planing to use JDBC
7 years ago
The overall business requirement is to develop a component that maintains pricing information on a set of parts. Parts are identified by an integer part number. The component needs to support two operations:

Setting the current price on a part
Getting the current price on a part

can you tell me how o define mode for this in java
7 years ago
Hi all,
I have one web application that will be running on tomcat web server and implemented couple of means those will be running as java service but here I want to establish communication between the tomcat websever and java service.
In existing architecture through mbeans we are communicating but I am planing to remove those mbeans threfore please suggest me any mechanism through spring to establish communication
10 years ago
Thanks for giving the clear details ,now I have got clear picture
10 years ago
Object class is root class for all classes ?
But in my above code even it null reference it showing all the methods of Object class
here my question is with out extend how it is possible to see the methods of object class?
10 years ago
Jesper,
Interfaces can extend the class?
10 years ago
Hi All,
java.lang.Object is a class or Interface
Here my question is if it is class for example I was created the interface like

In test main class through the reference variable i was able to access the Object class method like

As per the java standard interface cannot extend the class but here I am able to access Object class method.


10 years ago
I am facing the problem like I am reading the table relations from xml file for example tale 1 has reference to table2 and table 3 ,table 2 has reference 5and 6 similaru table3 has reference to 7 and 8 here i need to write the logic to insert the following order like first i need to insert table 1 then i need to insert table followed table 5 and 6 next table2 followed by 7 and 8 table here i written the logic like beloe
but it is not working

for (int i = 0; i < (dbprofile.getProfile("export").getTables().getTable()).size(); i++)
{
flag = false;
Table table = dbprofile.getProfile("export").getTables().getTable().get(i);
for (int cons = 0; cons < table.getConstraints().getConstraint().size(); cons++)
{
Constraint constraint = table.getConstraints().getConstraint().get(cons);
if (constraint.getReference() == null )
{
flag = true;
}
if (cons == table.getConstraints().getConstraint().size() - 1 && flag == true)
{
log.info("<<<<<< Table name : >>>>>>>>"+table.getName());
SQLOperations.dbimport(table);
if (tableIds == null)
{
tableIds = new StringBuilder();
tableIds.append(table.getId().toString());
} else
{
tableIds.append("," + table.getId().toString());
}
}
}// for cons
}// for i


canyone sujjest me
11 years ago

I am getting the followinh exception while committing the transaction
org.springframework.transaction.TransactionSystemException: Could not commit JDBC transaction; nested exception is java.sql.SQLException: I/O Error: DB server closed connection.
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCommit(DataSourceTransactionManager.java:270)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:374)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy4.importData(Unknown Source)
at com.intervoice.cc.tools.dbexport.TestSample.importData(TestSample.java:105)
at com.intervoice.cc.tools.dbexport.TestSample.main(TestSample.java:204)
Caused by: java.sql.SQLException: I/O Error: DB server closed connection.
at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1053)
at net.sourceforge.jtds.jdbc.TdsCore.submitSQL(TdsCore.java:899)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.commit(ConnectionJDBC2.java:2094)
at org.apache.commons.dbcp.DelegatingConnection.commit(DelegatingConnection.java:238)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.commit(PoolingDataSource.java:199)
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCommit(DataSourceTransactionManager.java:267)
... 11 more
Caused by: java.io.IOException: DB server closed connection.
at net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:848)
at net.sourceforge.jtds.jdbc.SharedSocket.sendNetPacket(SharedSocket.java:662)
at net.sourceforge.jtds.jdbc.RequestStream.putPacket(RequestStream.java:560)
at net.sourceforge.jtds.jdbc.RequestStream.flush(RequestStream.java:508)
at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1040)
... 16 more
2010-08-12 14:17:45,861 ERROR (TestSample.java:195) - Exception while executing the main class Could not commit JDBC transaction; nested exception is java.sql.SQLException: I/O Error: DB server closed connection.
11 years ago
I can use any of them ? tell me the which one is preferable?
Thanks
Now I have edited my message .
Please let me know if i need to improve more
Hi All,
I have a requirement like ,I need to export /import the data from database for that i will get one xml file and one propertie file
1. Table names properties file
2 . Table relation xml

For export i need to export the data to xml file so I have done this part using the following jdbc code but i want to convert this code hibernate and I want to know how to import this data dynamically using hiberante

public class DBTablesExport {
public void export(String filepath) throws SQLException {
Connection con = null;
Statement st = null;

try {
System.out.println("satya");
con = DBConnection.getConnection();

System.out.println("satya ssss");
st = con.createStatement();
PropsUtils props = new PropsUtils();
Properties prop = props.load("dbproperties.properties");
Set set = (Set) prop.keySet();
for (Iterator itr = set.iterator(); itr.hasNext();) {
String paramName = (String) itr.next();
System.out.println("satya paramName" + paramName);
ResultSet rs = st.executeQuery((String) prop
.getProperty(paramName));
ResultSetMetaData md = rs.getMetaData();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory
.newDocumentBuilder();
Document document = documentBuilder.newDocument();
Element rootElement = document.createElement(paramName);
document.appendChild(rootElement);

int col = md.getColumnCount();

while (rs.next()) {
String element = "row";
Element em = document.createElement(element);
for (int i = 1; i <= col; i++) {
String col_type = md.getColumnTypeName(i);
String col_name = md.getColumnName(i);
Element em1 = document.createElement(col_name);
if (col_type.equals("int")
|| col_type.equals("numeric")
|| col_type.equals("tinyint")) {

Integer iname = rs.getInt(i);
em1.appendChild(document.createTextNode(iname
.toString()));

} else if (col_type.equals("varchar")) {
String colData = rs.getString(i);
em1.appendChild(document.createTextNode(colData));
}
em.appendChild(em1);
}// for
rootElement.appendChild(em);

}// while
FileOutputStream fos = new FileOutputStream("C:/satya33.xml");
TransformerFactory transformerFactory = TransformerFactory
.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(fos);
transformer.transform(source, result);
}// for

}catch (Exception ex) {
ex.printStackTrace();
}

}
}



so Please help me out do this task
Hi All,
I have a requirement like ,I need to export /import the data from database for that i will get one xml file and one propertie file
1. Table names properties file
2 . Table relation xml

For export i need to export the data to xml file so I have done this part using the resultsetmetadata

But i did not get any solution to import these data

so Please help me out do this task