Hi All
I have an Java server and a .net client:
Connecting works fine, but when I try to save an object and open the
file with the Objectmanager, I can see no stored objects. What is wrong
with my code? Please support me in solving the issue,am struggling for quite a long time now :)...
Server:
import java.io.*;
import com.db4o.*;
public class RunServer implements Runnable {
private boolean stop = false;
public void run() {
synchronized (this) {
ObjectServer server = Db4o.openServer("c:/netserver.yap", 8732);
server.grantAccess("user1", "password");
server.grantAccess("user2", "password");
try {
// stop condition will be defined in a later example
while (!stop) {
System.out.println("SERVER:[" + System.currentTimeMillis()
+ "] Server's running... ");
this.wait(60000);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
server.close();
}
}
}
public static void main(String[] args) {
Thread s = new Thread(new RunServer(),"server");
s.setPriority(Thread.MAX_PRIORITY);
s.start();
}
}
Client:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using com.db4o;
using System.IO;
using Db4objects.Db4o;
using System.Threading;
namespace com.db4o.dg2db4o.chapter8
{
public partial class AddClient : Form
{
private Db4objects.Db4o.IObjectContainer aClient;
private bool stop = false;
public AddClient()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
aClient = Db4objects.Db4o.Db4oFactory.OpenClient("192.168.1.3", 8732, "user1", "password");
// label1.Text="ADDCLIENT: Please enter a name: ";
// String name = textBox1.Text;
// label2.Text="ADDCLIENT: Please enter an age: ";
// int age = Convert.ToInt32(textBox2.Text);
aClient.Set(new Person("abc", 32));
aClient.Commit();
// aClient.Close();
MessageBox.Show("Done");
}
}
}