Corrigindo erro SQL Server 2005 Express – Atachando databases (.mdf)

Junho 12, 2007

Quando tenta atachar um .mdf ao Server dá erro 5 (access denied).

“Unable to open the physical file ‘c:\Program Files\Microsoft SQL Server\MSSQL1.1\MSSQL\Data\TravCom.mdf’. Operating system error 5 (Access Denied).”
Solução

Now to resolve this you need not to uninstall Sql Express. Just go to SQL express configuration manager and click on Services from the left pane. From the right pane select Sql server service and go to its properties. The builtin login should be “Nerwork Service”, change it to “Local system” and restart the service. thats it.

sqlexpress.jpg


Excluindo o boot

Junho 11, 2007
clipped from www.pcforum.com.br

Instalou o Vista junto com o XP e agora quer desinstalar?
Apenas formatando a partio com o Vista no ir resolver,pois o boot do computador est sendo comandado pelo Windows Vista.
Antes de formatar a partio ,insira o DVD de instalao do Windows Vista e execute o comando abaixo(iniciar / executar):

d:\boot\bootsect.exe /nt52 ALL /force (d: a unidade de DVD onde est a instalao do Vista).

Depois de executar o comando, delete os arquivos boot.bak e bootsect.bak no seu HD ,nq partio onde est instalado o Windows XP.

Reinicie o computador.

Agora pode formatar a partio como Vista que o dual boot j era.

abraos

fonte: asmon

ah … ok, um bom pormenor que nao e preciso eskecer
  blog it

JDBC to SQL Server Express

Junho 5, 2007

JDBC to SQL Server Express

Connecting JDBC-based tools such as SQL Developer or DbVisualizer to SQL Server Express required the following steps:

  • Obtain JDBC Driver
  • TCP/IP for SQL Server Express
  • Authentication Method

Obtain JDBC Driver

Using SQL Developer, when you get the following exception …

Unable to find driver: net.sourceforge.jtds.jdbc.Driver

… download the jTDS JDBC driver and install it in your JRE’s ext folder. The latest version of the driver is 1.2. Of course, there are other JDBC drivers for SQL Server you can use.

TCP/IP for SQL Server Express

By default, TCP/IP for SQL Server Express is disabled, so JDBC cannot connect to it and you may get the following exception …

Network error IOException: Connection refused: connect

Enable TCP/IP

To enable TCP/IP, start SQL Server Configuration Manager.

  1. Expand SQL Server 2005 Network Configuration node.
  2. In the right pane, select Protocols for SQLEXPRESS. The right pane should now show Protocols and Status columns.
  3. Select Enable from the TCP/IP context menu.

Find or Configure TCP/IP Port

After enabling TCP/IP, you have to find out which port number to use. SQL Server Express allocates a port dynamically each time it is started, so to find or configure the port number, continue using SQL Server Configuration Manager

  1. Select Properties from the TCP/IP context menu. The TCP/IP Properties dialog should open.
  2. Select the IP Addresses tab.
  3. In the IPA3 (127.0.0.1) node …
    1. The TCP Dynamic Ports field shows the currently used port number. If you set that field to blank, then SQL Server Express should not automatically choose another port when it restarts.
    2. Set the desired port number in the TCP Port field (1433).
    3. Press OK to apply your settings and close the dialog.

Test TCP/IP

If you change the TCP/IP port, you have to restart SQL Server Express before it can use the new port number. To test that your port number is used, start a cmd window and type: netstat -an. For instance, if you used port 1433, you should see this line in the list of ports used:

TCP    0.0.0.0:1433           0.0.0.0:0              LISTENING

Authentication Method

By default, SQL Server Express uses Windows Authentication Mode to authenticate connections. If you get this exception …

Login failed for user '<User name>'. The user is not associated with a trusted SQL Server connection.

… then you may have to enable SQL Server Authentication Mode and create or enable a user.

  1. Start Microsoft SQL Server Management Studio Express (SSMSE) and connect to your database server.
  2. In Object Explorer pane, select Properties from your database’s context menu. The Server Properties dialog should open.
  3. Select Security page.
  4. Select SQL Server and Windows Authentication Mode check box.
  5. Press OK button to close the dialog.
  6. In Object Explorer pane, expand Security / Logins node.
  7. Select existing user sa. Note that there is a red downward arrow next to that user’s image.
  8. View sa’s properties. The Login Properties dialog should open.
  9. Select Status page.
  10. Ensure that the Login: Enabled radio button is selected.
  11. Select General page.
  12. Enter a password for this user.
  13. Press OK button to close the dialog.
  14. If you refresh the Object Explorer pane, note that user sa no longer has a red downward arrow.

Finally …

After all these steps, you should be able to connect to your SQL Server Express database using JDBC.

SSMSE console

The long version.

This entry is designed to help explain the reasons behind the steps in the short version of this post. Lets walk through the steps and the problems and try and explain whats happening

Checking to make sure that Express is running via SQLCMD

The default install for SQL Express installs Express as a named instance(called SQLExpress), with no network listening and with Windows Authentication support only.

To connect to a named instance of SQL Server the convention is to use a servername of the format <servername>\<instancename>, its also possible to shortcut the machinename to either “.” or “(local)”(these shortcuts work with all protocols, localhost will also work but only with TCP/IP in older clients,however SQL Native Access supports resolution of LocalHost for Named Pipes and Shared Memory).

No user id and password has been specified because of the default windows authentication, if the install had been changed to specify mixed mode authentication and a password had been given then this could have been used.

Enabling Protocols

Because SQL Server Express does not listen on the network by default connections are made using a local protocol, in the case of the VS 2005 SKUs this is the shared memory protocol. The interface to this has changed in SQL Server 2005 such that older clients can no longer use it. Hence for older clients to work a different local protocol or a network protocol must be used, these are not enabled by default and must be manually enabled.

SQL Browser Service

In general when a client connects remotely to a SQL Server named instance the client does not know the port that the instance is listening on(you can work around this by configuring SQL Server named instances to listen on a specific port and then specifying that port in the connection string in the format <servername>,<port number>)

So when an application attempts to connect to a named instance in the form <servername>\<instancename> the client connection needs to be directed to the correct port. In SQL Server 2000 one of the running services had a built in listener that received the named instance connection requests and redirected them appropriately.

In SQL Server 2005 this functionality has been moved to a dedicated listener service, that service is SQLBrowser.

SQLBrowser also performs another service, that of SQL Server Discovery, its common in many UIs from Microsoft and others to have the ability to browse for instances of SQL Server running locally or remotely, again in SQL Server 2000 this was handled by one of the running instances of SQL Server, in SQL Server 2005 this is handled by the SQLBrowser Service.

Thus the SQLBrowser Service must be started to be able to discover any instance on the machine, and also to connect to named instances through protocols other than shared memory. If network protocols are not enabled via the setup switch then the browser service is not set to autostart.

SQL Native Client

SQL Server native connectivity is defined as connectivity through OLE DB(ADO uses OLE DB under the covers) or ODBC means in SQL Server 2005 (dblib is not an included as a data access technology in SQL Server 2005).

In previous releases of SQL Server(SQL7 and SQL2000) an update to MDAC was preferred for client apps, this means the installation of an entire MDAC update for SQL Server connectivity. In SQL Server 2005 we no longer require an MDAC update as we have refactored out the SQL Server specific connectivity components for OLE DB and ODBC.

As such in SQL Server 2005 no MDAC update is required to connect(although MDAC 2.8 is preferred, any MDAC from Windows 2000 SP3 upwards is supported), but a new component is required. This component is referred to as SQL Native Access.

These components include support for OLE DB and ODBC accessed through a single .dll called: SQLNCLI.dll, this file and its support files are redistributable.

SQL Native Client is NOT required for managed data access via .Net APIs.

-Euan Garden

Product Unit Manager

SQL Server Tools

Connection URL JDBC MICROSOFT: jdbc:sqlserver://localhost\SQLEXPRESS;databaseName=teste

Connection URL JDBC JTDS : jdbc:jtds:sqlserver://localhost:1433/TESTE;instance=SQLEXPRESS


Arquitetura de Aplicação

Maio 28, 2007

- camada UI(User Interface): Nesta camada vc implementa a interface com usuário. Ex: formulario Cliente, formulario Contas, etc…

- camada de comunicação: Aqui, é implementado a comunicação com as outras camadas do sistema. Por exemplo vc pode definir um ValueObject( objeto genérico que conterá os dados da interface gráfica) que será utilizado pela camada de acesso aos dados. o Value Object pode ser uma interface e pode ser definido uma implementação para cada formulario q vc tenha.

- camada de negocios Nesta camada vc implementa os objetos que encapsularão os dados que serão persistentes(gravados/recuperados do BD). Ex: Cliente, Conta.

- Camada de Acesso aos dados: nesta camada vc implementa os DAOs, que tem a resposabilidade de se comunicar com o banco de dados, através das ‘querys’. Ex: DaoCliente, DaoConta, etc…


Na epoca estavam discutindo que a MVC implementa 1 camada (e não 3….). Eu entendi o conceito (camada de apresentação=MVC) mas como os padrões mudam e hoje existe camada pra tudo queria saber como isso está hoje??… eu li muito sobre o assunto e minha opinião é mais o menos o que essa figura diz…

0
- Camadas == Layers
O padrão que descreve a separação do sistema em camadas é o Layers, publicado em [Busch98] (referências no final). Este padrão mostra uma divisão do sistema em camadas, onde idealmente uma camada conhece e acessa apenas a camada imediatamente inferior, ou no máximo as camadas adjacentes.

- MVC = Model-View-Controller
Padrão usado na implementação do toolkit gráfico do Smalltalk. Uma descrição pode ser encontrada aqui.

Eu acredito que a confusão existe por causa da correspondência numérica que muitas vezes ocorre entre os padrões: MVC e Apresentação/Negócio/Persistência. Então, muitos acham que é a mesma coisa, o que não é verdade.

O padrão MVC, como implementado no Swing, funciona da seguinte maneira:
O componente recebe o input do usuário, interpertando-as; este componente envia ao modelo as alterações causadas pelo input; se o modelo for alterado, este envia uma notificação às views (que também são componentes), que por sua vez solicitam ao modelo os novos dados, para que possam se atualizar. Aqui pode se notar um triângulo, Controlador -> Modelo -> Visualização -> Controlador. Assim, o conceito de separação em camadas não é válido, pois a vizualização acessa diretamente o modelo (isto é, não existe a separação estrita em camadas).

Idealmente, acredito que o MVC faz parte da camada de apresentação (como era no conceito original), e não como divisor de camadas (o que deturpa o conceito de MVC e confunde a separação correta em camadas).

A minha concepção ainda é semelhante (MVC é parte da camada de apresentação), embora o modelo, como dito na discussão, pode ter conceitos distintos.
Acho que o seu diagrama simplifica um pouco o paradigma de arquitetura, e assim sendo, deveria distribuir melhor os componentes de negócio.

Um exemplo é que um web service não concentra suas atividades no modelo de negócio.
É mais uma interface de comunicação com outros sistemas e portanto, faria parte de uma camada chamada “integração”.
O mesmo se daria com códigos como RMI, ou CORBA por exemplo.
DAO’s fariam parte da camada de persistência.
Session Beans fariam parte da camada de negócio, assim como os DTO’s (que fariam parte do Model do MVC).
Porém, Entity Beans fazem parte da camada de persistência. Assim como outras alternativas como LDAP.

Certo?

Arquitetura de sistemas muitas vezes é semelhante a um jogo de xadrez: possui certo nível de subjetividade e muitas vezes, um mesmo problema pode ter diversas soluções com arquiteturas bem distintas e igualmente eficazes. 


DDD

Maio 19, 2007

http://fragmental.com.br/wiki/index.php?title=Evitando_VOs_e_BOs


Fixed problem with burning programs based on GearASPI layer (e.g. iTunes)

Maio 8, 2007

http://www.disc-tools.com/download/sptdbeta

 SPTD stands for SCSI Pass Through Direct layer. Basically SPTD is similar to other access layers used by other programs who provide access to storage devices but it has a lot more features that make this interface unique. SPTD v1.45 (32 bit) is public beta version. Duplex Secure team (http://www.duplexsecure.com/) would appreciate your comments and questions regarding use of SPTD v1.45 at Duplex Secure support forum: http://forum.duplexsecure.com/

To address issues reported in 1.43 Duplex Secure provided a hotfix version 1.45.
Once all affected users confirm success we’ll encourage all vendors to replace 1.43 with 1.45.

Issues addressed:
- Fixed problem with burning programs based on GearASPI layer (e.g. iTunes)
- Fixed long delay problem in some programs, e.g. Ashampoo Burning Studio
- Fixed crash issue with WinAmp
- Fixed issues with some software tools like Exact Audio Copy, Nero and other programs using SPTI-based ASPI layer


NHibernate Best Practices with ASP.NET, 1.2nd Ed.

Abril 27, 2007

http://www.codeproject.com/aspnet/NHibernateBestPractices.asp

This article describes best practices for leveraging the benefits of NHibernate 1.2, ASP.NET, generics, and unit testing together.


Fazendo o Windows Ficar Original

Abril 20, 2007

http://jalescesar-detudo.blogspot.com/2007/02/fazendo-o-windows-xp-ficar-original.html 

Bom galera, estou colocando aqui um programa que é conhecido como KeyChanger. Ele vai ser usado para modificar o seu serial de instalação do Windows XP Pro. Iremos mudar para um serial válido, e assim você poderá baixar qualquer coisa do site da Microsoft que necessite de Validação.
1 - Baixe o KeyChanger:Download ( aguarde 15 segundos e digite o codigo)
2 - Descompacte o arquivo(Está compactado com o WinRAR) e abra o programa keychanger.exe
3 - Ao abrir o programa você verá essa imagem:


4- Agora siga os procedimentos:






Depois:

SERIAL: THMPV-77D6F-94376-8HGKG-VRDRQ

Podem ficar tranquilo, o serial é VLK(empresas) então todos podem ativar com ele que não tem problema.

5 - Depois disso reinicie o programa veja se ele atualizou a key que você agora pouco colocou.

6 - Se sim pode fechar o programa e seguir o processo. Se não repita todo o processo.

7 - Vá na pagina da MS para você validar o seu Windows: http://www.microsoft.com/resources/howtotell/PT-BR/windows/default.mspx

8 - Clique no botão Validar Agora

9 - Instale o ActiveX sem medo.

10 - Aguarde e irá aparecer uma MSG falando que seu Windows é original.

11 - Pronto..Seu Windows está original.

Outra maneira de Validar o Windows, agora sem nenhum programa:

1. Vá em Iniciar > Executar

2. Digite regedit e clique em OK.

3. Já dentro do regedit, navegue até a chave: HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/WindowsNT/CurrentVersion/WPAEvents

4. No painel à direita, clique duas vezes em OOBETimer

5. Na janela que foi aberta, apague qualquer valor e clique em OK. Feche o regedit

6. Vá novamente em Iniciar > Executar e dessa vez digite: %systemroot%\system32\oobe\msoobe.exe /a

7. Na janela que foi aberta, escolha a opção Sim, desejo telefonar…

8. Na próxima etapa, clique no botão Alterar chave de produto.

9. Na etapa seguinte, digite a CD-Key(Serial: Está no final do tópico .) e clique no botão Atualizar

10. Após clicar no botão Atualizar, o assistente para ativação voltará para a janela anterior, então, clique em Lembrar mais tarde e reinicie o Windows.

11. Reiniciado o Windows vá novamente em Iniciar > Executar e digite:%systemroot%\system32\oobe\msoobe.exe /a

12. Aparecerá a seguinte mensagem: Ativação do Windows O Windows já está ativado. Clique em OK para sair.

13. Para validar depois na MS: http://www.microsoft.com/resources/howtotell/PT-BR/windows/default.mspx

SERIAL: THMPV-77D6F-94376-8HGKG-VRDRQ


How To Keep Good Posture When In Front Of A Computer

Abril 18, 2007

http://ririanproject.com/2006/10/30/how-to-keep-good-posture-when-in-front-of-a-computer/

“We spend a large portion of our lives sitting, especially during the computer age, so it’s important to learn to sit tall. One of the most common mistakes we make is that when we move into a sitting position, we tend to aim for the center of the chair. The proper method is to sit deep in your chair.”

 

- Dr. Marvin Arnsdorff

Today we are spending more time at computers, an activity through which people’s bad posture can affect their overall health.

Computer PosturePosture ranks at the top of the list when talking about good health. It is as important as eating right, exercising, getting a good night’s sleep and avoiding harmful substances. Unnatural alignment of the body can cause head, shoulder, neck and back pain, and compromise neurological, digestive, respiratory and cardiovascular functioning.

Unquestionably, students and adults alike spend more time at computers today than 20 years ago. So here are nine tips designed to help people’s posture when they’re at the computer at home, school or work:

1. Support Your Back

Does the chair you are sitting on have enough lumbar support? The backrest should fit into the natural curve of your lower back, filling in the space between your back and the back of the chair. This helps avoid excess pressure on the spine and makes it easier to maintain good sitting posture.

Adequate lumbar support also helps prevent muscle fatigue, which causes many people to lean their heads and upper backs too far forward or to slouch downward. With good lower back support, spinal muscles are relaxed and the spine is able to maintain its neutral position.

2. Comfortable Leg Postures

To promote comfortable leg postures, consider clearing away items from your legs to allow comfortable leg positions and movement. Feet should be flat on the floor or you may use a footrest if your feet do not rest comfortably.

3. Minimize Reaching

Position work station components to minimize reaching and twisting. Keep frequently accessed objects as close as possible to body centre.

4. Comfortable Shoulder and Arm Postures

Place your keyboard and mouse or trackball at the same height; these should be at about elbow level. Your upper arms should fall relaxed at your sides.

Also when typing, center your keyboard in front of you with your mouse or trackball located close to it.

5. Wrist and Finger Postures

Keep your wrists straight while typing and while using a mouse or trackball. Avoid bending your wrists up, down, or to the sides. Use the keyboard legs if they help you maintain a comfortable and straight wrist position. Type with your hands and wrists floating above the keyboard, so that you can use your whole arm to reach for distant keys instead of stretching your fingers.

Make sure you keep your fingers relaxed while typing and using a mouse. Use a soft touch on the keyboard instead of pounding keys with unnecessary force.

Also grasp the mouse gently and avoid holding a pen or anything else in your hands while you type or use the mouse. You should relax your fingers and hands between bursts of typing or mousing using a flat, straight wrist posture.

When moving your mouse, you may be more comfortable if you use your arm, not just your wrist. Choose a mouse that fits the size of your hand comfortably and is as flat as possible to minimize wrist strain.

6. Minimize Neck Bending and Twisting

Center your monitor in front of you. Consider placing your documents directly in front of you and the monitor slightly to the side, if you refer to your documents more frequently than your monitor.

Sit comfortably in the chair. Close both eyes and relax. Then, slowly reopen them. Where the gaze initially focuses should be when the eyes open is the place to put the center of the computer screen. The screen can be raised using books or a stand if needed.

7. Minimize Eyestrain

Place your monitor at a distance of about arm’s length when seated comfortably in front of the monitor. Also avoid glare. Place your monitor away from light sources that produce glare, or use window blinds to control light levels. Don’t forget to adjust your monitor brightness, contrast, and font size to levels that are comfortable for you.

Throughout the day, give your eyes a break by forcing them to focus on something other than on your screen. Try the following exercise: Hold a finger a few inches in front of your face; focus on the finger as you slowly move it away; focus on something far in the distance and then back to the finger; slowly bring the finger back toward your face. Next, shift your focus to something farther than eight feet away and hold your eyes there for a few seconds. Repeat this exercise three times, several times a day.

8. Take Short Breaks

Taking breaks can help your body recover from any activity. The length and frequency of breaks that are right for you depend on the type of work you are doing. Stopping the activity and relaxing is one way to take a break, but there are other ways, also. For example, just changing tasks – perhaps from sitting while typing to standing while talking on the phone can help some muscles relax while others remain productive.

9. Periodically Look Up At the Ceiling to Give Your Posture Muscles a Break

So, improve your sitting posture and remember, a healthy lifestyle can help you perform and enjoy your everyday activities, including the time spent at your computer. Learning more about working comfortably and productively, as well as your overall health, are important ways to help you enjoy your computing experience.

Featured Partner:
Stay comfortable and improve sitting posture with ergonomic computer chairs from Beyond The Office Door.