[aprssig] Oracle connection ?
scott at opentrac.org scott at opentrac.orgThu Jun 23 14:56:13 UTC 2005
- Previous message: [aprssig] Oracle connection ?
- Next message: [aprssig] Oracle connection ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'd also suggest using bind variables if possible. Generating a SQL statement dynamically (e.g. sql = "select * from table where x = '" & xyz & "'") can be a security risk if not done right, and even if you're executing the same query a million times with different values it's still got to parse the statement every time. If you can use bind variables (e.g. xyz = "foo"; sql = "select * from table where x = &xyz") then Oracle will be able to cache the parsed statement and can process it faster. The exact details of how to do it vary depending on the language and interface mechanism you're using. I'd imagine it's possible in JDBC, but I don't do much Java myself. If you want a starting point, I'll see if I can find the source code for my Windows service. Scott N1VG > -----Original Message----- > From: aprssig-bounces at lists.tapr.org > [mailto:aprssig-bounces at lists.tapr.org] On Behalf Of Gregg Wonderly > Sent: Thursday, June 23, 2005 7:43 AM > To: TAPR APRS Mailing List > Subject: Re: [aprssig] Oracle connection ? > > >I have the opportunity to place aprs data on an oracle database. > > > >anyone had experience developing access mechanisms to > connect to oracle > >? > > >3) Java > > Andy, the JDBC interface in Java is straight forward to use. > If you need some help, I can give you some code, and make > some suggestions. The place to start is > > Connection c = java.sql.DriverManager.getConnection( ... > connection parms ... ); Statement stmt = c.getStatement(); try { > int val = stmt.executeUpdate( "insert into <table> > (...) values (...)"); } finally { > stmt.close(); > } > > and for queries, > > try { > ResultSet rs = stmt.executeQuery( "select f1,f2,f3 from > <table> where ..."); > try { > while( rs.next() ) { > String f1 = rs.getString("f1"); > double f2 = rs.getDouble("f2"); > ... do something with the queried data ... > } > } finally { > rs.close(); > } > } finally { > stmt.close(); > } > > Gregg Wonderly > > _______________________________________________ > aprssig mailing list > aprssig at lists.tapr.org > https://lists.tapr.org/cgi-bin/mailman/listinfo/aprssig > >
- Previous message: [aprssig] Oracle connection ?
- Next message: [aprssig] Oracle connection ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the aprssig mailing list
