Getting Weave to work in SQL

Hey all,
I am aware this might not be the right forum, but it kinda didnt fit in anywhere else.
I did run an old weave-server setup before FireFox 5, and with FF5 came the mandatory Weave-Server upgrade. The new weave server is as usual a royal pain in the b*tt, and trying to fix it made my day.
So far I installed it according to http://docs.services.mozilla.com/howtos/run-sync.html and got it to at least install all the stuff it needed*.
My vhost config:
[code]
<VirtualHost *:8989>
ServerName weave.xxx.com
DocumentRoot /usr/home/chris/public_html/weave
WSGIProcessGroup chris
WSGIDaemonProcess chris user=chris group=chris processes=2 threads=25
WSGIPassAuthorization On
WSGIScriptAlias / /usr/home/chris/public_html/weave/sync.wsgi
ErrorLog /var/log/httpd/xxx/weave-error.log
CustomLog /var/log/httpd/xxx/weave-access.log combined
SSLEngine on
SSLCertificateFile /usr/local/certs/weave.xxx.crt
SSLCertificateKeyFile /usr/local/certs/weave.xxx.pem
SetEnvIf SuexecUserGroup-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>
[/code]
my weave-config:
[code]
[captcha]
use = false
public_key = abcd-abcd
private_key = abcd-abcd
use_ssl = false
[storage]
backend = sql
sqluri = mysql://yyy:xxx@localhost:3306/weave
standard_collections = false
use_quota = false
quota_size = 5120
pool_size = 100
pool_recycle = 3600
reset_on_return = true
display_config = true
create_tables = true
[auth]
backend = sql
sqluri = mysql://yyy:xxx@localhost:3306/weave
pool_size = 100
pool_recycle = 3600
create_tables = true
[smtp]
host = localhost
port = 25
sender = [email protected]
[cef]
use = true
file = syslog
vendor = mozilla
version = 0
device_version = 1.3
product = weave
[/code]
the error uppon visiting the page in a browser or running it directly with python:
[code]
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] mod_wsgi (pid=83916): Target WSGI script '/usr/home/chris/public_html/weave/sync.wsgi' cannot be loaded as Python module.
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] mod_wsgi (pid=83916): Exception occurred processing WSGI script '/usr/home/chris/public_html/weave/sync.wsgi'.
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] Traceback (most recent call last):
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] File "/usr/home/chris/public_html/weave/sync.wsgi", line 39, in <module>
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] application = loadapp('config:%s'% ini_file)
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] File "/usr/home/chris/public_html/weave/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 247, in loadapp
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] return loadobj(APP, uri, name=name, **kw)
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] File "/usr/home/chris/public_html/weave/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 272, in loadobj
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] return context.create()
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] File "/usr/home/chris/public_html/weave/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 710, in create
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] return self.object_type.invoke(self)
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] File "/usr/home/chris/public_html/weave/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 146, in invoke
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] return fix_call(context.object, context.global_conf, **context.local_conf)
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] File "/usr/home/chris/public_html/weave/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/util.py", line 56, in fix_call
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] val = callable(*args, **kw)
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] File "/usr/home/chris/public_html/weave/deps/server-core/services/baseapp.py", line 280, in make_app
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] app = klass(urls, controllers, params, auth_class)
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] File "/usr/home/chris/public_html/weave/deps/server-storage/syncstorage/wsgiapp.py", line 101, in __init__
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] auth_class)
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] File "/usr/home/chris/public_html/weave/deps/server-core/services/baseapp.py", line 82, in __init__
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] self.auth = None if auth_class is None else auth_class(self.config)
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] File "/usr/home/chris/public_html/weave/deps/server-core/services/wsgiauth.py", line 53, in __init__
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] self.backend = get_auth(self.config)
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] File "/usr/home/chris/public_html/weave/deps/server-core/services/auth/__init__.py", line 261, in get_auth
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] return ServicesAuth.get_from_config(config)
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] File "/usr/home/chris/public_html/weave/deps/server-core/services/pluginreg.py", line 134, in get_from_config
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] klass = cls._get_backend_class(params['backend'])
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] File "/usr/home/chris/public_html/weave/deps/server-core/services/pluginreg.py", line 122, in _get_backend_class
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] raise KeyError(msg)
[Thu Jun 23 17:51:21 2011] [error] [client 91.2.190.136] KeyError: "Unknown fully qualified name for the backend: 'sql'"
[/code]
Software info:
[code]
apache-2.2.19 Version 2.2.x of Apache web server with prefork MPM.
mysql-client-5.5.13 Multithreaded SQL database (client)
mysql-server-5.5.13 Multithreaded SQL database (server)
python27-2.7.1_1 An interpreted object-oriented programming language
mercurial-1.8.2 A fast, lightweight source control management system
[/code]
Running FreeBSD 8.1 on x64.
Thats all the info I can think off. I have no clue on how to proceed, i even took the source apart*.
Thanks for a push in the right direction,
Chris
* = This portion of the post had its truth enhanced so sound more legit. "Reality" and the "truth" might vary.

Check this blog entry: http://tobyelliott.wordpress.com/2011/06/22/fixing-the-python-config-file-if-youre-getting-server-errors/
This should fix your issue
Also, I have added a troubleshooting section in the how-to at http://docs.services.mozilla.com/howtos/run-sync.html#troubleshooting

Similar Messages

  • Code insight not working in sql developer 1.1.0.23

    i just downloaded today. insight options all checked in preferences section. popup time set to less than a second. i get nothing to work in sql worksheet or while modifying a package body.

    Hello,
    You should see things from this side sometimes ;-) It's a small team, working hard, very focused! Yes, there is indeed a sense of urgency and we are testing a patch SQL Developer 1.1 at the moment. There is always the battle between wanting to get an updated release to you, the community, quickly, and delaying to ensure what you get is good.
    Code insight, performance and many other issues have been addressed in this patch.
    As for your other point, we want the tool to be lightweight, easy to install, easy to use with a clear user interface. Perhaps there'll be a new battle when adding features, but that's the goal.
    Regards
    Sue

  • Distributed transaction using linked server not working in SQL Server 2008 64 bit

    Hi. I have had an issue trying to get distributed transactions to work in SQL Server 2008 using a linked server. The error message I get is
    OLE DB provider "SQLNCLI10" for linked server "pod1" returned message "No transaction is active.".
    Msg 7391, Level 16, State 2, Line 3
    The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "pod1" was unable to begin a distributed transaction.
    My Environment:
    Windows Server 2008 Enterprise 64 bit, SQL Server 2008 Enterprise 64 bit
    Problem occurs with multiple different builds of SQL Server 2008 - I have been able to reproduce the problem with 10.0.1600.0, 10.0.1779.0 (CU 2), as well as 10.0.2531 (SP1)
    I am aware that other people have had this issue and have reviewed all existing posts. I have verified that the MSDTC is configured correctly on both machines. I have also used DTCTester to verify that DTC is working correctly on all machines in question.
    None of the mentioned resolutions has solved this problem for me.
    I am not seeing this problem occur on my 32 bit test machines - it is only occurring if at least one of the two machines is 64 bit.

    Hi All,
    I realise that this topic may be a little bit out-of-date but if someone gets here from some search engine trying to find a solution for DTC problems, this MAY be useful.
    So... I recently had the same issue, tried all the approaches described in KB and other articles, but it didn't help. Because my task to solve this was not of the highest priority I forgot about it for some time.
    Today I was troubleshooting some other issue and, by accident discovered source of that first problem:
    In the EventViewer I found Error entry logged by MSDTC saying:
    "The local MS DTC detected that the MS DTC on vm-server1 (other machine name that also runs DTC - my comment) has the same unique identity as the local MS DTC. This means that the two MS DTC will not be able to communicate
    with each other. This problem typically occurs if one of the systems were cloned using unsupported cloning tools. MS DTC requires that the systems be cloned using supported cloning tools such as SYSPREP. Running 'msdtc -uninstall' and then 'msdtc -install'
    from the command prompt will fix the problem. Note: Running 'msdtc -uninstall' will result in the system losing all MS DTC configuration information."
    So I followed suggestion and run:
    msdtc -uninstall
    msdtc -install
    This solved my problems with DTC. Hope it will help someone.
    Piotr

  • Transact-SQL debugger not working in SQL Server 2008: "...debugger does not support SQL Server 2005 or earlier..."

    I have recently installed SQL Server 2008. When I try to execute a query against an Access database, I receive this debugging error:
    "Unable to start Transact-SQL debugger. The Transact-SQL debugger does not support SQL Server 2005 or earlier versions of SQL Server. (SQLEditors)"
    Nor will the query execute; I get a transport-level error 0. Any thoughts?

    Hi Davidmhjr,
    >>Unable to start the Transact-SQL Debugger. The Transact-SQL Debugger does not support SQL Server 2005 or earlier versions of SQL Server. (SQLEditors).
    Have you tried to restart the server once you have installed SQL Server 2008? As Naomi N mentioned please check the version of SQL Server you are using.
    If you tried to connect to SQL Server 2005 from SQL Server 2008 SSMS, you would not be able to debug and get this error, it happens because T-SQL debugger includes both server-side and client-side components. The server-side debugger components are installed
    with each instance of the SQL Server 2008 Database Engine. The client-side components are installed when you install the SQL Server 2008 client-side tools.
    So it works with SQL Server 2008 only so far. Another way is you can triy to use SQL Server 2005 SSMS to connect to SQL Server 2005.
    More information about configuration requirement to run T-SQL debugger as below, please refer:
    There are no configuration requirements to run the Transact-SQL debugger when SQL Server Management Studio is running on the same computer as the instance of the SQL Server Database Engine. However, to run the Transact-SQL debugger when SQL Server Management
    Studio is running on a different computer from the instance of the Database Engine, you must enable program and port exceptions by using the Windows Firewall Control Panel application on both computers.
    On the computer that is running the instance of the Database Engine, in Windows Firewall, specify the following information:
    •Add TCP port 135 to the exceptions list.
    •Add the program sqlservr.exe to the exceptions list. By default, sqlservr.exe is installed in C:\Program Files\Microsoft SQL Server\MSSQL10.InstanceName\MSSQL\Binn, where InstanceName is MSSQLSERVER for the default instance, and the instance name for
    any named instance.
    •If the domain policy requires network communications to be done through IPsec, you must also add UDP port 4500 and UDP port 500 to the exception list.
    On the computer that is running SQL Server Management Studio, in Windows Firewall, specify the following information:
    •Add TCP port 135 to the exceptions list.
    •Add program ssms.exe (SQL Server Management Studio) to the exceptions list. By default, ssms.exe is installed in C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE.
    Hope it is helpful.
    Regards, Amber zhang

  • How to get currency format using pl sql function

    Hi all,
    I am a newbee on the forum. currently i am facing an issue with the Format of Currency in an rdf report. This is a field of tax amount & i need to make some conditional formatting on this like if the tax amount is Zero then some static note is to be added before this field.
    I have tried a lot of functions on it like the one as below:
    IF :cp_org_id = 102
    AND :invoice_currency_code <> 'CAD'
    AND TO_CHAR (NVL (:cf_tax_amount, 0)) = 0
    THEN
    RETURN (TRUE);
    ELSE
    RETURN (FALSE);
    This is working fine in case of Zero tax amount But gets error out when there some Tax amount exists. It gives a VALUE ERROR in this format Trigger.
    Kindly suggest me how to solve this issue with right function. If possible then write the pseudo Code also.
    Thanks in advance
    D_Verma

    In addition to Satyaki:
    It might be a 'Reports Thing'.
    It works in SQL*Plus (although relying on implicit conversions is a bad idea, as mentioned):
    MHO%xe> begin
      2  IF 102 = 102
      3  AND 'DAC' != 'CAD'
      4  AND TO_CHAR (NVL (null, 0)) = 0
      5  THEN
      6  dbms_output.put_line('TRUE');
      7  ELSE
      8  dbms_output.put_line('FALSE');
      9  end if;
    10  end;
    11  /
    TRUE
    PL/SQL-procedure is geslaagd.
    MHO%xe> begin
      2  IF 102 = 102
      3  AND 'DAC' != 'CAD'
      4  AND TO_CHAR (NVL (0, 0)) = 0
      5  THEN
      6  dbms_output.put_line('TRUE');
      7  ELSE
      8  dbms_output.put_line('FALSE');
      9  end if;
    10  end;
    11  /
    TRUE
    PL/SQL-procedure is geslaagd.
    MHO%xe> begin
      2  IF 102 = 102
      3  AND 'DAC' != 'CAD'
      4  AND TO_CHAR (NVL ('0', '0')) = '0'
      5  THEN
      6  dbms_output.put_line('TRUE');
      7  ELSE
      8  dbms_output.put_line('FALSE');
      9  end if;
    10  end;
    11  /
    TRUE
    PL/SQL-procedure is geslaagd.

  • File- Print not working from SQL Developer 1.2.1 Build MAIN-32.13

    File->Print not working from SQL Developer 1.2.1 Build MAIN-32.13.
    I downloaded sqldeveloper-1.2.1.3213.ZIP and extract to a local directory. From the extracted directory I ran ..\sqldeveloper\sqldeveloper.exe from Windows XP sp2. The program itself seems to run just fine but File-Print doesn't do anything. In Help-About, Java Platform is reported as 1.5.0_06 and Oracle IDE is 1.2.1.3213. I'm not sure where to look for what is causing the problem.
    Thanks

    I hadn't tried CTRL-P before but I did today. On the first attempt, I saw a small jump in the memory usage for sqldeveloper.exe as reported in Windows Task Manager. Otherwise, there was no change. A second CTRL-P in the same session produced a further bump but subsequent attempts in the same session produced no further change in CPU or Memory Usage.
    Using Task Manager to monitor this further, I tried File->Print again and saw that sqldeveloper would periodically climb to 1 or 2 percent CPU and consume a little more memory. After a minute or so, though, all activity stops again.
    I do not get a print dialog box from SQLDeveloper using either CTRL-P or File->Print

  • Enter key doesnt work in SQL developer

    enter key doesnt work in sql developer so cant creat new line in code.
    enter key works fine when use word etc
    Can I fix this in the SQL developer settings somewhere.?
    thanks in advance.

    Hi Sue,
    Just to let you know, your solution worked... My SQL Developer got into a state again where the backspace key stopped working... doing 'load preset, default' on the accelerators did fix it. Strange, because I don't use/configure the accelerators at all. Thanks for that, and hopefully this will be permanently fixed in the next version.
    To echo what I think someone else was trying to say... I also have the issue that sql developer will 'lock up' or get bogged down sometimes, when i'm just typing away in the worksheet. Any keystrokes I entered in though will always get entered into the worksheet, once sqldeveloper 'unfreezes' itself. Of course, this issue is an annoyance factor only (little bit of impact on productivity though), but hopefully it gets fixed as well.

  • Have working PL/SQL, need to create a PDF

    I am a newbie to Oracle Reports, and I need to generate a report that is beyond the basic reports scenario. I am having no luck with the GUI or web editor (I can't even get anchors and expandable sections to work), but I have a working PL/SQL routine that writes the output to html and does everything I want except to format the data in a .PDF file and make the output available via a URL. Oracle Reports did a great job of formatting the original version of what we need, but the few modifications are not so simple with reports.
    Old simple scheme:
    Group info item 1
    Group info item 2
    [Table of entries for this group]
    new page in PDF if more groups...
    New scheme:
    Group info item 1
    Group info item 2
    boilerplate text.....
    SQL query based on this group item 1
    more boilerplate text...
    [Table of entries for this group]
    more boilerplate text
    new page in PDF if more groups...
    What is the best approach for getting Oracle Reports to use what I already have in PL/SQL (cursors, etc.)?
    Thanks for any suggestions!

    You may re-use your working pl/sql code to populate global temporary tables from AfterParameterForm trigger and write a simple RDF to read data from those tables.

  • Merge Into works in SQL, fails in PL/SQL

    Database is 9i (Oracle9i Enterprise Edition Release 9.2.0.5.0)<br>
    <br>
    The 9i documentation--PL/SQL User's Guide and Reference
    Release 2 (9.2)--makes it seem like this is part of the PL/SQL language, but the compiler disagrees.<br>
    <br>
    Anyone else encounter this?<br>
    <br>
    Test case:<br>
    create table kev(d date, n number);<br><br>
    Table created.<br>
    <br>
    ..it works in SQL...<br>
    MERGE INTO kev k<br>2 USING ( SELECT 1 n, sysdate d from dual ) s<br>
    3 ON ( k.n = s.n )<br>
    4 WHEN MATCHED THEN<br>
    5 UPDATE<br>
    6 SET k.d = s.d<br>
    7 WHEN NOT MATCHED THEN<br>
    8 INSERT (n,d)<br>
    9 VALUES (s.n, s.d);<br>
    <br>
    1 row merged.<br>
    <br>
    ..but not in PL/SQL...<br>
    begin<br>2 MERGE INTO kev k<br>
    3 USING ( SELECT 1 n, sysdate d from dual ) s<br>
    4 ON ( k.n = s.n )<br>
    5 WHEN MATCHED THEN<br>
    6 UPDATE<br>
    7 SET k.d = s.d<br>
    8 WHEN NOT MATCHED THEN<br>
    9 INSERT (n,d)<br>
    10 VALUES (s.n, s.d);<br>
    11 end;<br>
    12 /<br>
    MERGE INTO kev k<br>
    *<br>
    ERROR at line 2:<br>
    ORA-06550: line 2, column 7:<br>
    PLS-00103: Encountered the symbol "INTO" when expecting one of the following:
    := . ( @ % ; <a SQL statement><br>
    <br>
    Thanks.

    Answer
    There are indeed DB parameters conflicting with the MERGE statement. The DB I am working on is for Oracle Applications. Apparently, although the applications are certified to run on current databases, the underlying code base has not really been brought up, and users are forced into some backward compatibility constraints. So I am stuck until we get our application upgraded from 11.5.7 to something better.
    Hope this helps someone else.
    Kevin
    From the database initialization parameters:
    # Events
    # Events should not be set unless directed by Oracle Support,
    # or by instruction as per the Applications documentation.
    # The following events should be set for PL/SQL backward
    # compatibility.
    # These events should only be used if you are using Oracle
    # Applications release 11.5.7. For later releases (i.e. 11.5.8
    # or higher), you should remove these events.
    event="10932 trace name context level 32768"
    event="10933 trace name context level 512"
    event="10943 trace name context level 16384"

  • Not a valid month, but works from sql developer

    Hi,
    so this sample works from SQL DEV. :
    insert into aspa2_magaddendum (contractid, addendum_number, from_date, to_date) values(2, 0, '03.05.2012', '24.05.2012');
    but not from code using ODP.NET
                string date1 = "03.05.2012";
                string date2 = "24.05.2012";
                OracleConnection conn = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=XE)));User Id=aspa2;Password=aspa2;");
                conn.Open();
                OracleCommand cmd = new OracleCommand();
                cmd.Connection = conn;
                cmd.Parameters.Add("date1", date1);
                cmd.Parameters.Add("date2", date2);
                cmd.CommandText = "insert into aspa2_magaddendum (contractid, addendum_number, from_date, to_date) values(2, 0, :date1, :date2)";
                cmd.ExecuteNonQuery();I get:
    ORA-1843: not a valid month message from exception
    Edited by: user2704811 on May 3, 2012 2:47 AM

    Looks like SQL DEV. session is a bit different from the one in code...
    From SQL DEV i get:
    select value from nls_session_parameters where parameter = 'NLS_DATE_FORMAT';
    "DD.MM.RR"
    and from the code I get:
    cmd.CommandText = "select value from nls_session_parameters where parameter = 'NLS_DATE_FORMAT'";
    string format = cmd.ExecuteScalar().ToString();
    "DD-MON-RR"

  • How to get information from desktops into SQL?

    Hello Everyone,
    I could use some help with an idea that I have been working on. I basically am looking for a way to capture information from desktops and get that data into a SQL database. Could anyone give me any links, kb articles, etc on how I can go about doing this?
    Any help would be very appreciated
    Thanks :)

    Powershell is the tool for you. If you could please move this post to powershell; you should get better response.  I almost certain that there are already some powershell scripts that does this, or at least will give you a report or a excel\csv file
    with this information.
    once you have that info you import that data into sql and sql server agent jobs you can automate. 
    Below are some of the resources :
    http://serverfault.com/questions/585223/how-to-list-all-computers-operating-system-on-a-network-in-powershell
    https://www.simple-talk.com/sql/database-administration/let-powershell-do-an-inventory-of-your-servers/
    http://gallery.technet.microsoft.com/scriptcenter/Hardware-Inventory-Using-fe6611e0
    http://blogs.technet.com/b/heyscriptingguy/archive/2006/11/09/how-can-i-use-windows-powershell-to-get-a-list-of-all-my-computers.aspx
    Again, please move this powershell thread. you will get better response,
    Hope it Helps!!

  • Getting Applets to Work on the Web

    Last semester, I took a Java programming class. While polishing up my resume recently, I decided that a couple of assignments I did for the class would look good in my porfolio, and attempted to upload them to my website.
    Unfortunately, the class I took focused exclusively on getting applets to run on you local machine. Nothing I did for the class works in a web browser. This leads me to two questions:
    1) IMO, Java that doesn't work in a web browser pretty much defeats the purpose of using Java. Since my local college's Comp Sci program is obviously failing in this regard, what are good resources to learn the Right Way to program in Java (ie, the way that works in web browsers)?
    2) Are any of the things I did in class salvagable by any means short of starting over from scratch? Below is a cut-n-paste of a typical applet we wrote for the class, using the teacher's reccomended methods. If someone could point me in the right direction for getting this to work in a browser, I'd be very grateful.:
    <code>
    // Java Programming - CSCI-267
    // Assignment for week # 13
    // Filename AutoDatabase
    // Written by Mike 'siece' Gilmore
    // Written on Nov. 23 2k3
    import java.sql.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.*;
    public class AutoDatabase extends Frame implements ItemListener, ActionListener{
    Connection conEmployees;
    Statement cmdEmployees;
    ResultSet rsEmployees;
    boolean blnSuccessfulOpen = false;
    Choice lstVehicle = new Choice();
    TextField txtInvID = new TextField(10);
    TextField txtMan = new TextField(10);
    TextField txtModName = new TextField(9);
    TextField txtYear = new TextField(14);
    TextField txtVID = new TextField(14);
    TextField txtCost = new TextField(14);
    Button btnAdd = new Button("Add");
    Button btnEdit = new Button("Edit");
    Button btnCancel = new Button("Cancel");
    Button btnDelete = new Button("Delete");
    Label lblMessage = new Label(" ");
    public static void main(String args[])
    AutoDatabase thisApp = new AutoDatabase();
    thisApp.createInterface();
    public void createInterface()
    loadDatabase();
    if(blnSuccessfulOpen)
    setTitle("Java Class Week 13 Assingment");
    addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent event)
    stop();
    System.exit(0);
    setLayout(new BorderLayout());
    Panel pnlTop = new Panel(new GridLayout(2,2,10,10));
    pnlTop.add(new Label("Inventory ID"));
    lstVehicle.insert("Select a Vehicle to Display", 0);
    lstVehicle.addItemListener(this);
    pnlTop.add(lstVehicle);
    pnlTop.add(new Label(" "));
    add(pnlTop, "North");
    Panel pnlMiddle = new Panel(new GridLayout(7,2,10,10));
    pnlMiddle.getInsets();
    pnlMiddle.add(new Label("Inventory ID"));
    pnlMiddle.add(txtInvID);
    pnlMiddle.add(new Label("Manufacturer"));
    pnlMiddle.add(txtMan);
    pnlMiddle.add(new Label("Model Name"));
    pnlMiddle.add(txtModName);
    pnlMiddle.add(new Label("Year"));
    pnlMiddle.add(txtYear);
    pnlMiddle.add(new Label("Vehicle ID"));
    pnlMiddle.add(txtVID);
    pnlMiddle.add(new Label("Cost"));
    pnlMiddle.add(txtCost);
    setTextToNotEditable();
    Panel pnlLeftButtons = new Panel (new GridLayout(0,2,10,10));
    Panel pnlRightButtons = new Panel(new GridLayout(0,2,10,10));
    pnlLeftButtons.add(btnAdd);
    btnAdd.addActionListener(this);
    pnlLeftButtons.add(btnEdit);
    btnEdit.addActionListener(this);
    pnlRightButtons.add(btnDelete);
    btnDelete.addActionListener(this);
    pnlRightButtons.add(btnCancel);
    btnCancel.addActionListener(this);
    btnCancel.setEnabled(false);
    pnlMiddle.add(pnlLeftButtons);
    pnlMiddle.add(pnlRightButtons);
    add(pnlMiddle,"Center");
    add(lblMessage, "South");
    lblMessage.setForeground(Color.red);
    setSize(400, 350);
    setVisible(true);
    else {
    stop();
    System.exit( -1);
    public Insets insets()
    return new Insets(40, 15, 15, 15);
    public void loadDatabase()
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    catch(ClassNotFoundException err)
    try
    Class.forName("com.mx.jdbc.odbc.JdbcOdbcDriver");
    catch(ClassNotFoundException error)
    lblMessage.setText("Drivers did not load properly");
    try
    conEmployees = DriverManager.getConnection("jdbc:odbc:AutoDatabase");
    cmdEmployees = conEmployees.createStatement();
    rsEmployees = cmdEmployees.executeQuery("Select * from Vehicle;");
    loadNames(rsEmployees);
    blnSuccessfulOpen = true;
    catch(SQLException error)
    lblMessage.setText("Error: " + error.toString());
    public void loadNames(ResultSet rsEmployees)
    try
    while(rsEmployees.next())
    lstVehicle.add(rsEmployees.getString("InventoryID"));
    catch(SQLException error)
    lblMessage.setText("Error in Display Record." + "Error: " + error.toString());
    public void itemStateChanged(ItemEvent event)
    String strInventoryID = lstVehicle.getSelectedItem();
    lblMessage.setText("");
    try
    rsEmployees = cmdEmployees.executeQuery(
    "Select * from Vehicle where [InventoryID] ='" + strInventoryID + "';");
    txtInvID.setText(strInventoryID);
    displayRecord(rsEmployees);
    setTextToEditable();
    catch(SQLException error)
    lblMessage.setText("Error in result set." + "Error: " + error.toString());
    public void displayRecord(ResultSet rsEmployees)
    String strFormat;
    float fltCost;
    try
    if(rsEmployees.next())
    txtInvID.setText(rsEmployees.getString("InventoryID"));
    txtMan.setText(rsEmployees.getString("Manufacturer"));
    txtModName.setText(rsEmployees.getString("ModelName"));
    txtYear.setText(rsEmployees.getString("Year"));
    txtVID.setText(rsEmployees.getString("VehicleID"));
    NumberFormat fmtCurrency = NumberFormat.getCurrencyInstance();
    NumberFormat fmtDecimal = NumberFormat.getInstance();
    fltCost = Float.valueOf(rsEmployees.getString("CostValue")).floatValue();
    strFormat = fmtCurrency.format(fltCost);
    txtCost.setText(strFormat);
    lblMessage.setText("");
    catch (SQLException error)
    lblMessage.setText("Error: " + error.toString());
    public void actionPerformed(ActionEvent event)
    Object objSource = event.getSource();
    if(objSource == btnAdd && event.getActionCommand()=="Add")
    Add();
    else if(objSource == btnAdd)
    Save();
    else if (objSource == btnEdit)
    Edit();
    else if(objSource == btnDelete)
    Delete();
    else if(objSource == btnCancel)
    Cancel();
    public void setTextToNotEditable()
    txtInvID.setEditable(false);
    txtMan.setEditable(false);
    txtModName.setEditable(false);
    txtYear.setEditable(false);
    txtVID.setEditable(false);
    txtCost.setEditable(false);
    public void setTextToEditable()
    txtInvID.setEditable(true);
    txtMan.setEditable(true);
    txtModName.setEditable(true);
    txtYear.setEditable(true);
    txtVID.setEditable(true);
    txtCost.setEditable(true);
    public void clearTextFields()
    txtInvID.setText("");
    txtMan.setText("");
    txtModName.setText("");
    txtYear.setText("");
    txtVID.setText("");
    txtCost.setText("");
    public void Add()
    lblMessage.setText(" ");
    setTextToEditable();
    clearTextFields();
    txtInvID.requestFocus();
    btnAdd.setLabel("OK");
    btnCancel.setEnabled(true);
    btnDelete.setEnabled(false);
    btnEdit.setEnabled(false);
    public void Save()
    if (txtInvID.getText().length() == 0 || txtModName.getText().length() == 0)
    lblMessage.setText("The Inventory ID or Model Name is blank");
    else
    try
    cmdEmployees.executeUpdate("Insert Into Vehicle"
    + "([InventoryID], [Manufacturer], [ModelName], [Year], [VehicleID], [CostValue])"
    + "Values('"
    + txtInvID.getText() + "', '"
    + txtMan.getText() + "', '"
    + txtModName.getText() + "', '"
    + txtYear.getText() + "', '"
    + txtVID.getText() + "', '"
    + txtCost.getText() + "')");
    lstVehicle.add(txtInvID.getText());
    Cancel();
    catch(SQLException error)
    lblMessage.setText("Error: " + error.toString());
    public void Edit()
    int intIndex = lstVehicle.getSelectedIndex();
    if(intIndex == 0 )
    lblMessage.setText("Please select the record to change");
    else
    String strInventoryID = lstVehicle.getSelectedItem();
    try
    cmdEmployees.executeUpdate("Update Vehicle "
    + "Set [InventoryID] = '" + txtInvID.getText() + "', "
    + "[Manufacturer] = '" + txtMan.getText() + "', "
    + "[ModelName] = '" + txtModName.getText() + "', "
    + "[Year] = '" + txtYear.getText() + "', "
    + "[VehicleID] = '" + txtVID.getText() + "', "
    + "[CostValue] = '" + txtCost.getText() + "' "
    + "Where [InventoryID]= '" + strInventoryID + "';");
    if(!strInventoryID.equals(txtInvID.getText()))
    lstVehicle.remove(intIndex);
    lstVehicle.add(txtInvID.getText());
    catch(SQLException error)
    lblMessage.setText("Error during Edit. " + "Error: " + error.toString());
    public void Delete()
    int intIndex = lstVehicle.getSelectedIndex();
    String strInventoryID = lstVehicle.getSelectedItem();
    if(intIndex == 0)
    lblMessage.setText("Please select the record to be deleted");
    else
    try
    cmdEmployees.executeUpdate(
    "Delete from Vehicle where [InventoryID] = '" + strInventoryID + "';");
    clearTextFields();
    lstVehicle.remove(intIndex);
    lblMessage.setText("Record deleted");
    catch(SQLException error)
    lblMessage.setText("Error during Delete." + "Error: " + error.toString());
    public void Cancel()
    btnDelete.setEnabled(true);
    btnEdit.setEnabled(true);
    btnCancel.setEnabled(false);
    btnAdd.setLabel("Add");
    clearTextFields();
    lblMessage.setText("");
    lstVehicle.select(0);
    public void stop()
    try
    if(conEmployees != null)
    conEmployees.close();
    catch(SQLException error)
    lblMessage.setText("Unable to disconnect");
    </code>

    1) Applets that run in web browsers used to be "hip" in at one point in the dark 1990's. That time is forever gone and good riddance. Today big enterprise applications and sophisticated special purpose desktop applications are the Right Way&trade; to go with Java.
    If you want action in your browser, look into Macromedia's Flash technology.
    If you want to deploy your application easily in an applet-like fashion (one click from a browser), look into Java Webstart.
    Demos: http://java.sun.com/products/javawebstart/demos.html
    Documentation: http://java.sun.com/products/javawebstart/developers.html
    2) It's a trivial task to write a launcher applet for any given application so that the applet starts the application in a new window. The security restrictions imposed on applets ("sandbox") might make it impossible to use the application; for instance you cannot write or read files on the local hard drive or make network connections to other servers than where the applet was loaded from. You cannot call System.exit to quit the virtual machine.
    At its simplest the lancher applet code would look ilke:public class Launcher extends java.applet.Applet {
        public void start() {
            YourApplicatioMainClass.main(null);
    }and in the html you would write:<applet code="Launcher" height="1" width="1">
    </applet>See the "Writing applets" tutorial for further information http://java.sun.com/docs/books/tutorial/applet/index.html

  • Making a join seems simple but I can't get it to work

    Hi All,
    I have 2 tables LUGallery and LUSubGallery, the tables are related by the GalleyID field
    LUGallery
    Gallery ID
    ClientID
    GalleryName
    5
    50
    Australia
    8
    50
    Weddings
    12
    33
    Portraits
    4
    33
    Landscapes
    LUSubGallery
    SubGalleryID
    GalleryID
    GalleryName
    67
    5
    NSW
    68
    5
    QLD
    69
    8
    Reception
    70
    8
    Location
    87
    8
    Ceromony
    97
    4
    Rain Forest
    What I am try to do seems simple but I can't get it to work the way I want it.
    I am trying to write a query to display Galleries from the LUGallery tbl that have a Sub Gallery attached to them (ie. It's GalleryID appears in the LUSubGallery tbl)
    So the query for the above example would list Australia, Weddings & Landscapes
    I have tried to write code both with inner joins and nested queries but just can't get it right,
    Any help would be greatly appreciated.
    Thanks in advance
    Kris

    I just want to
    display the GalleryNames from the LUGallery tbl once
    Then you probably do not want include all the extra columns from the LUSubGallery table.
    It returns all of the records from both tables that Have
    the same GalleryID
    That is the way this type of JOIN works. It will return one record for each matched GalleryID. If you only want to display the unique gallery names you can either:
    1) Use an EXISTS clause.  It will return the distinct records from the main gallery table IF a matching record exists in the LUSubGallery table
    --- Not tested ---
    SELECT  LUGallery.GalleryID,
    LUGallery.GalleryName
    FROM    LUGallery
    WHERE   EXISTS (
            SELECT  *
            FROM LUSubGallery
            WHERE LUGallery.GalleryID = LUSubGallery.GalleryID
    http://www.techonthenet.com/sql/exists.php
    ... OR ....
    2) Use the DISTINCT operator to return only the unique combinations of the selected columns. Note: DISTINCT considers all columns in the SELECT list . So if you only want unique galleries, do not include the LUSubGallery columns in the SELECT list.
    http://www.w3schools.com/SQl/sql_distinct.asp
    Message was edited by: -==cfSearching==-

  • Getting jtsl to work

    I have followed all the instructions from the install i did from (jakarta-taglibs-standard-1.1.2) and i have tomcat (jakarta-tomcat-5.5.8) but i still can't get it to work can anyone help?

    I am getting this error:
    org.apache.jasper.JasperException: /advanSearchlib.jsp(8,0) No tag "" defined in tag library imported with prefix "sql"
    from this page
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix='c'%>
    <%@ taglib uri="http://java.sun.com/jstl/sql" prefix='sql'%>
    <html>
    <title>Eastenders Charcater Search</title>
    <head>
    <sql: setDataSource
      var="dataconn"
      driver="sun.jdbc.odbc.JdbcOdbcDriver"
      url"jdbc:odbc:eastenders"
    />
    </head>
    <body>
    <sql:query var="characters" dataSource="${dataconn}>
    sql="select character_id, character_firstnname, character_surname  from character"
    </sql:query>
    <c:forEach var="row" items="${characters.rowsByIndex}">
       <c:forEach var="data" items="${row}">
       <c:out value="${data}">
       </c:forEach>
    </c:forEach>
    </body>
    </html>

  • Just trying to get the basics working...

    Hi,
    I have been trying to get just the basics working, and have spent almost all day, and now into the night, trying to get it to work....with no logical sucess.....
    All I am trying to do, using VB.net 2008 with Crystral Reports 2008, is to disply my report on a web page using the crystalreport viewer in Visual Studio.
    I created a report in CR2008, and during the process of creating the report I had to create a connection to the SQL Server 2005 database and set a parameter on my report to show the data for a single record from the database.
    The issue is that the connection string I use in CR2008 is NOT the connection string that is to be used in the browser, so the first task I have attempted to do is to set new log in details for the report. I just want to use a trusted connection.
    I have searched high and low on the internet, and taken a look at the samples provided on this site.
    My code, as it is at the moment for setting the connection for the report at run time is at the end of this email: ( I got this code from the samples on this site)
    The problem I have is if the integratedsecurity set to true(as I need it) then the myconnectioninfo.servername and database name are totally ignored. I have changed them to be just randon characters, which should result in the report not being able to connect, yet the report still works fine.
    No errors are generated at all, so its very confusing. I know the code is being executed via breakpoints and stepping through the code, but it would seem that it makes no difference.
    What am I doing wrong here.....
    Private Sub ConfigureCrystalReports()
            Dim reportPath As String = Server.MapPath("CrystalReport1.rpt")
            myCrystalReportViewer.ReportSource = reportPath
            Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
            SetDBLogonForReport(myConnectionInfo)
            myConnectionInfo.ServerName = "SQL1"
            myConnectionInfo.DatabaseName = "MPx
            ' myConnectionInfo.UserID = "limitedPermissionAccount"
            'myConnectionInfo.Password = "1234"
            myConnectionInfo.IntegratedSecurity = True
        End Sub
        Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
            ConfigureCrystalReports()
        End Sub
        Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo)
            Dim myTableLogOnInfos As TableLogOnInfos = myCrystalReportViewer.LogOnInfo
            For Each myTableLogOnInfo As TableLogOnInfo In myTableLogOnInfos
                myTableLogOnInfo.ConnectionInfo = myConnectionInfo
            Next
        End Sub

    Hi,
    Couple of things:
    1) Please make sure that you are using CR2008 with SP0 at least. Dlls versions should be 12.0.2000.0 and File version 12.0.1100.0.
    2) Please make sure that the destination database can be accessed from that machine. You can create a UDL file or a new report hitting the target database to see if we can see data into it.
    3) Please make sure that we are not changing the schema of the report.
    4) Can you try this code mentioned below:
    ConnectionInfo crConnection = new ConnectionInfo();
                   crConnection.ServerName="Server";
                   crConnection.DatabaseName="DB";
                   crConnection.UserID="uid";
                   crConnection.Password="pwd";
                            crConnection.IntegratedSecurity=true;
                   crReport.Load(Server.MapPath("CrystalReport1.rpt"));
                   Tables crTables=crReport.Database.Tables;
                   foreach(CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
                        TableLogOnInfo crTLOI = crTable.LogOnInfo;
                        crTLOI.ConnectionInfo=crConnection;
                        crTable.ApplyLogOnInfo(crTLOI);
                        crTable.Location=Database.Owner.Tablename
                   CrystalReportViewer1.ReportSource=crReport;
    Regards,
    AG.

Maybe you are looking for

  • How To Transfer Hard Drive Files from Macbook Pro

    I have a macbook pro(late 2006 model) which won't turn on. Brought it to the apple store for them to take a look at. I was told that the main circuit board is broken and it will be cheaper to buy a newer macbook instead of fixing it. I was also told

  • Images at the bottom of the screen are cut off in HDR Pro

    I'm running a Mac and have recently installed CS5.  When I open files to do an HDR, the photos used in the HDR are cut off at the bottom of the screen.  In other words, what I mean is, they should be able to be selected with the check box is being in

  • Changes to login screen not recognized

    Hi, I wonder if anyone can point me in the right direction. Several months ago a colleague made changes to the standard login screen for Oracle BI Answers. The change was a warning notice about a power outage that would shut down our servers in the f

  • Syncing contacts between Mountain Lion and Snow Leopard?

    One of my computers is running Mountain Lion, and the other is running Snow Leopard and so does not have access to iCloud. Is there any way to sync Contacts between the two computers?

  • Custom Character Template

    Is it possible to create a custom template for the special characters I use over and over again without having to scroll through the entire Characters window?