Can I pass a database connection using RMI?

Edward Harned

We assume you mean: java.sql.Connection from java.sql.DriverManager.getConnection(). The answer is that you cannot. You cannot pass a reference to something other than a RemoteObject() with RMI, only copies, (serializable), of data.

What you can pass are the data fields, (String, int, etc.), within the database after a Select.

So, in a GUI Client you can pass the parameters for a Select to the RMI Server. The Server can issue the SQL statements saving the fields in an object. The Server returns that object to the Client that displays the data.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact