|
From: Brian W. <bwe...@xb...> - 2006-10-26 18:02:03
|
On Thu, 26 Oct 2006, Sreenivasa Mulakala wrote:
> I am having trouble in adding a row to DNS which is BIND 9.2.5.
>
> I am able to ping the server.
>
> When I run the program which is below. Nothing goes on to wire atleast. The
> code is not contacting the server for update or add.
>
> Could you please advice me on what could be wrong.
>
> Thanks & Regards
> Sri
>
> System.setProperty("sun.net.spi.nameservice.nameservers","192.168.2.3");
> System.setProperty("sun.net.spi.nameservice.provider.1", "dns,sun");
> System.setProperty("sun.net.spi.nameservice.provider.2", "dns,dnsjava");
>
>
>
> public Record addDNSEntry(String zone, int dnsClass, long ttl, String
> ipAddress ){
> String = "ool-18bbc301.arpa.net."
>
> Message msg = new Message();
> Record record = null;
>
> try{
> System.out.println("Trying to update the record");
>
> byte[] ipaddressbytearray = Address.toByteArray("195.187.24.1",
> Address.IPv4);
>
>
> record = Record.newRecord(new Name(zone), Type.A, DClass.IN, ttl,
> ipaddressbytearray.length, ipaddressbytearray);
>
> msg.addRecord(record,Section.ADDITIONAL);
> log.info("The Entry is updated");
> }catch(TextParseException tpe){
> log.error(" OOOPs In TextParseException of add DNS entry : ");
> log.error(tpe.getMessage());
> }catch(Exception ioe){
> log.error("OOPS In Exception of add DNS entry : ");
> log.error(ioe.getMessage());
> }
> return record;
> }
You're building a message and never sending it. See the example of using
dynamic update at http://www.dnsjava.org/examples.html.
Brian
|