Created
April 1, 2018 13:52
-
-
Save turbo/45c988086f3646da510692729b879b0b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using java.lang; | |
using java.sql; | |
namespace cdb2cs | |
{ | |
internal static class Program | |
{ | |
// Force type reference. Otherwise, the class will not be loaded. | |
// cdb2jdbc also doesn't offer an EmbeddedDriver, which would make this | |
// easier. | |
private static readonly Type foobar = typeof(com.bloomberg.comdb2.jdbc.Driver); | |
public static void Main() | |
{ | |
Class.forName("com.bloomberg.comdb2.jdbc.Driver"); | |
var conn = DriverManager.getConnection("jdbc:comdb2://localhost/testdb"); | |
var stmt = conn.createStatement(); | |
var rs = stmt.executeQuery("SELECT 1+1 as \"math\""); | |
while (rs.next()) | |
{ | |
Console.WriteLine($"Result is {rs.getInt(1)}\n"); | |
} | |
rs.close(); | |
stmt.close(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment