[aprssig] Oracle connection ?
scott at opentrac.org
scott at opentrac.org
Thu Jun 23 10:56:13 EDT 2005
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
>
>
More information about the aprssig
mailing list