Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Connecting Oracle to an AS3 server

 
Post new topic   Reply to topic Printable version
 View previous topic  isBase and Turf setup Post :: Post Restricting powers  View next topic  
Author Message
Animate Dreams
Gotta buy them all!
(Consumer whore)


Age:37
Gender:Gender:Male
Joined: May 01 2004
Posts: 821
Location: Middle Tennessee
Offline

PostPosted: Sun Dec 24, 2006 4:22 pm    Post subject: Connecting Oracle to an AS3 server Reply to topic Reply with quote

Some of you may know Sass, one of the many owners of Omega Fire. Anyway, by profession he works with databases, mainly Oracle, and what drew him to AS3 in the first place was the ability to connect to databases. We spent a bit of time trying to figure out how to re-code the existing mysql.c to see how easy it would be to connect to Oracle instead, but we were both confused. He doesn't know enough about AS3 and C, I guess, and I don't know enough about any of it to figure it out. Anyway, long story short, we'd like to connect to an Oracle database and we don't know how.

The only real leads we've gotten are sqlda.h and sqlcpr.h. We found a couple programs that connected using only those includes(apart from normal ones like stdio.h). But we're still having problems. Take this for example:

Code: Show/Hide
/* --------------------------------------------------------------------------
logon to ORACLE, and open the cursors. The program exits if any errors occur.
-------------------------------------------------------------------------- */

  strcpy((char *)uid.arr,"SCOTT");
  uid.len = (short) strlen((char *)uid.arr);
  strcpy((char *)pwd.arr,"TIGER");
  pwd.len = (short) strlen((char *)pwd.arr);

  EXEC SQL WHENEVER SQLERROR GOTO errexit;
  EXEC SQL CONNECT :uid IDENTIFIED BY :pwd;


This seems to be the important part, the connection. Things like pwd and uid were pre-defined. This part makes sense to Sass, but it's not enough... like, where's host? Does it assume localhost? And port? I couldn't even find the port for the mysql.c module, for that matter. Anyone wanna help me there?

Anyway, if any of you happen to have any experience in this and can clue us in on how to connect, that would be great. As for the rest of the module, I'm hoping we can manage to copy over existing functions from the mysql.c module to a new connection module, maybe even close enough that other modules that used the database wouldn't have to be re-coded. I guess we'll have to see about that later.

Also, if I sound really confused in this post, it's because I am. Any help would definitely be appreciated.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Mon Dec 25, 2006 7:29 am    Post subject: Reply to topic Reply with quote

That exec stuff doesn't look like C, is it some kind of macro? And if it's meant to be a query string then you will need some special API function to pass in uid/pwd since they are some kind of special struct (infact it looks like maybe they are C++ classes).

Something like:
oracle_query("EXEC SQL CONNECT %s IDENTIFIED BY %s", uid, pwd);
_________________
ss news
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Mon Dec 25, 2006 2:00 pm    Post subject: Reply to topic Reply with quote

I took a look at the Oracle site most of their examples I believe were in C++ even though they refer to having C API calls. Good luck! icon_smile.gif
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
Animate Dreams
Gotta buy them all!
(Consumer whore)


Age:37
Gender:Gender:Male
Joined: May 01 2004
Posts: 821
Location: Middle Tennessee
Offline

PostPosted: Mon Dec 25, 2006 8:29 pm    Post subject: Reply to topic Reply with quote

Actually, Smong, I just figured out what that stuff is. It has to do with Pro*C, a "pre-compiler" I keep seeing on Oracle sites. Apparently it does this

"An Oracle Precompiler is a programming tool that enables the user to embed SQL statements in a high-level source program. As Figure 1-1 shows, the precompiler accepts the source program as input, translates the embedded SQL statements into standard Oracle runtime library calls, and generates a modified source program that you can compile, link, and execute in the usual way."

Which is cool. That was the main thing I wasn't understanding... I kept reading code, and I kept seeing all these SQL statements, and I have no idea how SQL is normally embedded in programs, so I thought it was natural... but nothing I was doing was working. Now I know I need to get a Pro*C pre-compiler. Wherever that is.

Now my problem is just being a Linux noob, it takes me forever to figure out where things are installed. I'm pretty sure Pro*C is already installed, and it would logically follow that I can call it with a command. I'll look into this later. It's Christmas.

Once I get connectivity figured out, I'll probably have to ask a few questions about the mysql module. Like, where is the port defined? Does the module assume the default mysql port? If so, where does it do it? In the code I mean. What line?
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 1621 page(s) served in previous 5 minutes.

phpBB Created this page in 8.131577 seconds : 28 queries executed (99.1%): GZIP compression disabled