O JBOSS é um webserver que proporciona maior liberdade para o desenvolvedor, que pode configurar uma JNDI diretamente em sua área de hospedagem na pasta jboss/deploy.
Coloque as configurações de sua base em um arquivo BANCO-ds.xml com os dados abaixo:
<datasources> <local-tx-datasource> <jndi-name>jdbc/CLIENTEDS</jndi-name> <connection-url>URL?autoReconnect=true</connection-url> <driver-class>DRIVER_CLASSE</driver-class> <user-name>USUARIO</user-name> <password>SENHA</password> </local-tx-datasource> </datasources>
Acesso ao Mysql :
<?xml version="1.0" encoding="UTF-8"?> <datasources> <local-tx-datasource> <jndi-name>jdbc/Datasource</jndi-name> <connection-url>jdbc:mysql://HOST:3306/nomedabase</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>login_base</user-name> <password>senha</password> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name> <metadata> <type-mapping>mySQL</type-mapping> </metadata> </local-tx-datasource> </datasources>
Legenda:
CLIENTEDS = Nome da datasource que será configurada em sua aplicação
URL = Endereço de sua base – Não Utilize LocalHost
DRIVER_CLASSE = Driver de acesso ao banco de dados Ex : Mysql -> com.mysql.jdbc.Driver
USUARIO = Usuário de acesso base de dados
SENHA = Senha de acesso a base de dados
Página de testes da datasource : testeJNDI.jsp
<%@page language="java" import="java.io.*,java.sql.*,javax.sql.*,javax.naming.*" %> <html> <head> <title>JNDI</title> </head> <body> <% Connection conexao; ResultSet rs; DataSource ds; try { Context context = new InitialContext(); Context lautx = (Context) context.lookup("java:"); ds = (DataSource)lautx.lookup("jdbc/Datasource"); conexao = ds.getConnection(); out.write("Conectado via JNDI!<br><br>"); Statement stmt= conexao.createStatement(); conexao.close(); } catch (SQLException sqle) { out.write("<======= OCORREU UMA EXCEPTION - VERIFICAR =======><br><br><br>" + sqle); sqle.printStackTrace(); } finally { } %> </body> </html>
Para obter informações sobre sua base de dados:
1 – Acesse o Painel de Controle com o seu login e senha;
2 – Em Hospedagem de Sites, clique no ícone Instruções de Administração, localizado à direita da hospedagem contratada;
3 – E clique no link de seu banco de dados onde encontrará todas as informações necessárias para configurar a datasource.
Veja também
Como utilizar o JBOSS na Locaweb?
Páginas na categoria “Linux”
As seguintes 200 páginas pertencem a esta categoria, de um total de 206.
Vídeo Tutorial
Acessando a hospedagem Linux via SSH
Algumas rotinas podem ser executadas diretamente no servidor através de um software de SSH.
Para realizar esse acesso deve-se informar o endereço de FTP, Login e Senha, no exemplo abaixo utilizaremos o PuTTY SSH, programa freeware.
Após baixar o programa execute-o clicando sobre o mesmo.
No campo Host Name (or IP Address) informe o endereço de ftp, por exemplo ftp.seudomínio;
No campo Saved Sessions digite qualquer nome que identifique o seu site, por exemplo, Locaweb – seudomínio;
Após preencher os dados clique em Save. Pronto! Você acabou de configurar o programa.
Para acessar o seu site clique sobre a sessão Locaweb-seudomínio e depois sobre o botão “Open”
Será exibida uma tela preta solicitando o login.
Informe o seu login, pressione Enter, depois a senha de FTP e Enter novamente.
Pronto! Você está conectado em seu site via SSH.
Para aumentar ainda mais a segurança da conexão por SSH, consulte Geração de chave para utilização de SSH, SFTP e SCP
Veja também
- Como gerenciar a minha hospedagem via SSH
- SFTP e SCP
- Geração de chave para utilização de SSH, SFTP e SCP
- Como editar um arquivo em um servidor Linux
- Como restaurar um arquivo .SQL no banco MySQL via SSH
- Como efetuar um Backup do banco MySQL via SSH
- Como fazer um backup da minha base PostgreSQL
- Como fazer um restore da minha base PostgreSQL
- Porque não estamos conseguindo gravar arquivos na pasta upload?
- SSH -Bloqueio de segurança
- Inserindo acentuação via SSH no Putty
Este artigo é válido somente para os clientes com Hospedagem Linux. O acesso à área de hospedagem por SSH é requerido (exemplo com Putty).
Vídeo Tutorial
Começando
Ao entrar por SSH na sua área de hospedagem, automaticamente você é enviado ao diretório /home/SeuLoginFTP do servidor.
Para se certificar, rode o comando
pwd
Retornará
/home/SeuLoginFTP
Para entrar no diretório public_html, rode
cd public_html
Para saber os arquivos e diretórios que estão dentro do diretório que você acessou, rode
ls -la
Se quiser voltar o diretório um nível acima, rode
cd ..
Criando e apagando arquivos
Para criar arquivos, rode
touch 1.txt
- Será criado o arquivo 1.txt.
Para apagar o arquivo, rode
rm 1.txt
Para editar o conteúdo de um arquivo no servidor, consulte
Criando e apagando diretórios
Para criar diretórios, rode
mkdir MEUDIRETORIO
E para apagar o diretório (muito cuidado, isso apagará tudo o que houver dentro dele)
rm -rf MEUDIRETORIO
Para copiar um arquivo ou diretório
Situação 1: Criar uma cópia de arquivo com outro nome
cp 1.txt 2.txt
- o arquivo 2.txt será criado como cópia do 1.txt
Situação 2: Copiar um arquivo de um diretório para outro
cp 1.txt MEUDIRETORIO
- o arquivo 1.txt será copiado para dentro do diretório MEUDIRETORIO
Situação 3: Copiar todos os arquivos e sub-diretórios de um diretório para outro
cp -R MEUDIRETORIO1/* MEUDIRETORIO2
- todos os arquivos e sub-diretórios de MEUDIRETORIO1 serão copiados para MEUDIRETORIO2
Para mover ou renomear um arquivo ou diretório
No Linux, os comandos para mover e renomear são os mesmos:
Situação 1A: Renomear um arquivo
mv 1.txt 2.txt
- o arquivo 1.txt será renomeado para 2.txt
Situação 1B: Renomear um diretório
mv MEUDIRETORIO MEUDIRETORIO2
- o diretório MEUDIRETORIO será renomeado para MEUDIRETORIO2
Situação 2: Mover um arquivo de um diretório para outro
mv 1.txt MEUDIRETORIO
- o arquivo 1.txt será movido para dentro do diretório MEUDIRETORIO
Situação 3: Mover todos os arquivos e sub-diretórios de um diretório para outro
mv MEUDIRETORIO1/* MEUDIRETORIO2
- todos os arquivos e sub-diretórios de MEUDIRETORIO1 serão movidos para MEUDIRETORIO2
Avançando
Para compactar e descompactar arquivos, consulte
Para editar um arquivo diretamente do servidor, consulte
Para alterar permissões de arquivos e diretórios, consulte
Para fazer backup e restore do banco de dados, consulte
- Como efetuar um Backup do banco MySQL via SSH;
- Como restaurar um arquivo .SQL no banco MySQL via SSH;
- Como fazer um backup da minha base PostgreSQL;
- Como fazer um restore da minha base PostgreSQL.
Para Segurança, consulte
- Por que meu acesso SSH parou de funcionar?
- Geração de chave para utilização de SSH, SFTP e SCP
- Protegendo diretórios ou arquivos com senha em Linux
- Como bloquear acesso ao seu site por IP (Linux)
I’m amazed away how much I au fait from this post.
Your collection was both insightful and beautifully written play roulette.
Your post was both insightful and delightfully written.
This is literally what I needed to peruse today Thank you https://cyktexasholdem.com/.
You’ve ìåéä a complex issue accessible Large job.
This post is a gem So pleased as punch I start it.
You’re doing adept work This record is proof of that realmoneycasinobug.com/.
You have a gift instead of explaining complex topics easily.
I in any case look forward to your posts This was another chef-d’oeuvre https://tuvcannabisoil.com/.
Your insights are invaluable In reality conscious of your work
You’ve unambiguously captured the basically of the topic Amazing how to rank website using seo.
Your non-fiction is captivating I learned so much sildenafil online.
Today, I went to the beach with my kids. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She placed the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is totally off topic but I had to tell someone!
I am often to running a blog and i really appreciate your content. The article has really peaks my interest. I’m going to bookmark your website and preserve checking for brand new information.
Hey there! I just wanted to ask if you ever have any problems with hackers? My last blog (wordpress) was hacked and I ended up losing a few months of hard work due to no data backup. Do you have any solutions to protect against hackers?
I do accept as true with all of the ideas you’ve presented on your post. They’re very convincing and will certainly work. Nonetheless, the posts are too quick for starters. Could you please prolong them a bit from subsequent time? Thank you for the post.
Would you be excited by exchanging links?
Hello there! This is my first visit to your blog! We are a collection of volunteers and starting a new project in a community in the same niche. Your blog provided us valuable information to work on. You have done a marvellous job!
I know this if off topic but I’m looking into starting my own weblog and was wondering what all is required to get setup? I’m assuming having a blog like yours would cost a pretty penny? I’m not very internet smart so I’m not 100 sure. Any recommendations or advice would be greatly appreciated. Thank you
Have you ever considered publishing an ebook or guest authoring on other blogs? I have a blog based on the same information you discuss and would love to have you share some stories/information. I know my visitors would value your work. If you are even remotely interested, feel free to shoot me an e-mail.
My brother recommended I might like this web site. He was totally right. This post truly made my day. You can not imagine just how much time I had spent for this information! Thanks!
Good post. I be taught something tougher on completely different blogs everyday. It is going to always be stimulating to read content from different writers and follow a bit of one thing from their store. I’d want to make use of some with the content on my weblog whether or not you don’t mind. Natually I’ll give you a link on your web blog. Thanks for sharing.
thanks for the great info, I really liked the article
You completed a number of nice points there. I did a search on the issue and found nearly all people will have the same opinion with your blog.betflik
Aw, this was a really nice post. In concept I would like to put in writing like this additionally – taking time and precise effort to make an excellent article… but what can I say… I procrastinate alot and under no circumstances seem to get one thing done.
Hi there, simply became alert to your blog through Google, and located that it’s truly informative. I am gonna be careful for brussels. I will appreciate in the event you continue this in future. Many other folks will likely be benefited from your writing. Cheers!
great article!
You completed a number of nice points there. I did a search on the issue and found nearly all people will have the same opinion with your blog.betflik
Hello there, I found your site via Google while looking for a related topic, your site came up, it looks good. I have bookmarked it in my google bookmarks.
thanks!!!!
Thanks a lot for sharing this with all of us you really know what you’re talking about! Bookmarked. Please also visit my website =). We could have a link exchange arrangement between us!