VB.Net app connection to Apache Derby DB?

Discussion in 'General Software Discussion' started by WxMan1, May 22, 2014.

  1. WxMan1

    WxMan1 Active Member

    Joined:
    Dec 26, 2007
    Messages:
    307
    Likes Received:
    11
    Trophy Points:
    28
    Is it possible to connect to Apache Derby DB - Java - w/ in VB.Net application?

    From what I understand there is mechanics to connect to various vendor specific-DB w/ in Java app. To implement such, ODBC, JDBC & JDBC/ODBC-bridge technology is implemented (the latter strongly frowned upon).

    I'd appreciate being able to interface to Apache Derby DB w/in a compiled VB.Net - VS 2008 IDE - app; Derby is free and SQL Server is not. I'd rather code for SQL query rather than invent RDBMS from scratch (that's just me I'd bet).

    :confused:
     
  2. RealityRipple

    RealityRipple Embrace Entropy

    Joined:
    Nov 13, 2007
    Messages:
    437
    Likes Received:
    51
    Trophy Points:
    38
  3. WxMan1

    WxMan1 Active Member

    Joined:
    Dec 26, 2007
    Messages:
    307
    Likes Received:
    11
    Trophy Points:
    28
    Ooooh. Me likey. Mayhaps offer an option, despite the description intimating merely reading Derby DB. I'll have to investigate this for SELECT functionality. If it'll do that, then INSERT shouldn't be a prollem, eh? Unless its doing a flat file read, then it must implement DSN or connection string in some ODBC / JDBC context.

    However its .NET 4.5 dependent. I'm unclear if .NET post-v3.5 be implemented in VS2008 Pro IDE?

    Worst case: I just may have to buck up and write the app in Java. Its not terribly complicated, just 6 input fields - 4 of which are IP address octet of data type 'byte', the 5th is a CIDR 0> value < 25, and a description field - the app merely has to check if any arbitrary IP address lives w/ in defined IP v4 CIDR range, and if not allow entry of such into DB.

    Pice of caeke. It'll prove to be a useful tool to maintain FW rules implementing application shared IP address for CDN / edge cache access grouped by internet 'zone'.
     
  4. WxMan1

    WxMan1 Active Member

    Joined:
    Dec 26, 2007
    Messages:
    307
    Likes Received:
    11
    Trophy Points:
    28
    After some investigation and evaluation of alternatives, I've decided to implement serialized Dataset and Dataset record object classes. I took one look at this:

    http://bitmugger.blogspot.com/2011/02/how-to-convert-cidr-ip-address-to-range.html

    and crawled screaming into the fetal position and ran home to Mommy, i.e.,

    private bool IsInSubnet (string ipAddress, string cidr) {

    string [] parts = cidr.Split ('/');

    int baseAddress = BitConverter.ToInt32 (IPAddress.Parse (parts [0]).GetAddressBytes (), 0);

    int address = BitConverter.ToInt32 (IPAddress.Parse (ipAddress).GetAddressBytes (), 0);

    int mask = IPAddress.HostToNetworkOrder (-1 << (32 - int.Parse (parts [1])));

    return ((baseAddress & mask) == (address & mask));

    C'mon, its 4 bytes + netmask, i.e., CIDR, and a domain name description. That's just crazy talk in SQL.
     

Share This Page

visited