简体   繁体   English

使用TCP / IP的Java客户端服务器程序

[英]Java client server program using tcp/ip

Im writing a client server java program using TCP/IP stream and my server connects to oracle database. 我使用TCP / IP流编写了一个客户端服务器java程序,并且我的服务器连接到oracle数据库。 when client request some information, the server process the query ie returns a column with some rows( say 5). 当客户端请求一些信息时,服务器将处理查询,即返回包含一些行的列(例如5)。 i want to send this entire column back to client, i am able to send and receive single line of data, but not multiple lines( as a table contains many rows i,e lines)....any help is appericated 我想将整列发送回客户端,我能够发送和接收单行数据,但不能发送多行(因为一个表包含很多行,即行)....任何帮助都适用

您可以填充集合对象并返回该对象

You can serialize you database query result into a string that does not contain line breaks. 您可以将数据库查询结果序列化为不包含换行符的字符串。 More over, you can use a well-defined data format, such as JSON . 此外,您可以使用定义良好的数据格式,例如JSON

I don't believe that Oracle database returns a data to your server side app in a string representation. 我认为Oracle数据库不会以字符串表示形式将数据返回到服务器端应用程序。 Inside your server program, you actually get some database object (possibly, JDBC, if it's Java). 在服务器程序内部,您实际上得到了一些数据库对象(如果是Java,则可能是JDBC)。 How do you turn this object into a string is up to you. 如何将这个对象转换为字符串取决于您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM